diff --git a/crates/engine-qwen35-cuda/src/backend/clock_tests.rs b/crates/engine-qwen35-cuda/src/backend/clock_tests.rs index ebdce422..4b520367 100644 --- a/crates/engine-qwen35-cuda/src/backend/clock_tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/clock_tests.rs @@ -1,7 +1,11 @@ //! The request clocks of the backend on a manual clock (STRA-338 S14): the terminal publication deadline, the //! prefill/decode accounting of the measurement recorder and the clock reads of the source verification. -use super::*; +use super::{ + BACKPRESSURE_TIMEOUT, Clock, ContractError, Duration, EvaluationMeasurement, FinishReason, GenerationEvent, + GenerationFailure, GenerationSink, GenerationTerminal, NativeBackendConfig, Usage, emit_event, emit_terminal, + measurement, verify_sources_parallel, +}; use leleka_obs::time::ManualClock; fn completed() -> GenerationTerminal { diff --git a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs index 7a40b905..b51e95ba 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof.rs @@ -1,5 +1,21 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationExecution, + EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, + GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, + InputBindingError, KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, + LoadedModel, MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, + OriginalServeMode, OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, + Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, + SystemClock, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, close_context, load, thread, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, +}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners as LoadedTarget; use std::env; pub(super) mod rig; diff --git a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs index fe7ab3b1..e09f59d2 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_changed_boundary_proof/rig.rs @@ -1,7 +1,11 @@ //! The loaded real owners the single-load GPU proofs share: the pinned binding over the inherited sealed archive, //! the device owners built on one bounded Context, a phase run on a fresh target owner, and the teardown whose //! results are asserted only after every attempt was made. Opening and scheduling stay with each proof. -use super::*; +use super::{ + InheritedKarArchive, ModelBinding, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Tokenizer, VerifiedGgufFile, +}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; use std::{ env, panic::{AssertUnwindSafe, catch_unwind}, diff --git a/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs index 6d44f03f..b0325b46 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric.rs @@ -1,7 +1,15 @@ //! Disposable, real-owner numerical observation. Never an actor publication gate. //! Forced inputs are public IDs; no expected model tensors or invented state. use super::combined_changed_boundary_proof::rig::Owners; -use super::*; +use super::{ + AtomicBool, EvaluationExecution, FinishReason, Generation, GenerationSink, ModelBinding, MtpContinuation, Mutex, + Shared, SystemClock, Tokenizer, generate_mtp_resume, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, KarPleCache, MoeWeightCache, MtpDecoder, OutputStage, QwenSession, TargetStepProduct, + TokenId, +}; use crate::qwen_forward::mtp::KnownNext; use crate::qwen_forward::mtp_decode::DraftHeadOwners; use crate::qwen_forward::{mtp::PrefixDraftSnapshot, session::ResetReplaySnapshot}; diff --git a/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs index eb30f0cf..64727086 100644 --- a/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs +++ b/crates/engine-qwen35-cuda/src/backend/combined_prefix_numeric_sdet.rs @@ -3,7 +3,9 @@ use super::combined_changed_boundary_proof::rig::{ DEVICE_BUDGET, MOE_REFUSAL, Owners, PinnedTokenizer, bind_pinned_with_tokenizer, require_opt_in, }; -use super::*; +use super::{Driver, ModelBinding, PathBuf, Rc, Tokenizer}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenSession}; use std::{ env, panic::{AssertUnwindSafe, catch_unwind, resume_unwind}, diff --git a/crates/engine-qwen35-cuda/src/backend/generate.rs b/crates/engine-qwen35-cuda/src/backend/generate.rs index e9d6a2da..523b2ba7 100644 --- a/crates/engine-qwen35-cuda/src/backend/generate.rs +++ b/crates/engine-qwen35-cuda/src/backend/generate.rs @@ -1,5 +1,11 @@ //! The single-token generation step loop. -use super::*; +use super::{ + AtomicBool, BackendError, Clock, DenseWeightCache, Dimension, ErrorCode, EvaluationExecution, FinishReason, + GENERATION_TIMEOUT, GenerationEvent, GenerationFailure, GenerationSink, Instant, KarPleCache, ModelBinding, + MoeWeightCache, MtpDecoder, Ordering, OutputStage, Position, QwenForward, QwenSession, Shared, SystemClock, + TargetStepProduct, TokenId, Tokenizer, Usage, Utf8Pending, emit_event, error, exhausted, generate_mtp, invalid, + measurement, native_position, unavailable, unsupported, +}; use crate::qwen_forward::executor::{PrefillChunkInputs, StepCaches, StepRequest}; pub(super) struct Generation<'a, 'context, 'driver, C: Clock = SystemClock> { diff --git a/crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs b/crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs index aa664e39..7f19143b 100644 --- a/crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/layer0_native_mmq_proof.rs @@ -1,6 +1,8 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. use super::combined_changed_boundary_proof::rig::{DEVICE_BUDGET, Owners, bind_pinned, require_opt_in}; -use super::*; +use super::{Driver, EvaluationExecution, ModelBinding, PathBuf, Rc}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenForward}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use std::{env, panic::resume_unwind}; diff --git a/crates/engine-qwen35-cuda/src/backend/lifecycle_tests.rs b/crates/engine-qwen35-cuda/src/backend/lifecycle_tests.rs index 35ef7acd..c500e7b0 100644 --- a/crates/engine-qwen35-cuda/src/backend/lifecycle_tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/lifecycle_tests.rs @@ -5,7 +5,10 @@ //! `FakeDevice` (no GPU). Time is a `ManualClock` that the device moves by the scripted cost of a chunk or a round, so //! the deadline and the prefill/decode accounting are exact. Normal completion, stop, length, acceptance and timing //! are here; `ends` holds the cancel, deadline and error exits, `prefix` the cross-session cache. -use super::*; +use super::{ + Arc, AtomicBool, ErrorCode, FinishReason, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, + GenerationStream, GenerationTerminal, Mutex, Ordering, Shared, Tokenizer, Usage, original_serve, +}; use crate::qwen_forward::original_serve_engine::{ServeOutcome, ServeStop}; use crate::qwen_forward::original_serve_request::{ServeDevice, ServeError, ServeRequest}; use crate::qwen_forward::original_serve_stack::lifecycle_fake::{FakeDevice, FakeStack, Script, greedy_continuation}; diff --git a/crates/engine-qwen35-cuda/src/backend/load.rs b/crates/engine-qwen35-cuda/src/backend/load.rs index 07e9c6d9..79637a8a 100644 --- a/crates/engine-qwen35-cuda/src/backend/load.rs +++ b/crates/engine-qwen35-cuda/src/backend/load.rs @@ -1,6 +1,12 @@ //! The owner-side Load: bind the sources, open CUDA, build the caches, then serve generations until Unload. //! The phases live in `load_*.rs`; this file fixes the order they run in. -use super::*; +use super::{ + Announcement, BackendError, Bound, Closed, Command, EvaluationExecution, EvaluationObserver, Identity, LoadedModel, + ModelDescriptor, NativeBackendConfig, OptimizedBackendConfig, Ordering, QwenSession, Rc, Receiver, Reply, + RuntimeConfig, Serving, Shared, SystemClock, admit_load, bind_model, build_loaded, check_not_cancelled, + close_context, close_weights, experimental_modes, launch_original, load_weights, new_conversations, + open_checked_context, open_driver, original_serve, probe_experimental_plan, serve_commands, start_governor, +}; use leleka_cuda_driver::Context; /// Everything one Load needs from its owner thread. diff --git a/crates/engine-qwen35-cuda/src/backend/load_cuda.rs b/crates/engine-qwen35-cuda/src/backend/load_cuda.rs index 73eee9e1..2ae66141 100644 --- a/crates/engine-qwen35-cuda/src/backend/load_cuda.rs +++ b/crates/engine-qwen35-cuda/src/backend/load_cuda.rs @@ -1,5 +1,9 @@ //! The CUDA half of a Load: driver, device context, load-time probes and the hand-over to the Original serve stack. -use super::*; +use super::{ + Announcement, BackendError, Bound, Driver, Governed, LoadEnv, LoadPhase, ModelBinding, NativeBackendConfig, Rc, + build_loaded, exhausted, experimental_modes, load_failure, original_serve, probe_experimental, + probe_kar_level_decode, unavailable, +}; use leleka_cuda_driver::Context; pub(super) fn open_driver() -> Result { diff --git a/crates/engine-qwen35-cuda/src/backend/load_tests.rs b/crates/engine-qwen35-cuda/src/backend/load_tests.rs index 54a084cc..abcf50c8 100644 --- a/crates/engine-qwen35-cuda/src/backend/load_tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/load_tests.rs @@ -1,6 +1,9 @@ //! What the phase functions of the Load (STRA-338 S5b) must keep from the code they replaced: the policy flags, the //! execution gates and the weight-cache log line, each compared with the expressions of the former `serve_load`. -use super::*; +use super::{ + Counters, EvaluationExecution, OptimizedBackendConfig, OptimizedOwnerPolicy, PolicyFlags, execution_gate_message, + generation_cache_line, +}; #[cfg(feature = "preview-path")] use crate::qwen_forward::dense_weight_cache::DenseCacheCounters; #[cfg(feature = "preview-path")] diff --git a/crates/engine-qwen35-cuda/src/backend/load_weights.rs b/crates/engine-qwen35-cuda/src/backend/load_weights.rs index f097cc36..092a73bf 100644 --- a/crates/engine-qwen35-cuda/src/backend/load_weights.rs +++ b/crates/engine-qwen35-cuda/src/backend/load_weights.rs @@ -1,5 +1,8 @@ //! The weight caches a native Load builds on the CUDA context: output head, KAR PLE cache, dense and MoE weights. -use super::*; +use super::{ + BackendError, Bound, DenseWeightCache, KarPleCache, LoadEnv, LoadPhase, ModelBinding, MoeWeightCache, OutputStage, + PolicyFlags, exhausted, invalid, load_failure, load_forward_failure, load_moe, +}; use leleka_cuda_driver::Context; type ForwardResult = Result; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs index 68134a23..cb8f8217 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only.rs @@ -1,6 +1,21 @@ //! Candidate-only PUBLIC quality proof against one retained actual Native arm. //! Historical wall time is never used as an A/B measurement. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, DenseWeightCache, Digest, Dimension, Driver, Duration, ErrorCode, + EvaluationExecution, EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FRAME_LIMIT, + FinishReason, Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, + GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, InputConstants, Instant, + KAR_MTP_PROFILE, KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, KarPleCache, + LOAD_CONFIG_VERSION, LoadedModel, MODEL_DIGEST, MeasurementFailure, ModelBinding, ModelDescriptor, MoeWeightCache, + MtpContinuation, MtpDecoder, MtpWindowError, MtpWindowSpec, Mutex, Ordering, OriginalServeChoice, + OriginalServeMode, OriginalServeOptions, OutputStage, PathBuf, Position, PrefixCacheOptions, PrefixTail, QUEUE, + Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, QwenForward, QwenSession, Rc, Receiver, RecentIds, + ResidentConversations, ResidentPolicy, RuntimeConfig, SHARD0, SHARD1, Sha256, Shared, SupportedModelTuple, + SyncSender, SystemClock, TargetStepProduct, TokenId, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, + combined_changed_boundary_proof, emit_terminal, error, generate, generate_mtp_resume, load, measurement, owner, + prepare_prompt, request, session, spawn, thread, +}; use serde_json::{Value, json}; use std::{ env, diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs index 2f954f2b..97fa3cfb 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots.rs @@ -1,7 +1,26 @@ //! Configured five PUBLIC cases on one actual Strata adaptive cache owner. //! No Native inference replay; original paired quality/timing remains separately required. use super::super::combined_changed_boundary_proof::rig::close_context_flags; -use super::*; +use super::{ + Arc, AssertUnwindSafe, AtomicBool, AtomicU64, BACKEND_API_VERSION, BASELINE_SHA, Backend, BackendCapabilities, + BackendError, BackendIdentity, Baseline, CAP, CacheCounts, Clock, ContractError, DEVICE_BUDGET, DeferredTail, + Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, + FinishReason, GenerationEvent, GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, + InferenceMode, InheritedKarArchive, InputBindingError, Inputs, KAR_MTP_PROFILE, KarArchiveRef, KarExpertLevels, + KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, MODEL_DIGEST, MeasurementFailure, + ModelBinding, ModelDescriptor, Mutex, OpenOptions, OpenOptionsExt, Ordering, OriginalServeChoice, + OriginalServeMode, OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Proof, Qwen4ExpArtifact, + Qwen35Cuda, Qwen35CudaStart, Rc, Read, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, Shared, + SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, Value, VerifiedGgufFile, WindowWitness, Write, + baseline, catch_unwind, env, error, fivecase_runtime, json, metadata, path, request, resume_unwind, save, sha, + thread, token_ids, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, +}; use leleka_model_format::qwen4exp::{ProvisionalExpertSource, ResidentExpertSourceReport}; use std::path::Path; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs index 35ccf97f..6f50c2e7 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/cleanup.rs @@ -1,5 +1,8 @@ //! The cleanup documents of the adaptive proof and the assertions made once every teardown attempt was done. -use super::*; +use super::{ + AdaptiveClosed, AssertUnwindSafe, Baseline, InheritedKarArchive, KAR_MTP_PROFILE, MODEL_DIGEST, ModelBinding, Path, + Value, bank_copies_json, catch_unwind, fivecase_runtime, json, resume_unwind, save, token_ids, +}; /// The owner wall profile as the artifacts record it. pub(super) struct OwnerWall { diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs index 50f938fa..4558ed4c 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/adaptive_slots/observe.rs @@ -1,5 +1,7 @@ //! What the adaptive owners reported before and during their ordered teardown. -use super::*; +use super::{AdaptiveOwners, ModelBinding, Value, bank_report_json, json}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, MoeWeightCache}; /// A completion counter as the artifacts record it, and whether it is positive. pub(super) struct Count { diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs index 3cb28b56..714d4d46 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_frames.rs @@ -1,6 +1,9 @@ //! Private CPU-only framing on the caller's already admitted tokenizer. //! No model load, generation, expected outputs or state/capability publication. -use super::*; +use super::{ + CAP, GenerationRequest, Inputs, MODEL_DIGEST, OpenOptions, OpenOptionsExt, PathBuf, Read, Tokenizer, Value, env, + json, path, prepare_prompt, public_renderer, request, save, sha, +}; use std::os::unix::fs::{MetadataExt, PermissionsExt}; const BASE_FRAME_SHA: &str = "9512d4883fca31282206c3a03c8d4d3f3085b5c1dfedd998c8957061e01514e4"; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs index 5211d602..a9326ff1 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/fivecase_runtime.rs @@ -1,6 +1,9 @@ //! Private five fresh public requests on the caller's one admitted model owner. //! This helper neither loads weights nor supplies an output oracle. -use super::*; +use super::{ + Arm, CAP, EvaluationExecution, FinishReason, GenerationRequest, Inputs, KAR_MTP_PROFILE, MODEL_DIGEST, OpenOptions, + OpenOptionsExt, Read, Tokenizer, Value, candidate_windows, env, json, path, prepare_prompt, save, sha, token_ids, +}; use std::os::unix::fs::MetadataExt; const CASE_COUNT: usize = 5; const BASE_FRAME_SHA: &str = "9512d4883fca31282206c3a03c8d4d3f3085b5c1dfedd998c8957061e01514e4"; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs index 6e45880b..2eae83bb 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_arm.rs @@ -1,6 +1,13 @@ //! One actual owner generation on a fresh target/draft state: bounded stream consumer, failure artifact and the //! measurement record of a completed arm. -use super::*; +use super::{ + AtomicBool, CacheCounts, Duration, EvaluationExecution, EvaluationMeasurement, FRAME_LIMIT, FinishReason, + Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, + GenerationTerminal, ModelBinding, MtpContinuation, Ordering, QUEUE, Rc, Shared, SystemClock, Tokenizer, Usage, + Value, WindowWitness, cache, cache_json, emit_terminal, generate_mtp_resume, json, measurement, path, save, thread, +}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, Instant, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; const WALL_BOUNDARY: &str = "immediately before generate_mtp_resume through terminal, actual channel EOF and \ consumer join; excludes session teardown and helpers"; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs index e5544a4a..cd3840f7 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_checks.rs @@ -1,5 +1,5 @@ //! The retained completed Native arm and the checks of the MTP window witnesses of a candidate arm. -use super::*; +use super::{Arm, FRAME_LIMIT, Value, WindowWitness, json, sealed_bytes, sha}; pub(super) const BASELINE_SHA: &str = "4d61ee949d37a738500c889f23f07310b6d75c7c8dfe5f50173eceafe1882fbe"; pub(super) struct Baseline { diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs index 66a7dc9f..401ea479 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_owner.rs @@ -1,6 +1,11 @@ //! The one loaded owner of the PUBLIC candidate proofs: admission of the sealed inputs, the load, the ordered //! teardown and the artifacts of it. The proofs differ only in the `Proof` hooks (`native_down_pair_proofs.rs`). -use super::*; +use super::{ + AtomicBool, BASELINE_SHA, Baseline, CAP, DenseWeightCache, GenerationRequest, InheritedKarArchive, Inputs, Instant, + KAR_MTP_PROFILE, KarPleCache, MODEL_DIGEST, ModelBinding, MoeWeightCache, Mutex, OpenOptions, OpenOptionsExt, + OutputStage, PathBuf, Qwen4ExpArtifact, Rc, Read, SHARD0, SHARD1, Shared, Tokenizer, Value, VerifiedGgufFile, + baseline, env, json, metadata, path, request, save, sha, +}; use crate::qwen_forward::owner_wall_profile::{self, Sample}; use leleka_model_format::qwen4exp::{ProvisionalExpertSource, ResidentExpertSourceReport}; use std::os::unix::fs::PermissionsExt; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs index f7306d30..fb7337b8 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_proofs.rs @@ -1,6 +1,10 @@ //! The four PUBLIC candidate proofs: they differ in the caches they load, in what they generate and in what //! they conclude; the owner, the teardown and the artifacts are shared (`native_down_pair_run.rs`). -use super::*; +use super::{ + Arm, BASELINE_SHA, Baseline, CAP, Check, DenseWeightCache, EvaluationExecution, Finish, FinishReason, + KAR_MTP_PROFILE, MODEL_DIGEST, ModelBinding, MoeFacts, MoeWeightCache, Owner, Proof, QwenForward, QwenSession, Rc, + RunCtx, Value, cache_json, candidate_windows, fivecase_runtime, json, merged, save, token_ids, with_counters, +}; use crate::qwen_forward::moe_expert::LoadedArms; use crate::qwen_forward::moe_weight_cache::LearnedMainWitness; use fivecase_runtime::FiveCaseReport; diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs index be19b50e..59481686 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_candidate_only/pair_run.rs @@ -1,6 +1,9 @@ //! Runs a `Proof` on the one loaded owner: generation, ordered teardown, the cleanup artifacts that survive a //! failed generation, and the assertions that follow every attempted teardown. -use super::*; +use super::{ + AssertUnwindSafe, DEVICE_BUDGET, Driver, Finish, Host, InheritedKarArchive, ModelBinding, Owner, OwnerCounters, + Proof, Rc, RunCtx, Teardown, Value, Witnessed, bank_json, catch_unwind, json, merged, resume_unwind, save, +}; use crate::qwen_forward::owner_wall_profile::{self, Sample}; const SCOPE: &str = diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs b/crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs index 519f7159..d2cee6ef 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_pair_io.rs @@ -1,6 +1,9 @@ //! Files, environment, request framing and counters shared by the PUBLIC pair proofs. //! Included by `native_down_candidate_only.rs` and `native_down_public_pair.rs` (each owns its copy of the state). -use super::*; +use super::{ + CacheCounts, Digest, GenerationRequest, OpenOptions, OpenOptionsExt, Ordering, PathBuf, Read, Sha256, Tokenizer, + Value, Write, env, json, prepare_prompt, public_renderer, +}; pub(super) const ARTIFACT_CAP: usize = 16 * 1024 * 1024; pub(super) static ARTIFACT_BYTES: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0); diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs index fbe75e3e..7bb955cc 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair.rs @@ -1,5 +1,25 @@ //! One-load private PUBLIC generation pair; actual owner timings, never HTTP timings. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationExecution, + EvaluationMeasurement, EvaluationObserver, ExperimentalConfig, ExpertSource, FRAME_LIMIT, FinishReason, Generation, + GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, GenerationTerminal, + InferenceMode, InheritedKarArchive, InputBindingError, KAR_MTP_PROFILE, KarArchiveRef, KarExpertLevels, + KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, MODEL_DIGEST, MeasurementFailure, + ModelBinding, ModelDescriptor, MtpContinuation, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, QUEUE, Qwen4ExpArtifact, Qwen35Cuda, + Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, Shared, SupportedModelTuple, + SyncSender, SystemClock, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, emit_terminal, error, + generate_mtp_resume, load, measurement, owner, request, spawn, thread, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, session, +}; +#[cfg(test)] +use super::prepare_prompt; use serde_json::{Value, json}; use std::{ env, diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs index 7f8bd020..adfd81fd 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_arm.rs @@ -1,6 +1,13 @@ //! One actual owner generation of the one-load PUBLIC pair on a fresh target/draft state: bounded stream //! consumer, failure artifact and the measurement record of a completed arm. -use super::*; +use super::{ + AtomicBool, CacheCounts, Duration, EvaluationExecution, EvaluationMeasurement, FRAME_LIMIT, FinishReason, + Generation, GenerationEvent, GenerationFailure, GenerationRequest, GenerationSink, GenerationStream, + GenerationTerminal, ModelBinding, MtpContinuation, QUEUE, Rc, Shared, SystemClock, Tokenizer, Usage, Value, + WindowWitness, cache, cache_json, emit_terminal, generate_mtp_resume, json, measurement, path, save, thread, +}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage, QwenSession}; pub(super) struct Arm { pub(super) measurement: EvaluationMeasurement, diff --git a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs index 6100c2e5..f11c8353 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_down_public_pair/pair_run.rs @@ -1,5 +1,13 @@ //! The one-load PUBLIC pair: sealed inputs, one owner load, four arms (two warm, two measured) and the artifacts. -use super::*; +use super::{ + ARTIFACT_BYTES, ARTIFACT_CAP, Arm, AssertUnwindSafe, AtomicBool, CAP, DEVICE_BUDGET, Driver, Duration, + EvaluationExecution, GenerationRequest, InheritedKarArchive, Inputs, KAR_MTP_PROFILE, MODEL_DIGEST, ModelBinding, + Mutex, Ordering, PathBuf, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, Shared, Tokenizer, Value, VerifiedGgufFile, + catch_unwind, env, json, long_public_preflight, merged, metadata, ns, path, request, reserve_artifacts, + resume_unwind, save, sha, +}; +#[cfg(feature = "preview-path")] +use super::{DenseWeightCache, KarPleCache, MoeWeightCache, OutputStage}; use std::os::unix::fs::PermissionsExt; const NATIVE_POLICY: &str = "native64-same-dual-cache-retained-mtp-kv"; diff --git a/crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs b/crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs index d407e2ea..a58466d1 100644 --- a/crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/native_resident_mmq_model_proof.rs @@ -1,6 +1,8 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. use super::combined_changed_boundary_proof::rig::{DEVICE_BUDGET, Owners, bind_pinned, require_opt_in}; -use super::*; +use super::{Driver, EvaluationExecution, ModelBinding, PathBuf, Rc}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenForward}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use std::{env, panic::resume_unwind}; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs index 6312395b..1bb36299 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/runner/owner_run_steps.rs @@ -1,8 +1,16 @@ //! The steps of the Original owner loop `run`: open and report the stack, admit and serve a generate command, //! sweep idle sessions and close everything; early exits stay in `run`. -#[allow(unused_imports)] -use super::*; +use super::{ + ActiveGuard, Admission, AtomicBool, BackendError, CapturedIds, ClientLink, Clock, Command, DeferredTail, Duration, + ErrorCode, FinishReason, ForwardError, GENERATION_TIMEOUT, GenerationEvent, GenerationFailure, GenerationRequest, + GenerationSink, GenerationTerminal, IdleSweep, Live, LoadPhase, LoadedModel, LoopCtx, ModelBinding, Ordering, + OriginalServeOptions, OriginalServeStack, PREFIX_SUMMARY, PathBuf, PhaseDurations, PrefixTail, QUEUE, Rc, Receiver, + ReopenEnv, Reply, RequestToServe, ServeDevice, ServeError, ServeFailure, ServeRequest, ServeStop, Shared, + StackConfig, SystemClock, TokenVocabulary, Tokenizer, Usage, Utf8Pending, context_fits, emit_terminal, exhausted, + generate, invalid, load_failure, meta_facts, open_error, prepare_prompt, publish_prefix_summary, stack_config, + unavailable, +}; use leleka_backend_api::GenerationStream; use leleka_cuda_driver::Context; use std::sync::Arc; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs b/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs index b54f0e21..7fa58caa 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of `original_serve`. -use super::*; +use super::{ConfigFacts, OriginalServeChoice, OriginalServeMode, OriginalServeOptions, PathBuf, choose, context_fits}; fn facts() -> ConfigFacts { ConfigFacts { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs index e3e93465..6c37b5c1 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke.rs @@ -23,7 +23,23 @@ //! //! Output lines: `MEM-REPORT ` (the governor's full report), `MEM-CENSUS `, `MEM-SOAK ...`, `MEM-SHED //! ...`, `MEM-RESULT`. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, + EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, + GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, + KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, + MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, + Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, + Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, probes, spawn, thread, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, session, +}; use crate::qwen_forward::original_serve_stack::dbg_el; use crate::qwen_forward::{ original_serve_request::{ServeError, ServeRequest}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/leak.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/leak.rs index 5c6904fc..f7b0b69c 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/leak.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/leak.rs @@ -3,7 +3,7 @@ //! prefix store and the glibc heap, then fits the slope of each series against the request count after the //! warm-up and prints it with its confidence interval. use super::traffic::{Tally, TrafficRequest}; -use super::*; +use super::{Census, Mem, PathBuf, env, list, number, print_report}; const TSV_HEADER: &str = "t_s\treq\trss\trss_anon\trss_file\trss_shmem\tswap\tavail\tcached\tshmem_sys\t\ active_file\tinactive_file\tvram_used\tvram_acct\tprefix_store\tmalloc_arena\tmalloc_in_use\tmalloc_free\t\ diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/load.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/load.rs index 559e3017..cac55044 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/load.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/load.rs @@ -1,6 +1,10 @@ //! Loads the pinned model under the memory governor, opens the serve stack as production starts it and runs the //! scenario of `LELEKA_MEM_SCENARIO` on it. -use super::*; +use super::{ + CancelAt, Census, Driver, Governor, InheritedKarArchive, ModelBinding, OriginalServeStack, PathBuf, PrefixBudget, + PrefixConfig, Qwen4ExpArtifact, Rc, Rng, SHARD0, SHARD1, ServeError, StackConfig, Tokenizer, VerifiedGgufFile, + census, dbg_el, env, filler, guard, number, print_report, required_path, serve_one, text, +}; /// What the operator asked for. struct Plan { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/probe.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/probe.rs index 7af75310..927c0a5f 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/probe.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/probe.rs @@ -1,5 +1,5 @@ //! Model-free probe of the sealed KAR memfd under the governor's residency guard. -use super::*; +use super::{Governor, InheritedKarArchive, env, guard, number, required_path}; /// One second of the probe: the memfd's swapped bytes, the cost of looking, and the swap counters since the last. fn probe_second(governor: &Governor, t: u64, last_in: &mut Option<(u64, u64)>) { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/reader.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/reader.rs index 3a439ca3..4eee1020 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/reader.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/reader.rs @@ -1,7 +1,7 @@ //! The reader scenario: decode speed and the memfd's residency while a competing reader streams a big file //! through the page cache (what the Original did when it read the KAR file next to the memfd): phase A without the //! reader, B with it, C after. -use super::*; +use super::{Mem, NO_STOP, PathBuf, number, print_report, text}; use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/shed.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/shed.rs index 6860327a..9932c0d2 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/shed.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/shed.rs @@ -1,6 +1,6 @@ //! The shed scenario: the prefix cache evicted, requests refused and the budget restored, driven by floors moved //! next to the memory the host has now, so the real limit is never approached. -use super::*; +use super::{Admission, Level, Mem, RequestShape, number, print_report}; use std::time::Duration; fn available() -> u64 { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/soak.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/soak.rs index 60803b4b..1df06f3f 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/soak.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/soak.rs @@ -1,6 +1,6 @@ //! The soak scenario: mixed requests (cancels, refusals, long prompts, prefix-cache churn) judged flat after warm-up. use super::traffic::{Tally, TrafficRequest}; -use super::*; +use super::{Census, Mem, Tolerances, check_flat, list, number, print_report}; /// The knobs of the soak. struct Soak { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/traffic.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/traffic.rs index 6c6fed19..f9a98683 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/traffic.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_memory_smoke/traffic.rs @@ -1,6 +1,6 @@ //! The mixed traffic of the soak and the leak scenarios: sessions that grow by tool turns, big prompts, //! unshared prompts, cancels and requests the governor must refuse. -use super::*; +use super::{Admission, Mem, RequestShape, ServeError}; /// What the traffic has done so far. #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs index c056b168..c706a7de 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke.rs @@ -33,7 +33,23 @@ //! //! Run: `cargo test -p leleka-engine-qwen35-cuda -- --ignored --exact //! backend::original_serve_prefix_smoke::original_serve_prefix_cache_smoke`. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, + EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, + GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, + KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, + MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, + Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, + Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, probes, request, +}; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, session, +}; use crate::qwen_forward::original_serve_stack::dbg_el; use crate::qwen_forward::{ original_serve_request::{ServeError, ServeRequest}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/extras.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/extras.rs index a5c81bbd..f946e8fa 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/extras.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/extras.rs @@ -1,7 +1,7 @@ //! What the prefix-cache smoke does around the served requests: the per-request accounting, the verification //! against a full read, the summary, the pool protocol on the live cache and the cancellation checks. use super::run::Pfx; -use super::*; +use super::{CancelAt, ServeError, Served, env, filler, ids, mem_available_mib, rss_mib, serve_one}; /// What the served requests added up to. #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/run.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/run.rs index e897abef..7d30d4cf 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/run.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_prefix_smoke/run.rs @@ -1,7 +1,11 @@ //! Loads the pinned model, opens the stack in the mode asked for and serves the scripted workload. use super::extras::{RequestAt, Tally}; use super::workload::{Plan, Workload}; -use super::*; +use super::{ + CancelAt, Driver, InheritedKarArchive, ModelBinding, OriginalServeStack, PathBuf, PrefixBudget, PrefixConfig, + Qwen4ExpArtifact, Rc, SHARD0, SHARD1, ServeError, Served, StackConfig, Tokenizer, VerifiedGgufFile, dbg_el, env, + filler, mem_available_mib, number, required_path, rss_mib, serve_one, text, workload, +}; /// The pinned tokenizer and EOS, the KAR archive and the binding with its expert source. struct Pinned { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs index e290b7b6..c46585b2 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke.rs @@ -25,7 +25,25 @@ //! While the verifier window producers listed in `UNBOUND_PRODUCERS` are unbound the stack refuses to open //! with the first missing producer's name; that refusal is the expected result of this smoke until they land. use super::super::qwen_forward::original_serve_stack::dbg_el; -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, + EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, + GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, + KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, + MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, Qwen35Cuda, Qwen35CudaStart, Rc, + Receiver, RecentIds, RuntimeConfig, SHARD0, SHARD1, Sha256, SupportedModelTuple, SyncSender, SystemClock, + Tokenizer, Usage, VerifiedGgufFile, WindowWitness, config, load, original_prompt, probes, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, +}; use crate::qwen_forward::{ original_serve_request::{RequestSampling, ServeError, ServeRequest}, original_serve_stack::{OriginalServeStack, StackConfig}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_conv.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_conv.rs index 79d5369e..247525d6 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_conv.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_conv.rs @@ -1,6 +1,9 @@ //! The conversation cache on the real model: the resume smoke, and the requests, the timing and the chunk //! comparison the coverage smoke shares. -use super::*; +use super::{ + OriginalServeStack, PROMPT, PathBuf, ServeError, StackConfig, Tokenizer, dbg_el, env, env_or, open_pinned, + open_stack, optin, request, with_context, +}; /// What one request of the conversation smokes returned. pub(super) struct Served { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_coverage.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_coverage.rs index 2532fc21..3c3c22b8 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_coverage.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_coverage.rs @@ -1,7 +1,10 @@ //! Coverage of the conversation cache on the real model (documented on //! `original_serve_conversation_coverage_smoke`): every resumed request is compared token for token with the //! same request read from the empty prompt; every check prints a `CONV-CHECK name ok|FAIL` line. -use super::*; +use super::{ + CancelAfter, OriginalServeStack, PROMPT, PathBuf, PromptRequest, ServeError, Served, StackConfig, Tokenizer, + agent_sampler, dbg_el, env, env_or, ids, open_pinned, open_stack, optin, same_chunks, serve_once, with_context, +}; /// The knobs of the coverage smoke. struct Knobs { diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs index dfbc1f2c..5e2c4335 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_long.rs @@ -1,6 +1,11 @@ //! Long-context smoke of the streamed INT8 KV: one greedy request over a prompt far longer than the resident //! window (documented on `original_serve_long_context_streamed_kv_smoke`). -use super::*; +use super::{ + OriginalServeStack, PathBuf, ServeRequest, StackConfig, Tokenizer, collect, dbg_el, env, env_or, ids, number, + open_pinned, open_stack, request, with_context, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; use std::time::Instant; const COLORS: [&str; 8] = ["amber", "blue", "crimson", "green", "grey", "ivory", "orange", "violet"]; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs index 2488c776..8c067990 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main.rs @@ -1,6 +1,25 @@ //! The main smoke: greedy twice across a reset, a sampled request, a cancellation, the optional parity corpus //! and a short prompt on the scalar draft-KV path. -use super::*; +use super::{ + Arc, AtomicBool, AtomicU64, BACKEND_API_VERSION, Backend, BackendCapabilities, BackendError, BackendIdentity, + CacheCounts, Clock, ContractError, DeferredTail, Digest, Driver, Duration, ErrorCode, EvaluationMeasurement, + EvaluationObserver, ExperimentalConfig, ExpertSource, FinishReason, GenerationEvent, GenerationRequest, + GenerationSink, GenerationStream, GenerationTerminal, InferenceMode, InheritedKarArchive, InputBindingError, + KarArchiveRef, KarExpertLevels, KarExpertSource, KarExpertSourceConfig, LOAD_CONFIG_VERSION, LoadedModel, + MeasurementFailure, ModelBinding, ModelDescriptor, Mutex, Ordering, OriginalServeChoice, OriginalServeMode, + OriginalServeOptions, OriginalServeStack, PROMPT, PathBuf, PrefixCacheOptions, PrefixTail, Qwen4ExpArtifact, + Qwen35Cuda, Qwen35CudaStart, Rc, Receiver, RecentIds, RuntimeConfig, ServeError, ServeRequest, Sha256, StackConfig, + SupportedModelTuple, SyncSender, SystemClock, Tokenizer, Usage, VerifiedGgufFile, WindowWitness, agent_sampler, + collect, dbg_el, env, env_or, ids, open_pinned, open_stack, optin, report_timing, request, with_context, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; +#[cfg(feature = "preview-path")] +use super::{ + DenseWeightCache, Dimension, InputConstants, Instant, KarPleCache, MoeWeightCache, MtpDecoder, MtpWindowError, + MtpWindowSpec, OutputStage, Position, QwenForward, QwenSession, ResidentConversations, ResidentPolicy, + TargetStepProduct, TokenId, +}; mod corpus; diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs index 64f46d14..7219897f 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_main/corpus.rs @@ -1,7 +1,9 @@ //! The parity corpus of the main smoke: every line of `LELEKA_SMOKE_PROMPTS` is tokenized with the verified //! tokenizer, served greedily for `LELEKA_SMOKE_MAX_NEW` tokens (default 64) and printed as ids so the Original //! can be run on the same ids. -use super::*; +use super::{ServeError, ServeRequest, Smoke, Tokenizer, agent_sampler, env, env_or, report_timing}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::original_serve_arms; use crate::qwen_forward::{ original_serve_engine::ServeOutcome, original_serve_request::{RequestSampling, original_stop_tokens}, diff --git a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_stack.rs b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_stack.rs index e57c7c39..4b6a3cc2 100644 --- a/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_stack.rs +++ b/crates/engine-qwen35-cuda/src/backend/original_serve_smoke/smoke_stack.rs @@ -1,6 +1,9 @@ //! The pinned model, the Context and the Original serve stack the smokes of `backend_original_serve_smoke.rs` //! run on, and the helpers they share. -use super::*; +use super::{ + Driver, InheritedKarArchive, ModelBinding, OriginalServeStack, Qwen4ExpArtifact, Rc, SHARD0, SHARD1, ServeError, + ServeRequest, StackConfig, Tokenizer, VerifiedGgufFile, dbg_el, env, required_path, +}; use crate::qwen_forward::original_serve_engine::ServeOutcome; use std::str::FromStr; diff --git a/crates/engine-qwen35-cuda/src/backend/profile_tests.rs b/crates/engine-qwen35-cuda/src/backend/profile_tests.rs index e942643a..1986d684 100644 --- a/crates/engine-qwen35-cuda/src/backend/profile_tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/profile_tests.rs @@ -1,7 +1,10 @@ //! The ranked expert profile read through the WeightSource port: the refusals and their order are the ones of the //! former file read, and the double of the port stands in for the file. use super::sources::{read_pinned_profile, read_ranked_expert_profile}; -use super::*; +use super::{ + BackendError, Digest, ErrorCode, RANKED_EXPERT_PROFILE_BYTES, RANKED_EXPERT_PROFILE_SHA, RankedExpertProfileSource, + Sha256, +}; use leleka_model_format::weight_source::MemWeightSource; fn hex(bytes: &[u8]) -> String { diff --git a/crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs b/crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs index 6d2f00d9..83887271 100644 --- a/crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/resident_mmq_model_proof.rs @@ -1,6 +1,8 @@ //! Private sole new changed-path model gate; actual source identity/load preserved. use super::combined_changed_boundary_proof::rig::{DEVICE_BUDGET, MOE_REFUSAL, Owners, bind_pinned, require_opt_in}; -use super::*; +use super::{Driver, PathBuf, Rc}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenForward}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use std::{env, panic::resume_unwind}; diff --git a/crates/engine-qwen35-cuda/src/backend/serve_run.rs b/crates/engine-qwen35-cuda/src/backend/serve_run.rs index 5b432cc8..68efa4f5 100644 --- a/crates/engine-qwen35-cuda/src/backend/serve_run.rs +++ b/crates/engine-qwen35-cuda/src/backend/serve_run.rs @@ -1,5 +1,9 @@ //! Running one admitted generation: the Generation step context and the choice of the generation loop. -use super::*; +use super::{ + Admitted, Exchange, FinishReason, Generation, GenerationFailure, InferenceMode, Job, MtpContinuation, Ordering, + QwenSession, Serving, Usage, clock_seed, generate, generate_mtp_resume, invalid, measurement, request_sampler, + unavailable, unsupported, +}; use std::cell::RefCell; pub(super) type Sampler = Result, leleka_sampler_ref::SamplingError>; diff --git a/crates/engine-qwen35-cuda/src/backend/singleload_proof.rs b/crates/engine-qwen35-cuda/src/backend/singleload_proof.rs index 32ef4c6a..55c99dcc 100644 --- a/crates/engine-qwen35-cuda/src/backend/singleload_proof.rs +++ b/crates/engine-qwen35-cuda/src/backend/singleload_proof.rs @@ -4,7 +4,9 @@ use super::combined_changed_boundary_proof::rig::{ DEVICE_BUDGET, MOE_REFUSAL, Owners, PinnedTokenizer, bind_pinned, bind_pinned_with_tokenizer, require_opt_in, }; -use super::*; +use super::{Driver, ModelBinding, PathBuf, Rc, Tokenizer}; +#[cfg(feature = "preview-path")] +use super::{MoeWeightCache, QwenForward, QwenSession}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use std::{ env, diff --git a/crates/engine-qwen35-cuda/src/backend/tests.rs b/crates/engine-qwen35-cuda/src/backend/tests.rs index 33cd5052..1477b82b 100644 --- a/crates/engine-qwen35-cuda/src/backend/tests.rs +++ b/crates/engine-qwen35-cuda/src/backend/tests.rs @@ -1,4 +1,15 @@ -use super::*; +use super::{ + Active, ActiveGuard, Arc, AtomicBool, Backend, BackendError, Command, DeferredTail, Digest, ErrorCode, + EvaluationExecution, FRAME_LIMIT, GenerationRequest, InferenceMode, KAR_LOAD_REPLY_TIMEOUT, KAR_PROFILE, + LOAD_CONFIG_VERSION, LoadedModel, MODE_DIGEST, MODEL_DIGEST, ModelDescriptor, Mutex, OPTIMIZED_EXECUTION, + OUTPUT_LIMIT, Ordering, PROMPT_LIMIT, Proxy, QUEUE, QUEUED_OWNERS_EXECUTION, RANKED_EXPERT_PROFILE_SHA, + REPLY_TIMEOUT, RecentIds, RuntimeConfig, SHARD0, Sha256, Shared, SyncSender, Tokenizer, Utf8Pending, + kar_expert_mode_digest, kar_mode_digest, load_reply_timeout, mpsc, optimized_execution_digest, + pinned_model_descriptor, prepare_prompt, queued_owners_execution_digest, request_sampler, validate_handle, + validate_kar_selection, validate_load, validate_request, +}; +#[cfg(feature = "preview-path")] +use super::{Dimension, InputConstants, Position, native_position}; #[test] fn queued_owner_identity_is_distinct_and_binds_profile_and_actual_bound_mode() { let old_fields = [ diff --git a/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs b/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs index 05b42faf..7bf82d4c 100644 --- a/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs +++ b/crates/engine-qwen35-cuda/src/conversation/resident/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ResidentConversations, ResidentPolicy, ResumeSource}; fn policy(budget_gib: usize, slots: usize) -> ResidentPolicy { ResidentPolicy { budget_bytes: budget_gib << 30, slots, fixed_bytes: 100 << 20, bytes_per_token: 20_000 } diff --git a/crates/engine-qwen35-cuda/src/experimental/tests.rs b/crates/engine-qwen35-cuda/src/experimental/tests.rs index 0a52a15e..0cfc2d99 100644 --- a/crates/engine-qwen35-cuda/src/experimental/tests.rs +++ b/crates/engine-qwen35-cuda/src/experimental/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + ExperimentalConfig, ExperimentalError, KvFormat, Mode, OptIn, PathBuf, Program, ensure_consumed, + load_control_vector_tables, mode_digest, plan, pool_bytes, +}; fn cfg(modes: &[Mode], resident: i64) -> ExperimentalConfig { let mut opt_in = OptIn::default(); diff --git a/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs b/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs index 0f087edc..bbe73443 100644 --- a/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs +++ b/crates/engine-qwen35-cuda/src/memory_governor/page_cache.rs @@ -1,6 +1,9 @@ //! Page-cache release after the load (`drop_file_cache`), moved out of `memory_governor` by STRA-338 (size). -use super::*; +use super::{ + BackendError, CacheWish, DeviceSample, Entry, EnvSource, FixedItem, Governor, GovernorConfig, HostFacts, HostProc, + KarForm, Mutex, OpenStage, PlanInput, SamplerGuard, Settings, Space, VramFacts, When, +}; /// Give back the page cache the load created: the shards were read once to verify and to copy the resident bank, and /// nothing reads those pages again (the bank is a RAM copy). Left in place they are the cache pressure that pushed the diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs index 1f0f5546..152e1f18 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gdn/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{E, NATIVE_EPSILON, TensorSignature, block_range, descriptor, exact_bf16, kind}; #[test] fn epsilon_is_exact_original_layer_operand() { assert_eq!(NATIVE_EPSILON.to_bits(), 0x358637bd); diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs index f8c3d7b7..7b1c8b58 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/gr/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{GrRole, InputBindingError, TensorSignature, exact_bf16, role_set, validate_descriptor}; #[test] fn gr_binding_accepts_only_exact_finite_bf16_containers() { for bits in [0, 0x80000000, 0x3f800000, 0x00010000, 0x7f7f0000] { diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs index 144d6228..628f694c 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/backing.rs @@ -1,7 +1,11 @@ //! Methods of `OwnedCopy`: `create`, `writer`, `owns_directory`, `owns_file` and 1 more. //! Implements `Drop for OwnedCopy`. Functions: `inode`, `regular`, `root`, `copy_exact` and 8 more. -use super::*; +use super::{ + BindingIdentity, DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, File, + INDEX_BYTES, INDEX_LIMIT, InputBindingError, InputResult, MAX_READ, MAX_ROWS, ModelBinding, MtpExpertMatrix, + MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, read_exact_range, read_expert_rows, +}; use sha2::{Digest, Sha256}; use std::io::Read; use std::os::unix::fs::{DirBuilderExt, MetadataExt, OpenOptionsExt, PermissionsExt}; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs index ad60e93f..fe25a4b9 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/mtp_weight_reads.rs @@ -1,7 +1,11 @@ //! The reads of the MTP weights: dense rows, expert rows and the binding identity check. -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, File, + INDEX_BYTES, INDEX_LIMIT, InputBindingError, InputResult, MAX_READ, MAX_ROWS, ModelBinding, MtpExpertMatrix, + MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, backing, descriptor, read_exact_range, + read_expert_rows, row_range, validate_numeric, +}; impl MtpWeights { /// Operator-only fixed profile. The copy owns an unnamed read-only inode for diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs index 47521e8b..74665dbd 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/read_expert_rows.rs @@ -1,8 +1,11 @@ //! Functions: `read_expert_rows`, `read_expert_row`, `row_range`, `allocate` and 3 more. //! Split out of `mtp` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, DENSE_BYTES, DESCRIPTORS, Dense, Descriptor, EXPERT_BLOB, EXPERT_BYTES, FILE_PINS, File, + INDEX_BYTES, INDEX_LIMIT, InputBindingError, InputResult, MAX_READ, MAX_ROWS, ModelBinding, MtpExpertMatrix, + MtpExpertRef, MtpIndex, MtpKind, MtpRole, MtpRows, MtpWeights, Path, backing, +}; pub(super) fn read_expert_rows( experts: &File, diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs index ba1425e8..0eecf459 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/mtp/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BindingIdentity, DESCRIPTORS, INDEX_LIMIT, InputBindingError, MtpIndex, MtpKind, MtpRole, interleave_q2, row_range, + rt_dense_name, rt_dense_roles, rt_dense_shape, validate_identity, validate_numeric, +}; fn index() -> String { DESCRIPTORS .iter() diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs index f9e30568..fde7c92c 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_input/validate_ple_descriptor.rs @@ -1,8 +1,12 @@ //! Methods of `InputConstants`: `test_fixture`. Methods of `BindingIdentity`: `test_identity`. //! Functions: `validate_ple_descriptor`, `bind_layers`, `bind_layer`. -#[allow(unused_imports)] -use super::*; +use super::{ + BoundLayer, BoundLayerKind, GlobalRole, InputBindingError, InputResult, LayerRole, PLE_ROWS, Qwen4ExpArtifact, + TensorRole, +}; +#[cfg(test)] +use super::{BindingIdentity, InputConstants, Rc}; pub(super) fn validate_ple_descriptor(artifact: &Qwen4ExpArtifact) -> InputResult<()> { let ple = artifact diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs index d2b5d9e6..16ee32f6 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/inherited_kar_archive.rs @@ -1,8 +1,11 @@ //! Methods of `InheritedKarArchive`: `open`, `open_sparse`, `open_sparse`, `sparse_extents` and 7 more. //! Functions: `open_sealed_archive_fd`, `open_read_only_archive`, `check_read_only_archive`, `reopen_read_only_archi... -#[allow(unused_imports)] -use super::*; +use super::{ + ARCHIVE_DIGEST, BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, + KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, Path, + PathBuf, RefCell, SparseArchive, VerifiedKarPleArtifact, private_copy, +}; use leleka_model_format::weight_source::{BackingKind, FileWeightSource, Verification, WeightIdentity}; #[cfg(test)] diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs index 9d2540d3..5be59a2a 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/load_pinned_inherited_archive.rs @@ -1,8 +1,12 @@ //! Methods of `KarRowPacket`: `payload`, `partition`. Methods of `KarRowReader`: `read_rows`. //! Functions: `open_archive_reader`, `load_pinned_inherited_archive`, `log_startup_read`, `load_pinned_inherited_arc... -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, KarPleBinding, + KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, KarRowPacket, KarRowReader, LoadPhase, NATIVE_DIGESTS, + PINNED_ARCHIVE_BYTES, PLE_ROWS, PROVENANCE_DIGEST, Path, PathBuf, RefCell, VerifiedKarPleArtifact, + open_sealed_archive_fd, pinned_profile, reopen_read_only_archive, verify_open_provenance, +}; /// The read handle of the inherited archive: a read-only reopen of the file, or the sealed memfd itself. #[cfg(target_os = "linux")] diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs index 54a64455..eb2263ce 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile.rs @@ -1,8 +1,12 @@ //! Methods of `InheritedKarArchive`: `expert_capture_observation`. //! Functions: `pinned_profile`, `pinned_parts`, `pinned_profile_spec`, `load_pinned_archive` and 3 more. -#[allow(unused_imports)] -use super::*; +use super::{ + ARCHIVE_DIGEST, BindingIdentity, File, InheritedKarArchive, InputBindingError, InputResult, KarError, + KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, LoadPhase, NATIVE_DIGESTS, PART0_F32_DIGEST, + PART1_F32_DIGEST, PLE_ROWS, PROVENANCE_DIGEST, Path, PathBuf, RefCell, VIRTUAL_F32_DIGEST, VerifiedKarPleArtifact, + error, input_failure, kar_failure, private_copy, +}; /// Candidate expectations from independently verified v4 conversion receipts /// d51353be and 0d8a4a52. Construction reads no archive and grants no serving diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs index e7c24590..765a889f 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/pinned_profile_tests.rs @@ -1,7 +1,11 @@ //! Implements `Write for BrokenSink`. //! Functions: `diagnostic_cases`, `assert_kar_diagnostic_redacts`, `assert_input_diagnostic_survives_broken_sink`, `... -use super::*; +use super::{ + BindingIdentity, File, InputBindingError, InputResult, KarError, KarPlePartProvenance, KarPleProfile, + KarPleProfileSpec, LoadPhase, NATIVE_DIGESTS, PLE_ROWS, Path, PathBuf, RefCell, VerifiedKarPleArtifact, error, + input_diagnostic, kar_diagnostic, pinned_profile, pinned_profile_spec, +}; #[cfg(not(target_os = "windows"))] struct BrokenSink; diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs index 15ca77af..c38b579c 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/checked_reader.rs @@ -1,8 +1,10 @@ //! Functions: `checked_reader`, `copy_exact`, `copy_exact_reporting`, `copy_buffer` and 1 more. //! Split out of `private_copy` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + COPY_BUFFER, File, InputBindingError, InputResult, IoPhase, LoadPhase, Metadata, MetadataExt, OpenOptions, + OpenOptionsExt, Path, Read, SOURCE_FLAGS, Seek, Write, inode, input_failure, phase_error, report_io, +}; #[cfg(target_os = "macos")] pub(super) fn checked_reader(own: &OwnedCopy, bytes: u64) -> InputResult { diff --git a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs index c08842b8..2a04e19b 100644 --- a/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs +++ b/crates/engine-qwen35-cuda/src/model_binding/qwen4exp_kar_ple/private_copy/inode.rs @@ -1,8 +1,10 @@ //! Methods of `OwnedCopy`: `create`, `created`, `writer`, `detach` and 2 more. Implements `Drop for OwnedCopy`. //! Functions: `inode`, `diagnostic`, `report_io`, `phase_error` and 8 more. -#[allow(unused_imports)] -use super::*; +use super::{ + File, Inode, InputBindingError, InputResult, IoPhase, LoadPhase, Metadata, MetadataExt, OpenOptions, + OpenOptionsExt, Path, Read, SOURCE_FLAGS, Seek, Write, checked_reader, copy_exact, input_failure, +}; pub(super) fn inode(meta: &Metadata) -> Inode { (meta.dev(), meta.ino()) diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs index 8de5cecf..e6ac1bf0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/dense_weight_cache/workspaces.rs @@ -1,8 +1,12 @@ //! The lazily created workspaces of the dense weight cache, moved out of it by STRA-338 (size): consecutive owners, //! declared in the order the cache dropped them, so the drop order is unchanged. -#[allow(unused_imports)] -use super::*; +use super::{ + DeviceBuffer, GdnInputScratch, GrBatchInjectWorkspace, GrScratch, QkScratch, QsaAttentionScratch, QsaIndexKeyCache, + QsaInputScratch, QsaSelectedCache, Rc, RefCell, RouterScratch, +}; +#[cfg(test)] +use super::Cell; /// Every scratch owner of the cache that starts empty (`None` or an empty list) and is filled on first use. #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs index 81d4e73a..095553e6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk.rs @@ -3,7 +3,14 @@ //! attention, then completes the whole FFN GR bank. Qualification is pending. #![allow(dead_code)] use super::super::session::chunk::QwenChunkTxn; -use super::*; +use super::{ + BindingIdentity, BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, GrRead, GrStage, + InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, ModelBinding, MoeExpertStage, MoeRouteStage, + MoeWeightCache, OutputStage, Position, QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenForward, + QwenSession, QwenStepTxn, Result, Stage, StepCaches, StepPurpose, StepRequest, TargetStepOrigin, TargetStepProduct, + TokenId, VerificationChunk, VerificationSource, WindowCaches, diagnose, prefill_chunk, + prepare_layer_attention_micro, read_layer_attention, validate_layer_plan, +}; #[derive(Clone, Copy)] enum ChunkMoePolicy { Native, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs index 98430e36..cc2806e2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/check_chunk_on_loaded.rs @@ -2,8 +2,10 @@ //! Methods of `Rig`: `snapshot`, `prefill`, `step_final`, `prefill_chunk` and 7 more. #![cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[allow(unused_imports)] -use super::*; +use super::{ + DenseWeightCache, Dimension, Error, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, Position, + PrefillChunkInputs, QwenForward, QwenSession, Result, Stage, TokenId, +}; use crate::qwen_forward::executor::{PrefillStepProduct, StepCaches, StepRequest, TargetStepProduct}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::mtp::KnownNext; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/mmq_evaluation.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/mmq_evaluation.rs index 18b11396..fa276bda 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/mmq_evaluation.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/mmq_evaluation.rs @@ -1,5 +1,9 @@ //! Only the explicitly selected new full-model MMQ gate. Old observers unchanged. -use super::*; +use super::{ + ChunkMoePolicy, DenseWeightCache, Dimension, Error, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, + Position, PrefillChunkInputs, QwenForward, QwenSession, Result, Stage, StepCaches, StepRequest, TargetStepProduct, + TokenId, +}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::mtp::KnownNext; use crate::qwen_forward::mtp::MtpChunkNumericSnapshot; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/native_mmq_evaluation.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/native_mmq_evaluation.rs index d454697f..d363b188 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/native_mmq_evaluation.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/native_mmq_evaluation.rs @@ -1,6 +1,6 @@ //! Separate native-certified activation model observer. Original failed observer unchanged. use super::mmq_evaluation::{ChunkExact, ChunkRun, MmqRun, Observation, pos}; -use super::*; +use super::{QwenForward, TokenId}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::mtp_decode::MtpDecoder; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs index 99137de5..be175d50 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward.rs @@ -1,8 +1,17 @@ //! Groups the submodules `joint_chunk`, `prefill_chunk_cached_windowed`, `prefill_chunk_native_windowed` and 1 more. //! Split out of `prefill_chunk` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + AttentionHandoff, BindingIdentity, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, + ForwardPhase, GdnStage, GrRead, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, MicroEnv, + ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, QsaAttentionStage, + QsaIndexStage, QsaPrepareRequest, QwenChunkTxn, QwenForward, QwenSession, QwenStepTxn, Result, Stage, StepCaches, + StepPurpose, StepRequest, TargetStepOrigin, TargetStepProduct, TokenId, VerificationChunk, VerificationSource, + WindowCaches, chunk_diagnostic, diagnose, prefill_chunk, prepare_layer_attention_micro, prepare_micro_ffn_rows, + prepare_q6_layer_columns, qwen_forward, read_chunk_attention_ffn, read_layer_attention, validate_layer_plan, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::{check_chunk_on_loaded, window_numeric}; mod joint_chunk; #[allow(unused_imports)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs index f7314c4c..4db0ebcc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned.rs @@ -1,8 +1,18 @@ //! Methods of `ChunkEnv`: `new`, `with_boundary`, `native_prompt`. Methods of `ChunkRun`: `window`. //! Defines `MicroBank`, `MicroBank`, `NativeMoe` and 6 more. -#[allow(unused_imports)] -use super::*; +use super::{ + AllocationTrace, AttentionHandoff, BindingIdentity, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, + Error, ForwardPhase, GdnStage, GrRead, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, + MicroEnv, ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, PrefillChunkInputs, + PrefillChunkPlan, QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenChunkTxn, QwenForward, QwenSession, + QwenStepTxn, Result, Stage, StepCaches, StepPurpose, StepRequest, TargetStepOrigin, TokenId, VerificationChunk, + VerificationSource, WindowCaches, chunk_diagnostic, diagnose, prepare_layer_attention_micro, + prepare_micro_ffn_rows, prepare_q6_layer_columns, qwen_forward, read_chunk_attention_ffn, read_layer_attention, + validate_layer_plan, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; use leleka_cuda_driver::Context; mod chunk_layer; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs index 6cfc359b..ce89ceca 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_layer.rs @@ -2,8 +2,12 @@ use super::window_experts::ExpertRun; use super::window_ffn::WindowOwners; -#[allow(unused_imports)] -use super::*; +use super::{ + BoundLayerKind, ChunkEnv, ChunkRun, Context, Dimension, Error, GdnPlan, InjectedResidual, LayerId, MoeWeightCache, + NativeMoe, QwenChunkTxn, QwenForward, Result, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; use crate::qwen_forward::gdn::chunk_device::GdnChunkDevice; use crate::qwen_forward::moe_expert::ChunkFfnLayer; use crate::qwen_forward::session::chunk::{ChunkFfnRow, ChunkMicroWindow}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs index d1bcf062..496b946d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/chunk_setup.rs @@ -1,7 +1,12 @@ //! STRA-338 size: admission, transaction begin, input rows and output head of one prefill chunk. -#[allow(unused_imports)] -use super::*; +use super::{ + ChunkEnv, ChunkMoePolicy, ChunkOpening, Context, DenseWeightCache, Error, InjectedResidual, InputStage, + KarPleCache, ModelBinding, MoeWeightCache, OutputStage, PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, + QwenForward, QwenSession, QwenStepTxn, Result, Stage, chunk_diagnostic, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; /// The MMQ actor context, and the contexts of the recurrence and verification GDN owners when they are in use. type ChunkContexts<'ctx, 'driver> = diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs index f79636b3..65062021 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_attention.rs @@ -1,7 +1,13 @@ //! STRA-338 size: the attention reads of one window of a prefill layer. -#[allow(unused_imports)] -use super::*; +use super::{ + ChunkEnv, ChunkRun, Error, GrStage, InjectedResidual, InputStage, LayerEntry, LayerId, MicroBank, QwenChunkTxn, + QwenForward, Result, Stage, chunk_diagnostic, prepare_layer_attention_micro, read_layer_attention, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::window_numeric; +#[cfg(test)] +use super::QwenStepTxn; use crate::qwen_forward::session::chunk::ChunkAttentionRow; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::qwen_forward::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs index 733eebc6..82248e3f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_experts.rs @@ -1,7 +1,9 @@ //! STRA-338 size: the expert execution and the batched FFN injection of one window of a prefill layer. -#[allow(unused_imports)] -use super::*; +use super::{ + ChunkEnv, ChunkMoePolicy, ChunkRun, Error, GrStage, InjectedResidual, LayerId, MoeExpertStage, MoeWeightCache, + NativeMoe, QwenChunkTxn, QwenForward, Result, Stage, chunk_diagnostic, +}; use crate::qwen_forward::gr::GrBatchRow; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::qwen_forward::moe_expert::NativePromptFinish; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs index 8da4ecfa..7606f215 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/qwen_forward/prefill_chunk_planned/window_ffn.rs @@ -1,7 +1,11 @@ //! STRA-338 size: the projected columns and the prepared FFN rows of one window of a prefill layer. -#[allow(unused_imports)] -use super::*; +use super::{ + AttentionHandoff, BoundLayerKind, ChunkEnv, ChunkRun, Error, ForwardPhase, GdnStage, InjectedResidual, LayerId, + MicroBank, MicroEnv, MoeExpertStage, MoeRouteStage, NativeMoe, Position, QwenChunkTxn, QwenForward, QwenStepTxn, + Result, Stage, TokenId, chunk_diagnostic, diagnose, prepare_micro_ffn_rows, prepare_q6_layer_columns, + read_chunk_attention_ffn, +}; use crate::qwen_forward::gdn::chunk_device::{ChunkEdge, GdnChunkDevice}; use crate::qwen_forward::gdn::{DeviceChunkRow, GdnLayerInput}; use crate::qwen_forward::gr::DetachedGrRead; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs index 20f5e318..ea40d3bf 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/read_chunk_attention_ffn.rs @@ -1,8 +1,12 @@ //! Methods of `AttentionHandoff`: `new`. //! Methods of `QwenForward`: `test_layer0_pair_on_loaded`, `run_layer0_diagnostic`. -#[allow(unused_imports)] -use super::*; +use super::{DenseWeightCache, ForwardPhase, GrStage, ModelBinding, Result, diagnose}; +#[cfg(test)] +use super::{ + ChunkMoePolicy, Dimension, Error, KarPleCache, MoeWeightCache, OutputStage, PrefillChunkInputs, QwenForward, + QwenSession, Stage, TokenId, +}; use crate::qwen_forward::gr::AttentionBlockOutput; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs index bbf01b2d..6f76e6a6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric.rs @@ -1,7 +1,14 @@ //! Changed MicroWindow boundary observer. No model loading or serving switch. //! The returned report owns only counts/booleans; its assertions belong AFTER //! the caller has closed all actual GPU owners and checked allocated_bytes=0. -use super::*; +use super::{ + AttentionHandoff, BindingIdentity, BoundLayerKind, ChunkMoePolicy, DenseWeightCache, Dimension, Error, GdnStage, + GrRead, GrStage, InjectedResidual, InputStage, KarPleCache, LayerEntry, LayerId, MicroEnv, ModelBinding, + MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, Position, PrefillChunkInputs, PrefillChunkPlan, + QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenChunkTxn, QwenForward, QwenSession, QwenStepTxn, Result, + Stage, StepCaches, StepPurpose, StepRequest, TargetStepOrigin, TargetStepProduct, TokenId, VerificationChunk, + VerificationSource, WindowCaches, qwen_forward, +}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::mtp_decode::MtpDecoder; use std::{cell::Cell, rc::Rc}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs index f99ae017..dc9ae9c8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/prefill_chunk/window_numeric/proof.rs @@ -1,7 +1,10 @@ //! The proof phases of the window boundary observer (STRA-338 size: extract-method only). -#[allow(unused_imports)] -use super::*; +use super::{ + BoundaryPlan, Cell, ChunkMoePolicy, DenseWeightCache, Dimension, Error, KarPleCache, ModelBinding, MoeWeightCache, + MtpDecoder, OutputStage, PartialReport, Position, PrefillChunkInputs, PrefillChunkPlan, QwenChunkTxn, QwenForward, + QwenSession, Rc, Result, Stage, StepCaches, StepRequest, TargetStepProduct, TokenId, owned_journal, tokens, +}; use crate::qwen_forward::mtp::KnownNext; use crate::qwen_forward::mtp::MtpChunkNumericSnapshot; use crate::qwen_forward::session::ResetReplaySnapshot; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs index c175ee24..f5111017 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/reset_replay_sdet.rs @@ -1,6 +1,9 @@ //! Cache-reset-replay numerical proof, moved out of `executor.rs` by STRA-338 (size); same module path as before. -use super::*; +use super::{ + BoundLayerKind, DenseWeightCache, Dimension, KarPleCache, ModelBinding, MoeWeightCache, OutputStage, Position, + QwenForward, QwenSession, Result, StepCaches, StepRequest, TokenId, validate_layer_plan, +}; use crate::qwen_forward::loaded_target_owners::LoadedTargetOwners; use crate::qwen_forward::{ dense_weight_cache::DenseCacheCounters, moe_weight_cache::WeightCacheCounters, session::ResetReplaySnapshot, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs index 07ee9b6a..7a5576a4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/step_layers.rs @@ -1,7 +1,11 @@ //! Phases of `QwenForward::step_core` (STRA-338 size: extract-method only, same order of operations). -#[allow(unused_imports)] -use super::*; +use super::{ + BoundLayerKind, DenseWeightCache, Dimension, Error, ForwardPhase, GdnStage, GrRead, GrStage, InjectedResidual, + InputStage, KarPleCache, LayerId, ModelBinding, MoeExpertStage, MoeRouteStage, MoeWeightCache, OutputStage, + Position, QsaAttentionStage, QsaIndexStage, QsaPrepareRequest, QwenStepTxn, Result, TokenId, diagnose, + read_layer_attention, validate_layer_plan, +}; use crate::qwen_forward::gdn::GdnLayerInput; use crate::qwen_forward::moe_expert::ExpertRowRequest; use crate::qwen_forward::qsa_attention::QsaReady; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs index 7b82ed9b..33c2ff59 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/executor/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BoundLayerKind, Dimension, Error, LayerId, OutputStage, Position, QwenForward, QwenSession, QwenStepTxn, Result, + Stage, TokenId, validate_descriptors, +}; #[test] fn topology_validation_requires_the_exact_contiguous_closed_sequence() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/gpu_tests.rs index 9640d90e..63086880 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/gpu_tests.rs @@ -5,7 +5,10 @@ use super::super::{ GateHostOperands, GdnOwner, GdnPrior, GdnStateMirror, OutNormScale, RecurrenceOperands, convolve, gates, normalize_qk, out_norm, recur, release, upload, }; -use super::*; +use super::{ + BindingIdentity, CHANNELS, Cell, Chain, Context, DeviceBuffer, Error, GdnMatrixKind, HISTORY_ELEMENTS, Product, Rc, + Role, TokenLayer, VALUES, allocate, download, +}; use crate::qwen_forward::contract::{Dimension, LayerId, Position, TokenId}; use leleka_cuda_driver::{Bf16ProjectionShape, Driver}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/row_queue_gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/row_queue_gpu_tests.rs index 1b510138..3f0492dd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/row_queue_gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chain/row_queue_gpu_tests.rs @@ -7,7 +7,11 @@ use super::super::{ GateHostOperands, OutNormScale, RecurrenceOperands, STATE_ELEMENTS, convolve, gates, normalize_qk, out_norm, recur, release, upload, }; -use super::*; +use super::{ + BindingIdentity, CHANNELS, Cell, Chain, Context, DeviceBuffer, DeviceOperand, Error, GdnMatrixKind, GdnRowQueue, + HISTORY_ELEMENTS, QkScratch, QkvInput, QueueInputs, QueuedRow, Rc, Result, Role, TokenLayer, VALUES, allocate, + download, +}; use crate::qwen_forward::contract::{Dimension, LayerId, Position, TokenId}; use leleka_cuda_driver::{Bf16ProjectionShape, Driver}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs index 1e6560b8..757f9fa4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device.rs @@ -2,7 +2,19 @@ #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::session::chunk::GdnChunkMicro; use super::super::session::chunk::{GdnChunkRow, GdnChunkSeal, GdnChunkStart}; -use super::*; +use super::{ + ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, Context, DenseFormat, DenseWeightCache, + DeviceBuffer, DeviceChunkRow, Dimension, DriverError, Error, GateHostOperands, GdnInputLease, GdnInputScratch, + GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, GdnStateKey, + GdnStateMirror, GdnWeights, GrRole, HISTORY_ELEMENTS, InputBindingError, LayerId, LeaseClaim, LeasedProjection, + MirrorAuthority, MirrorStep, ModelBinding, OutNormScale, ProjectedQkvSource, ProjectionKind, ProjectionOperands, + ProjectionSpec, PromptLayer, PromptProgram, PromptSource, Q5KProjectionShape, Q6KProjectionShape, QkScratch, + QwenStepTxn, ReadoutClaim, RecurrenceOperands, ResidualReady, Result, STATE_ELEMENTS, Stage, TokenLayer, VALUES, + allocate, chain, download, download_unchecked, driver_error, pool_enabled, preflight_budget, release, state, + upload, validate_values, verification, +}; +#[cfg(test)] +use super::CHANNELS; use leleka_cuda_driver::{GdnRowQueue, GdnStateFiniteGuard}; use std::{cell::Cell, rc::Rc}; pub(in crate::qwen_forward) const CHUNK_DEVICE_CHARGE: usize = 2 * STATE_ELEMENTS * 4 + 4; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs index fbb9e73b..ebcd590f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods.rs @@ -1,8 +1,19 @@ //! Groups the submodules `chunk_device_batch_compute`, `chunk_device_construction`, `chunk_device_finish_cleanup`. //! Split out of `chunk_device` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, CHUNK_DEVICE_CHARGE, Cell, ChunkEdge, + ChunkReadout, Context, DenseFormat, DenseWeightCache, DeviceBuffer, DeviceChunkRow, Dimension, DriverError, Error, + GateHostOperands, GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnInputLease, + GdnInputScratch, GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, + GdnRowQueue, GdnStateFiniteGuard, GdnStateKey, GdnStateMirror, GdnWeights, GrRole, HISTORY_ELEMENTS, + InputBindingError, LayerId, LeaseClaim, LeasedProjection, MirrorAuthority, MirrorStep, ModelBinding, OutNormScale, + ProjectedQkvSource, ProjectionKind, ProjectionOperands, ProjectionSpec, PromptLayer, PromptProgram, PromptSource, + Q5KProjectionShape, Q6KProjectionShape, QkScratch, QwenStepTxn, Rc, ReadoutClaim, ReadoutDownload, + RecurrenceOperands, ResidualReady, Result, STATE_ELEMENTS, Stage, TokenLayer, VALUES, allocate, chain, download, + download_unchecked, driver_error, micro_rows, mirror_reuse_enabled, pool_enabled, preflight_budget, release, state, + upload, validate_values, verification, +}; mod chunk_device_batch_compute; mod chunk_device_construction; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs index 4969f312..460d22fb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/gdn_chunk_device_methods/chunk_device_batch_compute.rs @@ -1,8 +1,12 @@ //! Methods of `GdnChunkDevice`: `finish_batch`, `history`, `step_source`, `read_checked` and 13 more. //! Split out of `gdn_chunk_device_methods` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ChunkEdge, ChunkReadout, DeviceBuffer, Error, GdnChunkDevice, GdnChunkRow, HISTORY_ELEMENTS, Rc, ReadoutDownload, + Result, VALUES, allocate, download, driver_error, preflight_budget, validate_values, +}; +#[cfg(test)] +use super::upload; impl<'ctx> GdnChunkDevice<'ctx> { /// Adopt the final state of a batch that drained clean: the separate `next` diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs index ea1b657f..346878c5 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu.rs @@ -3,7 +3,18 @@ use super::super::super::contract::{Dimension, LayerId}; use super::super::super::session::chunk::TestGdnComponentRows; use super::super::{RecurrenceOperands, convolve, recur}; -use super::*; +use super::{ + ALL_MIRROR_BYTES, Bf16ProjectionShape, BindingIdentity, BoundLayerKind, CHANNELS, CHUNK_DEVICE_CHARGE, Cell, + ChunkReadout, Context, DenseFormat, DenseWeightCache, DeviceBuffer, DeviceChunkRow, DriverError, Error, + GateHostOperands, GdnChunkDevice, GdnChunkMicro, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnInputLease, + GdnInputScratch, GdnLayerInput, GdnMatrixKind, GdnMatrixLayout, GdnMatrixRole, GdnOwner, GdnPending, GdnPrior, + GdnRowQueue, GdnStateFiniteGuard, GdnStateKey, GdnStateMirror, GdnWeights, GrRole, HISTORY_ELEMENTS, + InputBindingError, LeaseClaim, LeasedProjection, MirrorAuthority, MirrorStep, ModelBinding, OutNormScale, + ProjectedQkvSource, ProjectionKind, ProjectionOperands, ProjectionSpec, PromptLayer, PromptProgram, PromptSource, + Q5KProjectionShape, Q6KProjectionShape, QkScratch, QwenStepTxn, Rc, ReadoutClaim, ResidualReady, Result, + STATE_ELEMENTS, Stage, TokenLayer, allocate, chain, download, driver_error, preflight_budget, release, state, + upload, validate_values, +}; use leleka_cuda_driver::Driver; const ROWS: usize = 65; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs index 54cff189..87950278 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/batch_adoption.rs @@ -1,8 +1,10 @@ //! Functions: `batch_adoption`, `adoption_rows`, `adoption_phase`, `batch_operand_guards` and 6 more. //! Split out of `numeric_gpu` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, Context, Dimension, Error, GdnChunkDevice, GdnChunkRow, GdnPrior, HISTORY_ELEMENTS, LayerId, + Result, STATE_ELEMENTS, TestGdnComponentRows, component_owner, difference, download, driver_error, require, +}; // Batch adoption of the Strata-prefill step. Pure ownership/identity: no kernel // runs here, the final state is a recognisable pattern written into `next`. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs index fe326ba3..81e5f18f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/chunk_device/numeric_gpu/exercise.rs @@ -1,8 +1,12 @@ //! Methods of `Fixture`: `new`, `row_guards`, `run_rows`, `compute_row` and 12 more. //! Functions: `require_rejected_clean`, `exercise`, `run_gdn_chunk_numeric`. Defines `Fixture`, `ComputedRow`. -#[allow(unused_imports)] -use super::*; +use super::{ + BUDGET, BindingIdentity, CHUNK_DEVICE_CHARGE, ChunkReadout, Context, Counts, DeviceBuffer, Dimension, Driver, + Error, GdnChunkDevice, GdnChunkRow, GdnChunkSeal, GdnPrior, GdnStateFiniteGuard, LayerId, Operands, Rc, Reference, + Result, STATE_ELEMENTS, TestGdnComponentRows, component_owner, convolution_input, convolution_weights, convolve, + difference, download, driver_error, operands, reference, require, upload, +}; // The prior, the same-PTX reference and the row sources every stage of the component proof uses. struct Fixture { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs index af9719f4..aa103a5f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/driver_error.rs @@ -1,8 +1,11 @@ //! Functions: `driver_error`, `validate_candidates`, `state_index`, `key_head`. //! Split out of `gdn` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{DriverError, Error, KEY_HEADS, Result, Stage, VALUE_HEADS, WIDTH}; +#[cfg(test)] +use super::CandidateFixture; +#[cfg(test)] +use super::{HISTORY_ELEMENTS, STATE_ELEMENTS, TokenLayer, validate_values}; pub(in super::super) fn driver_error(error: DriverError) -> Error { if crate::driver_errors_traced() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/four_borrow_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/four_borrow_gpu.rs index 49b09a85..3f23f160 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/four_borrow_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/four_borrow_gpu.rs @@ -1,6 +1,9 @@ //! ONE binding-loaded layer0 transport proof; no synthetic ModelBinding, //! fabricated session advancement or all48/full-model qualification. -use super::*; +use super::{ + Context, DenseWeightCache, Dimension, Error, FOUR_BORROW_BYTES, GdnPrior, GdnStage, HISTORY_ELEMENTS, LayerId, + ModelBinding, QwenStepTxn, ResidualReady, Result, STATE_ELEMENTS, Stage, VALUES, validate_values, +}; use crate::qwen_forward::gdn::GdnLayerInput; use crate::qwen_forward::{ contract::{Position, TokenId}, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/input_scratch_gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/input_scratch_gpu_tests.rs index 3bd12d48..67bfa62e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/input_scratch_gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/input_scratch_gpu_tests.rs @@ -1,6 +1,9 @@ //! New per-layer input lease parity; synthetic component, never ModelBinding. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -use super::*; +use super::{ + BindingIdentity, Context, DeviceBuffer, Error, GdnInputLease, GdnInputScratch, GdnMatrixKind, GdnMatrixLayout, + GdnMatrixRole, LeaseClaim, allocate, dispatch_projection, download, input_scratch, project_retained, upload, +}; use input_scratch::INPUT_BYTES; use leleka_cuda_driver::Driver; use std::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gpu_tests.rs index 3e05d547..1775b1ce 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/mirror/gpu_tests.rs @@ -1,7 +1,7 @@ //! New device mirror against the actual uncached recurrence, not a model oracle. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::super::{GdnOwner, HISTORY_ELEMENTS, RecurrenceOperands, recur}; -use super::*; +use super::{BindingIdentity, Cell, Context, Error, GdnPrior, GdnStateMirror, MIRROR_BYTES, MirrorNext, Rc, VALUES}; use crate::qwen_forward::contract::{Dimension, LayerId, Position, TokenId, TokenLayer}; use leleka_cuda_driver::Driver; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs index 50cd289e..a2bac559 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch.rs @@ -13,7 +13,11 @@ use super::super::session::chunk::GdnChunkMicro; use super::chunk_device::GdnChunkDevice; use super::chunk_producer::ChunkReady; -use super::*; +use super::{ + BoundLayerKind, CHANNELS, Context, DenseWeightCache, DeviceBuffer, Dimension, Error, GdnMatrixKind, GdnMatrixRole, + GdnStage, HISTORY_ELEMENTS, LayerId, ModelBinding, PromptLayer, Result, Stage, TokenLayer, VALUE_HEADS, VALUES, + download, driver_error, validate_values, +}; use leleka_cuda_driver::{GDN_BATCH_EPSILON, GDN_BATCH_MAX_TOKENS, GdnGemm, GdnNativeFormat, GdnPrefillBatch}; const MIXED: usize = 2560; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gpu.rs index 356249ef..e4014c8c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/prefill_batch/gpu.rs @@ -3,7 +3,7 @@ //! and the chunk adoption in `gdn_chunk_numeric_gpu.rs`; the full model step //! needs a bound `ModelBinding`, a loaded `DenseWeightCache` and a real //! adapter, so its qualification is Root's Original17 prefill gate. -use super::*; +use super::{BATCH_SCRATCH_BYTES, Bf16Profile, EAGER_TOKENS, GdnBatchResources, batch_device_bytes}; use leleka_cuda_driver::Driver; #[test] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs index ca7c5254..42607b35 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification.rs @@ -3,7 +3,12 @@ use super::super::session::{ TargetStepOrigin, chunk::{GdnChunkRow, GdnChunkStart}, }; -use super::*; +use super::{ + BindingIdentity, CHANNELS, Context, DeviceBuffer, Error, GdnPrior, HISTORY_ELEMENTS, LayerId, Result, + STATE_ELEMENTS, Stage, TokenLayer, VALUES, allocate, chain, download, driver_error, validate_values, +}; +#[cfg(test)] +use super::{CandidatePair, upload}; use leleka_cuda_driver::GdnStateFiniteGuard; use std::{ cell::{Cell, RefCell}, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/numeric_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/numeric_gpu.rs index d5e3ca4f..533f41da 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/numeric_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gdn/verification/numeric_gpu.rs @@ -1,5 +1,8 @@ //! Numerical transport proof of the MTP verification journal (test-only; moved out of the parent file by STRA-338). -use super::*; +use super::{ + COUNTS, CandidatePair, Context, DeviceBuffer, Error, GdnStateFiniteGuard, Result, STATE_ELEMENTS, VALUES, + VerifiedRowBuffers, allocate, compute_row, download, driver_error, upload, +}; use leleka_cuda_driver::Driver; struct Numerical<'ctx> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_residual_reuse_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_residual_reuse_gpu.rs index 81f76219..faa380f6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_residual_reuse_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/gr_residual_reuse_gpu.rs @@ -1,6 +1,9 @@ //! New GR residual transport parity through actual private serving helpers. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -use super::*; +use super::{ + BindingIdentity, Cell, Context, DeviceBuffer, Error, GrScratch, Rc, download_f32, inject_cached_cuda, + read_cached_cuda, upload_bf16, upload_f32, +}; use leleka_cuda_driver::Driver; use std::cell::RefCell; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs index 0c79ccd4..407ea719 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu.rs @@ -1,7 +1,13 @@ //! Functions: `run_proof`, `compare_outputs`, `release_owners`, `original_first_fixed_outputs_repeat_overwrite_abort... //! Defines `Tally`. -use super::*; +use super::{ + AttentionBlockOutput, BindingIdentity, Cell, Context, DenseWeightCache, DetachedGrRead, DeviceBuffer, Dimension, + DriverError, Error, GR_OUTPUT_BYTES, GR_OUTPUT_DEVICE_BYTES, GrBatchRow, GrMicroAttention, GrMicroAttentionBank, + GrMicroAttentionBlock, GrMicroBlock, GrMicroInput, GrRole, GrScratch, GrWeights, InputBindingError, LayerId, + MicroBlockRequest, ModelBinding, PleReady, QwenStepTxn, Rc, ReadCandidate, RefCell, RefMut, Result, TokenLayer, + download_f32, driver_error, inject_cached_cuda, read_cached_cuda, retained_handoff, upload_bf16, upload_f32, +}; use leleka_cuda_driver::Driver; #[derive(Default)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/output_workspace_proof_stages.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/output_workspace_proof_stages.rs index 215f17a5..585ce05f 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/output_workspace_proof_stages.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/output_workspace_gpu/output_workspace_proof_stages.rs @@ -1,5 +1,9 @@ //! The stages of the output workspace proof; the parent owns the tally, the proof driver and the test. -use super::*; +use super::{ + BindingIdentity, Cell, Context, DeviceBuffer, Error, GrScratch, Rc, ReadCandidate, RefCell, Result, Tally, block, + check_handoff, coefficients, compare_outputs, download_f32, driver_error, fresh_inject, fresh_read, + inject_cached_cuda, poison_all, read_cached_cuda, retained_handoff, streams, upload_bf16, upload_f32, +}; type Weights<'m, 'c> = &'m [DeviceBuffer<'c>; 4]; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs index 02970e42..b3621bc8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff.rs @@ -2,7 +2,15 @@ //! The actual finite host witness remains canonical; only its duplicate H2D //! is removed. No device-only host proof or changed arithmetic is introduced. use super::read_cached_cuda::borrow_injection; -use super::*; +use super::{ + Cell, Context, DenseWeightCache, DetachedGrRead, DeviceBuffer, Error, GrMicroAttentionBank, GrMicroAttentionBlock, + GrPhase, GrRead, GrRole, GrScratch, GrStage, InjectedResidual, LayerId, ModelBinding, QwenStepTxn, + READ_DEVICE_BYTES, Rc, ReadCandidate, RefMut, ResidualReady, Result, TokenLayer, admit_budget, batch_chunk, + copy_cached_f32, diagnose, download_f32, driver_error, read_cached_cuda, validate_layer, validate_streams, + validate_values, +}; +#[cfg(test)] +use super::{BindingIdentity, inject_cached_cuda, upload_bf16, upload_f32}; /// The attention block output an attention residual is injected with, and the token and layer it was computed for. #[derive(Clone, Copy)] pub(in crate::qwen_forward) struct AttentionBlockOutput<'a> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff/installed.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff/installed.rs index bd793c6a..8b83f4cc 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff/installed.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/retained_handoff/installed.rs @@ -1,6 +1,9 @@ //! Only the new actual attention-injection -> FFN GR ownership/transport seam. //! Scalar host-roundtrip executes FIRST. No fabricated model/session proof. -use super::*; +use super::{ + BindingIdentity, Cell, Context, DeviceBuffer, Error, GrScratch, Rc, download_f32, inject_cached_cuda, + inject_replace_residual, read_cached_cuda, replace_residual_buffer, upload_bf16, upload_f32, +}; use leleka_cuda_driver::Driver; use std::cell::RefCell; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs index c1c260cd..6375eba7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/gr/tests.rs @@ -1,6 +1,8 @@ //! Unit tests of `gr`. -use super::*; +use super::{ + BindingIdentity, Dimension, Error, GrRole, InjectedResidual, LayerId, TokenLayer, validate_layer, validate_streams, +}; #[test] fn gr_preflight_keeps_all_inputs_unchanged_on_shape_or_numeric_refusal() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs index 3dfa1c29..53c5d647 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/input/gather_rows.rs @@ -1,8 +1,14 @@ //! Methods of `InputReady`: `test_fixture`. Methods of `PleOwner`: `new`, `matches`. //! Functions: `gather_rows`, `binding_error`. -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, Dimension, EMBEDDING_VALUES, Error, GrRole, InjectedResidual, InputBindingError, InputError, + LayerId, ModelBinding, PLE_HC, PLE_HISTORY, PLE_ROW_VALUES, PleMicroBatchReady, PleMicroInput, PleOwner, + PlePending, PlePrior, PleReady, PleState, Position, QwenStepTxn, Rc, Result, Stage, TokenLayer, ple_values, + ple_zeros, +}; +#[cfg(test)] +use super::{InputReady, ResidualStreams, TokenId}; pub(super) fn gather_rows( rows: &[u64; 16], diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs index ebd71eda..8fad61f9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/lru_tests.rs @@ -1,7 +1,7 @@ //! Methods of `Rng`: `next`, `row`. Methods of `Scan`: `new`, `victim`, `plan`, `gather`. //! Functions: `token`, `gather_equals_the_full_scan_on_random_sequences`, `chunks_and_gathers_interleaved_keep_every... -use super::*; +use super::{Lookup, Residents, SLOTS, assign_slots, lookup_rows, plan_gather, publish_gather}; use std::collections::HashMap; struct Rng(u64); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs index 55c269cf..9b8ab142 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/row_parity_probe.rs @@ -1,7 +1,7 @@ //! Functions: `fnv`, `probe_binding`, `probe_rows`, `dump_decoded_rows_for_original_comparison` and 2 more. //! Split out of `kar_ple_cache` to keep its files under the line limit. -use super::*; +use super::{BindingIdentity, KarPleBinding, KarPleCache, PLE_ROWS}; use crate::model_binding::qwen4exp_kar_ple::pinned_profile; use leleka_cuda_driver::Driver; use leleka_model_format::kar::{KarInspection, VerifiedKarPleArtifact}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs index ecf1b60b..3d6dca7d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/kar_ple_cache/slot_tests.rs @@ -1,7 +1,7 @@ //! Functions: `apply`, `the_scatter_staging_buffers_match_the_update_records`, `chunk`, `consistent` and 9 more. //! Defines `Given`. -use super::*; +use super::{Error, Lookup, MAX_MISSES, Residents, UPDATE_RECORD_BYTES, assign_slots, lookup_rows, scratch_bytes}; /// What `KarPleCache::commit` does to the map, over the pure parts. fn apply(entries: &mut Residents, lookup: &Lookup, miss_slot: &[u32], victims: &[Option], stamp: u64) { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs index 5eb0486b..4e89fa25 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/expert_matrix_projection.rs @@ -1,8 +1,16 @@ //! Functions: `matrix_dims`, `gate_up_dims`, `prepared_routed_format`, `gate_up_prepared_format` and 15 more. //! Defines `MatrixDims`, `ExpertMatrix`, `ExpertActivation` and 2 more. -#[allow(unused_imports)] -use super::*; +use super::{ + BoundExpert, CachedMoeMatrix, Context, DEVICE_PEAK, DenseFormat, DeviceBuffer, Error, FF, ModelBinding, + MoeExpertBlock, MoeExpertSelection, MoeExpertWeights, MoeMatrixKind, MoeMatrixRole, MoeWeightCache, N, + ProjectionKind, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, Result, RoutedFormat, RoutedGateUpQ8, + Stage, binding_error, download_f32, driver_error, upload_bytes, +}; +#[cfg(test)] +use super::TILE; +#[cfg(test)] +use super::validate_values; /// Shape and format of one expert matrix as the binding declares it. #[derive(Clone, Copy)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs index be0af4c0..02a2cccb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped.rs @@ -2,7 +2,20 @@ //! Exact scalar Q8_1 arithmetic; this is not the tensorcore MMQ numerical profile. use super::super::gr::{DetachedGrRead, GrStage}; use super::super::session::chunk::{ChunkFfnRow, QwenChunkTxn}; -use super::*; +use super::{ + ActualDown, ActualSlotPacket, BindingIdentity, BoundExpert, CachedMoeMatrix, Cell, CompletedCpuRow, Context, + DEVICE_PEAK, DeviceBuffer, DownOrigin, DownProvenance, DownScope, DownSelection, DriverError, Error, + ExpertActivation, ExpertReady, FF, GrRole, K, LayerId, MatrixDims, MmqChunkRequest, ModelBinding, + MoeExpertSelection, MoeExpertStage, MoeExpertWeights, MoeMatrixKind, MoeMatrixRole, MoeWeightCache, N, PackedDown, + QwenStepTxn, Rc, Result, RetainedDown, RoutedExperts, RoutedFormat, RoutedGateUpQ8, SharedTailRow, SourceMatrix, + Stage, StepCuda, TokenLayer, TransportBuffer, admit_budget, binding_error, cached_mlp_down, download_f32, + driver_error, dual_routed_format, execute_cuda_cached, launch_cached_projection, moe_down, validate_values, +}; +#[cfg(test)] +use super::{ + DeclaredMatrix, DenseFormat, ExpertMatrix, ExpertRowRequest, InputBindingError, KarExpertSource, KarSourceError, + MoeExpertBlock, ProjectionKind, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, ResidualReady, +}; use leleka_cuda_driver::DownColumns; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] mod adaptive_packets; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs index 36075ad2..7adfe339 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu.rs @@ -1,6 +1,16 @@ //! ONE loaded actual-row transport proof. No source admission, ModelBinding, //! session advancement, standalone Load or full-model qualification is minted. -use super::*; +use super::{ + BindingIdentity, BoundExpert, CachedMoeMatrix, ChunkFfnLayer, ChunkFfnRow, CompletedCpuRow, Context, DEVICE_PEAK, + DeclaredMatrix, DenseFormat, DeviceBuffer, DownColumns, DownProvenance, DownScope, DownSelection, DriverError, + Error, ExpertActivation, ExpertGroup, ExpertMatrix, ExpertReady, ExpertRowRequest, FF, GrRole, GrStage, + InputBindingError, K, KarExpertSource, KarSourceError, LayerId, MatrixDims, MmqChunkRequest, ModelBinding, + MoeExpertBlock, MoeExpertSelection, MoeExpertStage, MoeExpertWeights, MoeMatrixKind, MoeMatrixRole, MoeWeightCache, + N, NativePromptFinish, PackedDown, PacketGroupMembers, PreparedMoeRow, ProjectionKind, ProjectionSpec, + Q5KProjectionShape, Q6KProjectionShape, QwenChunkTxn, Rc, ResidualReady, Result, RetainedDown, RoutedExperts, + RoutedFormat, RoutedGateUpQ8, RowTail, SharedTailRow, SourceMatrix, Stage, StepCuda, TokenLayer, TransportBuffer, + download_f32, driver_error, moe_down, validate_values, +}; use crate::qwen_forward::gr::DetachedGrRead; use crate::qwen_forward::session::{QwenStepTxn, ResetReplaySnapshot, chunk::ChunkAttentionRow}; use crate::qwen_forward::{ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs index b83ac0a6..bf231305 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/arm.rs @@ -1,8 +1,10 @@ //! Functions: `arm`, `probe_payload`, `preflight_copy`, `corrupted_bytes` and 1 more. //! Split out of `direct_gpu` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + Cell, ChunkFfnLayer, DEVICE_PEAK, DownScope, Error, FF, K, LoadedArms, MoeExpertStage, N, Observation, ObservedArm, + QwenChunkTxn, Result, SLOTS, arm_chunk_rows, arm_tokens, cancel_probe, +}; pub(super) fn arm<'ctx>( arms: &mut LoadedArms<'_, '_, 'ctx>, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs index b71abf35..8d458a04 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/loaded_arms.rs @@ -1,8 +1,10 @@ //! Methods of `LoadedArms`: `arm`, `matches_snapshot`, `precheck`, `reference_and_candidate` and 2 more. //! Methods of `QwenForward`: `test_direct_down_on_loaded`. -#[allow(unused_imports)] -use super::*; +use super::{ + CANCELLED_ON_COPY, DirectDownReport, DirectRun, Error, K, LoadedArms, N, ObservedArm, QwenForward, + ResetReplaySnapshot, Result, Stage, arm, compare, output_differences, same_outputs, transport_probe, +}; impl LoadedArms<'_, '_, '_> { pub(super) fn arm(&mut self, old: bool, cancel_after_copy: bool) -> Result { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs index 9538e1a9..3d9b7147 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/policy.rs @@ -1,8 +1,12 @@ //! Methods of `Observation`: `begin`, `take`. Methods of `DirectDownReport`: `assert_after_teardown`. //! Implements `Drop for Observation`. Functions: `policy`, `copy_completed`, `observe_packet`, `compare` and 7 more. -#[allow(unused_imports)] -use super::*; +use super::{ + CANCELLED_ON_COPY, COPIED, ChunkAttentionRow, ChunkFfnRow, DenseWeightCache, DetachedGrRead, DeviceBuffer, + Dimension, DirectDownReport, Error, GdnStage, GrStage, InputStage, K, KarPleCache, LayerId, ModelBinding, + MoeExpertStage, MoeRouteStage, N, OLD, Observation, PACKETS, PreparedMoeRow, QwenChunkTxn, QwenStepTxn, Result, + TokenId, download_f32, validate_values, +}; use crate::qwen_forward::gdn::GdnLayerInput; pub(in super::super) fn policy(actual: bool) -> bool { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs index f3354031..1c468146 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/direct_gpu/probe.rs @@ -1,8 +1,10 @@ //! Methods of `Probe`: `run`, `fill_sentinels`, `split_and_pack_old`, `copy_direct` and 7 more. //! Functions: `transport_probe`, `output_differences`, `same_outputs`. -#[allow(unused_imports)] -use super::*; +use super::{ + Cell, Context, DownScope, DownSelection, DriverError, Error, ExpertReady, K, N, Probe, Rc, Result, SLOTS, + corrupted_bytes, download_f32, driver_error, preflight_copy, probe_payload, refuse_alien_scope, validate_values, +}; impl<'ctx> Probe<'_, 'ctx> { pub(super) fn run(&mut self) -> Result { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/layer0_pair.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/layer0_pair.rs index aaebea33..bef7bdba 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/layer0_pair.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/grouped/layer0_pair.rs @@ -1,5 +1,8 @@ //! Same actual sealed rows and transaction, native first, no publication. -use super::*; +use super::{ + ChunkFfnLayer, ChunkFfnRow, Error, ExpertReady, K, LayerId, ModelBinding, MoeExpertStage, MoeWeightCache, + QwenChunkTxn, Result, +}; use crate::qwen_forward::layer0_mmq_observation as observation; fn counters(cache: &MoeWeightCache<'_>) -> [u64; 5] { let c = cache.counters(); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs index 9ad5e2c9..dfb7a46c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_expert/tests.rs @@ -1,6 +1,8 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{DEVICE_PEAK, Error, FF, N, admit_budget}; +#[cfg(test)] +use super::collect_rows; #[test] fn completed_tiles_keep_all_rows_and_late_failure_withholds_candidate() { let values = collect_rows(N, |first, count| { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs index e0470d6f..c042c301 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_prefill_batch/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + EXPERTS, Error, FF, GdnNativeFormat, MIXED, MoeBf16Profile, MoeWeightDescriptor, SELECTED, device_bytes, + down_format, f32_bytes, gate_up_format, validate_route_row, +}; fn descending() -> ([i32; SELECTED], [f32; SELECTED]) { (std::array::from_fn(|i| (i * 7) as i32), std::array::from_fn(|i| 0.2 - i as f32 * 0.01)) diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs index d64817fb..a6ecbfca 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_route/tests.rs @@ -1,4 +1,7 @@ -use super::*; +use super::{ + BindingIdentity, DriverError, EXPERTS, Error, ExpertId, LOGITS_BYTES, LayerId, Result, RoutedExperts, RouterLogits, + SELECTED, Stage, TokenId, TokenLayer, map_driver_error, route_with, +}; use crate::qwen_forward::contract::{Dimension, Position}; // The oracle's explicit lane-index loops preserve the fixed warp traversal. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs index 65b517d9..864d8cd7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_lru_index/lru_index.rs @@ -1,8 +1,10 @@ //! Methods of `LruIndex`: `new`, `with_capacity`, `metadata_bytes`, `len` and 15 more. //! Split out of `cache_lru_index` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ABSENT, Error, HOST_LIMIT, LruIndex, MAX_KEYS, MAX_PROTECTED, MoeWeightDescriptor, Node, PER_LAYER, + PreparedUpdates, Result, slot, +}; impl LruIndex { #[cfg(any(test, all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64")))] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs index 6e8f58e2..644c1ba9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill.rs @@ -1,5 +1,16 @@ //! Binding-authenticated constructor; metadata alone cannot produce weights. -use super::*; +use super::{ + AdaptiveWitness, BindingIdentity, BoundExpert, Cell, Context, DeviceBuffer, DeviceRef, EncodedWeight, Entry, Error, + FixedMtpWeights, HashMap, LearnedMainWitness, LruIndex, MAIN_LIMIT, MmqChunkRequest, MmqFormat, MmqWeights, + MmqWorkspace, ModelBinding, MoeExpertSelection, MoeExpertWeights, MoeMatrixRole, MoeWeightCache, + MoeWeightDescriptor, MtpExpertPicks, MtpHeadSources, MtpInputWorkspace, MtpKind, MtpKvClaim, MtpKvResident, + MtpRole, MtpStepSite, PREFILL_STREAM_OVERRIDE, PendingMtpKv, PreparedUpdates, PromptWeightOwners, Rc, RefCell, + Result, RetainedOriginalMtpWeights, RoutedFiniteStage, RoutedGroupWorkspace, RoutedStageFiniteGuard, SharedKeys, + SharedPermanentWitness, SharedTailRow, SharedWeightsRequest, SourceMatrix, TripletLoanRequest, WORKING_RESERVE, + WeightCacheCounters, binding_error, cache_profile, cache_strata_adaptive, driver_error, +}; +#[cfg(test)] +use super::room_fits; #[cfg(test)] use cache_profile::ProfileWitness; use cache_profile::{HOST_CAP, PROFILE_SHA, PinnedPool, PrefixPlan, ProfileLimits, RankedProfile}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs index 36d9fda3..7786e9cd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache.rs @@ -1,8 +1,19 @@ //! Groups the submodules `pinned_triplet_preload`, `profile_ranked_fill_and_pool`. //! Split out of `cache_profile_fill` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + AdaptiveWitness, BindingIdentity, BoundExpert, Cell, Context, DeviceBuffer, DeviceRef, EncodedWeight, Entry, Error, + FixedMtpWeights, HOST_CAP, HashMap, LearnedMainWitness, LruIndex, MAIN_LIMIT, MmqChunkRequest, MmqFormat, + MmqWeights, MmqWorkspace, ModelBinding, MoeExpertSelection, MoeExpertWeights, MoeMatrixRole, MoeWeightCache, + MoeWeightDescriptor, MtpExpertPicks, MtpHeadSources, MtpInputWorkspace, MtpKind, MtpKvClaim, MtpKvResident, + MtpRole, MtpStepSite, PREFILL_STREAM_OVERRIDE, PROFILE_SHA, PendingMtpKv, PinnedPool, PrefixPlan, PreparedUpdates, + ProfileLimits, PromptWeightOwners, RankedProfile, Rc, RefCell, Result, RetainedOriginalMtpWeights, + RoutedFiniteStage, RoutedGroupWorkspace, RoutedStageFiniteGuard, SharedKeys, SharedPermanentWitness, SharedTailRow, + SharedWeightsRequest, SourceMatrix, TripletLoanRequest, WORKING_RESERVE, binding_error, driver_error, + profile_window_spill_with_floor, +}; +#[cfg(test)] +use super::ProfileWitness; mod pinned_triplet_preload; mod profile_ranked_fill_and_pool; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs index c1976144..76872ac1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/moe_weight_cache/pinned_triplet_preload.rs @@ -1,8 +1,14 @@ //! Methods of `MoeWeightCache`: `preload_pinned_triplet`, `admit_pinned_triplet`, `pinned_layouts`, `check_pinned_ro... //! Defines `PinnedLayouts`, `PinnedSource`, `PinnedAdmission`. -#[allow(unused_imports)] -use super::*; +use super::{ + DeviceRef, EncodedWeight, Entry, Error, MAIN_LIMIT, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, + WORKING_RESERVE, binding_error, driver_error, +}; +#[cfg(test)] +use super::ProfileWitness; +#[cfg(test)] +use super::PinnedPool; /// Layouts, charges and the checked next counters of one pinned triplet upload. #[derive(Clone, Copy)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs index 7a3b772c..5d90efa4 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/profile_build.rs @@ -2,8 +2,11 @@ //! extract-method only). // Stays a glob on purpose: the file is at the 400-line limit and the explicit list would put it over. -#[allow(unused_imports)] -use super::*; +use super::{ + Context, Entry, Error, HOST_CAP, HashMap, MAIN_LIMIT, ModelBinding, MoeMatrixRole, MoeWeightCache, + MoeWeightDescriptor, PinnedPool, PrefixPlan, ProfileLimits, RankedProfile, Result, WORKING_RESERVE, + WeightCacheCounters, binding_error, cache_profile, driver_error, profile_window_spill_with_floor, +}; /// Which sizing and seeding the profile build uses. #[allow(dead_code)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs index be970cc5..9120d462 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/moe_weight_cache/cache_profile_fill/shared_quartet_preload.rs @@ -4,7 +4,12 @@ #[allow(unused_imports)] #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] use super::profile_build::{ProfileFile, ProfileKind, ProfileRequest}; -use super::*; +use super::{ + DeviceRef, EncodedWeight, Entry, Error, MAIN_LIMIT, ModelBinding, MoeWeightCache, MoeWeightDescriptor, Result, + WORKING_RESERVE, binding_error, cache_profile, driver_error, +}; +#[cfg(test)] +use super::{Context, PROFILE_SHA, RankedProfile}; /// The room a shared quartet upload must leave free: the spill allowance and the main pool size once the quartet is /// inserted. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs index 3d4effe1..7f659162 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/kv_only.rs @@ -1,5 +1,7 @@ //! Private canonical cell producer. It never represents a ready draft/residual. -use super::*; +use super::{Error, ModelBinding, MoeWeightCache, MtpFrame, MtpInput, QwenSession, Result}; +#[cfg(test)] +use super::{Cell, MtpSession, Rc}; use crate::qwen_forward::session::chunk::{ChunkRowResidual, QwenChunkTxn}; // The same validated frame and canonical packed K/V tuple. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs index 72626b18..238c23cf 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/chunk/mtp_session.rs @@ -1,8 +1,10 @@ //! Methods of `MtpSession`: `test_chunk_snapshot`, `test_chunk_eq`. //! Split out of `chunk` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +#[cfg(all(test, target_arch = "x86_64"))] +use super::MtpChunkNumericSnapshot; +#[cfg(test)] +use super::{MtpSession, Rc}; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] impl MtpSession { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs index ae8d78aa..2ebf9e07 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/prefix_draft_snapshot.rs @@ -1,8 +1,11 @@ //! Methods of `PrefixDraftSnapshot`: `has_prefix`, `numeric_eq`, `retained_bytes`. //! Methods of `MtpSession`: `test_prefix_snapshot`, `admit_snapshot_owner`, `admit_snapshot_frame`. -#[allow(unused_imports)] -use super::*; +use super::{CellPair, Error, HALF_ROW, MtpCheckpoint, MtpFrame, Rc, Result}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::PrefixDraftSnapshot; +#[cfg(test)] +use super::{ModelBinding, MtpSession}; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] impl PrefixDraftSnapshot { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs index c7de3c36..510c1d5e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp/state/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BindingIdentity, Cell, CellPair, DenseKv, Dimension, Error, HALF_ROW, MtpCheckpoint, MtpFrame, MtpSession, + Position, Rc, TokenId, Weak, first_seed_retained_charge, validate_half, +}; use crate::qwen_forward::session::QwenSession; fn draft() -> (MtpSession, MtpFrame) { let binding = BindingIdentity::test_identity(); diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs index f5788120..282b5669 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_attention/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{Error, geometry, validate_window}; #[test] fn mtp_attention_new_causal_geometry_and_budget_boundaries() { for (position, width, half_bytes, scratch) in [ diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs index 8edf3483..14c39eb8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/batch_gpu.rs @@ -1,6 +1,11 @@ //! ONE authentic changed MTP boundary. Root schedules this ignored entry only. //! Full heads/state stay private; output contains counts and predicates only. -use super::*; +use super::{ + DenseWeightCache, Dimension, DraftHeadOwners, Error, KarPleCache, KnownNext, ModelBinding, MoeWeightCache, + MtpDecoder, MtpInput, MtpSession, MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, Position, + PrefillStepProduct, QwenForward, QwenSession, ReadyMtpChunk, Result, StepSessions, TargetStepProduct, TokenId, + VerificationChunk, VerificationSource, WindowCaches, WindowOwners, mtp, +}; use crate::model_binding::qwen4exp_kar_ple::InheritedKarArchive; use crate::qwen_forward::contract::Stage; use crate::qwen_forward::session::ResetReplaySnapshot; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/chunk.rs index 4d551d2e..8536a674 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/chunk.rs @@ -1,5 +1,5 @@ //! Real ordered MTP warm edges with a jointly published target chunk. -use super::*; +use super::{Error, ModelBinding, MoeWeightCache, MtpDecoder, Result, mtp, reserve}; use crate::qwen_forward::{ mtp::MtpChunkStage, session::chunk::{ChunkDraftPublication, QwenChunkTxn}, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs index d275798c..26821682 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder.rs @@ -1,8 +1,15 @@ //! The methods of `MtpDecoder` that run a window: the batched window (with its plan), the scalar window and the //! draft warm-up. Separate from `mtp_decode`, which holds the decoder itself. -#[allow(unused_imports)] -use super::*; +use super::{ + DenseWeightCache, Dimension, DraftHeadOwners, Error, KarPleCache, KnownNext, ModelBinding, MoeWeightCache, + MtpDecoder, MtpInput, MtpSession, MtpVerifiedWindow, MtpWindowError, MtpWindowRequest, MtpWindowSpec, OutputStage, + Position, PrefillStepProduct, QwenForward, QwenSession, ReadyMtpChunk, Result, StepSessions, TargetStepProduct, + TokenId, VerificationChunk, VerificationSource, WindowCaches, WindowOwners, first_seed_reuse_enabled, + kv_prefill_host_charge, mtp, needed_draft_predictions, reserve, window_limit, window_stage_error, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::batch_gpu; mod batched_window_plan; mod batched_window; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/draft_warm_and_window.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/draft_warm_and_window.rs index 9bd966e5..63900082 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/draft_warm_and_window.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_decode/mtp_decoder/draft_warm_and_window.rs @@ -1,7 +1,10 @@ //! MtpDecoder: draft warming along known-next edges, and the window entry that picks the batched or scalar window. -#[allow(unused_imports)] -use super::*; +use super::{ + Dimension, DraftHeadOwners, Error, KnownNext, ModelBinding, MoeWeightCache, MtpDecoder, MtpInput, MtpSession, + MtpVerifiedWindow, MtpWindowError, MtpWindowRequest, PrefillStepProduct, QwenSession, Result, StepSessions, + TargetStepProduct, TokenId, WindowOwners, kv_prefill_host_charge, mtp, reserve, +}; impl MtpDecoder { pub(crate) fn new(binding: &ModelBinding) -> Result { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs index b1813f4d..d2b727b2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/role.rs @@ -1,8 +1,12 @@ //! Methods of `Role`: `slot`, `output_slot`, `count`. //! Methods of `Transport`: `new`, `note`, `allocate`, `buffer` and 11 more. -#[allow(unused_imports)] -use super::*; +use super::{ + Cell, DEVICE_PEAK, DeviceBuffer, Error, FF, Finite, FixedBuffers, N, Rc, Result, Role, Slot, Transport, at, + download, moe_driver_error, preflight, validate_values, +}; +#[cfg(test)] +use super::K; impl Role { pub(super) fn slot(self) -> Slot { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs index f7588007..aca3f382 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/fixed_workspace/transport_drop.rs @@ -1,8 +1,13 @@ //! Methods of `Packed`: `new`, `pack`, `observe_packed`, `combine`. Methods of `Slot`: `bytes`. //! Implements `Drop for Transport`. Functions: `at`, `routed_hidden`, `routed_down`, `routed` and 8 more. -#[allow(unused_imports)] -use super::*; +use super::{ + CHARGES, Cell, DenseFormat, DeviceBuffer, Error, ExpertInputs, FF, Finite, FixedBuffers, K, N, Packed, + ProjectionKind, ProjectionSpec, QuantizedIndices, Rc, Result, Role, RouteSlot, Slot, Transport, moe_driver_error, + preflight, validate_route, validate_values, +}; +#[cfg(test)] +use super::download; impl Drop for Transport<'_, '_> { fn drop(&mut self) { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs index f4b5cb04..fe6cff1e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/mtp_expert_transport/shared_project.rs @@ -1,8 +1,16 @@ //! Methods of `Packed`: `new`, `pack`, `observe_packed`, `combine`. //! Functions: `shared_project`, `shared_hidden`, `shared_down`, `shared_scaled` and 6 more. -#[allow(unused_imports)] -use super::*; +use super::{ + Cell, Context, DenseFormat, DeviceBuffer, Error, FF, Finite, K, N, Packed, ProjectionKind, ProjectionSpec, Rc, + Result, Role, RoutedExpert, Transport, at, moe_driver_error, preflight, routed, validate_route, validate_values, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::FixedReference; +#[cfg(test)] +use super::ObservedOutput; +#[cfg(test)] +use super::download; pub(super) fn shared_project( transport: &mut Transport<'_>, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs index e2ef6ee9..efae8aa1 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/mtp_experts/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{Error, K, down_tile, gate_up_tile, validate_route}; fn fixture(rows: usize, blocks: usize, salt: u8) -> Vec { let mut bytes = vec![0; rows * blocks * 18]; for row in 0..rows { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs index b259f621..e2ecd974 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_config/tests.rs @@ -1,6 +1,12 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + Error, ExpertBlobSizes, OriginalMtpGrVariant, RopeConstants, SamplerPath, driver_sampler_params, greedy_params, + legacy_footprint, mtp_full_policy, mtp_pack_experts_needed, mtp_scalar_policy, prefill_layout_options, + sampler_path, verify_geometry, +}; +#[cfg(test)] +use super::legacy_footprint_from; #[test] fn the_pack_expert_bank_is_needed_only_without_an_rt_directory() { // pack-driven draft (no RT directory): the pack's experts are the draft layer's experts diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/env_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/env_tests.rs index b0a9626d..2eed6bf0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/env_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/env_tests.rs @@ -3,7 +3,7 @@ //! `NanGuard::from_environment`): what each spelling selects, and which malformed values are ignored. use super::super::original_spec_adaptive::{AdaptiveConfig, FLOOR_CEILING_LEGACY}; use super::super::original_spec_controller::NanGuard; -use super::*; +use super::{MAX_T, OriginalServeSettings}; use crate::settings::MapEnv; const VOCAB: u32 = 1000; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs index 7b78292a..4763a638 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_engine/tests.rs @@ -2,7 +2,12 @@ use super::super::original_spec_controller::{NanGuard, OriginalSpecController, SpecConfig, SpecError, SpecWindow}; use super::super::original_spec_draft::{DraftPreparation, DraftSampling, VerifiedWindow}; -use super::*; +use super::{ + ADAPTIVE_DEFAULT, AdaptiveConfig, CommittedWindow, DraftCompletion, DraftLimits, DraftPick, EnvSource, Error, + FirstDraftSeed, MAX_T, OriginalDraftEngine, OriginalFirstDraftEngine, OriginalServeEngine, OriginalServePort, + OriginalServeSettings, OriginalSpecEngine, Rc, Result, ServeCallbacks, ServeOutcome, ServeStop, ServedWindow, + SpeculativeRequest, TargetSeedRow, serve_request, +}; use std::cell::RefCell; const VOCAB: u32 = 1000; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/ple_on_chain/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/ple_on_chain/tests.rs index 7300c7f1..6e76dcd7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/ple_on_chain/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/ple_on_chain/tests.rs @@ -1,6 +1,6 @@ //! The ahead gather asks for exactly the rows the window's own fold asks for. -use super::*; +use super::{PleOnChain, WindowStart, enabled, window_before, window_input}; /// `InputStage::original_window_ple`'s fold: row `i` sees the last two tokens of `predecessors ++ tokens[..i]`. fn folded_before(predecessors: [i32; 2], tokens: &[i32]) -> Vec<[i32; 2]> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs index f6c8f7b8..10f5d4b7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_host/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{HostOutcome, RequestSampling, SamplerParams, SamplerPath}; fn greedy() -> SamplerParams { crate::qwen_forward::original_serve_config::greedy_params(1) diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs index 34203e95..790b9fd9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_pool/tests.rs @@ -1,6 +1,8 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{Error, ExpertJob, HIDDEN, TOP_K, output_offset, plan_experts_where, scatter, selection}; +#[cfg(test)] +use super::plan_experts; fn ids(rows: &[[i32; TOP_K]]) -> Vec { rows.iter().flatten().copied().collect() diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs index 833a3add..e0b02ba8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request/tests.rs @@ -1,7 +1,10 @@ //! Unit tests of `original_serve_request`. use super::super::original_serve_engine::ServeStop; -use super::*; +use super::{ + Admission, ENDOFTEXT_TOKEN, Error, RequestOwners, ServeError, ServeOutcome, ServeRequest, SpecError, admit, + original_stop_tokens, run_request, +}; use leleka_cuda_driver::SamplerPath; fn request(prompt: usize, max_new: usize) -> ServeRequest { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs index ee346b0c..04c4d0bf 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/open_tier.rs @@ -1,8 +1,14 @@ //! Functions: `open_tier`, `fill_and_pin`, `read_profile`, `warn_decode_headroom` and 15 more. //! Split out of `original_serve_residency` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + AtomicU32, Context, CpuExpertPool, EnvSource, Error, ExpertTierConfig, LOAN_FLOOR, MappedExpertBank, ModelBinding, + MoeWeightCache, ORIGINAL_VERIFY_MAX_PCIE_FETCHES, Ordering, OriginalCacheOptions, OriginalExpertCache, + OriginalGpuStream, OriginalRankedExperts, OriginalServePool, OriginalVerifyCpuRows, OriginalVerifyCpuSink, + OriginalVerifyGpuPlan, OriginalVerifyPcieSource, PathBuf, PcieSplitPolicy, Rc, ResidentExpertBankSpan, Result, + RoutedGroup, SpanCache, StrataPcieAuto, SwapSources, TieOrder, VANILLA_FREE_FLOOR_MIB, VERIFIER_ASSEMBLY_MIB, + driver_error, original_cache_startup, span_cache_enabled, +}; use leleka_cuda_driver::RefillBatchOptions; /// generate.cpp startup of the tier for the serve stack: size and open the cache after every other owner, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs index 7e693e81..0fc54c52 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tests.rs @@ -1,6 +1,11 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + EXPERTS, ExpertTierConfig, GroupSplit, LAYERS, PcieLag, PcieMode, PcieSplitPolicy, ResidencyState, RoutedGroup, + VANILLA_FREE_FLOOR_MIB, VERIFIER_ASSEMBLY_MIB, adapt_decay, choose_swaps, split_group_pcie, split_group_tail, +}; +#[cfg(test)] +use super::{choose_swaps_reference, split_group}; #[test] fn adapt_decay_outside_zero_to_one_falls_back_to_the_default_with_a_line() { @@ -107,8 +112,6 @@ fn choose_swaps_timing() { eprintln!("choose_swaps: new {fast:.0} us, reference {slow:.0} us per call ({a} {b})"); } -use super::*; - fn row(ids: [i32; 10]) -> Vec { ids.to_vec() } diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tier_env_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tier_env_tests.rs index e7172287..975b24d8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tier_env_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/tier_env_tests.rs @@ -1,6 +1,6 @@ //! Golden cases of `ExpertTierConfig::from_source`, the strict parser of the `LELEKA_ORIGINAL_SERVE_*` tier //! switches: a value that does not parse (or fails `validate`) is refused, never ignored. -use super::*; +use super::{ExpertTierConfig, PathBuf, PcieMode, ResidencyState, Result}; use crate::settings::MapEnv; const P: &str = "LELEKA_ORIGINAL_SERVE_"; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs index 21c64c68..20f401d6 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/conversation/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ConversationConfig, Error, PromptOptions, RequestStart, ResumeDevice, ServeConversation, TURN_TOKEN}; use crate::backend::original_prompt::{PlanLimits, PromptPath, PromptPlan, ResumePoint}; /// A device whose state is the token list it holds; points are copies of it. A restore is only possible diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs index 3a2a3bf0..48b42a19 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/original_serve_stack_methods/open_phase_steps.rs @@ -2,8 +2,15 @@ //! embedding), in the order `open` runs them. Each step keeps its stage marks, notes and error context. // Stays a glob on purpose: the file is at the 400-line limit and the explicit list would put it over. -#[allow(unused_imports)] -use super::*; +use super::{ + Context, DenseWeightCache, DraftAttachmentTables, DraftAttachmentTarget, Error, ExecutorOpening, ExecutorSizing, + ExecutorTarget, KarPleCache, LOAN_TIER_ROWS, LoanTier, ModelBinding, MoeWeightCache, NativeHeadDispatch, + OriginalExpertCache, OriginalMtpFullOwner, OriginalNativeOutput, OriginalPromptEmbedding, OriginalPromptExecutor, + OriginalServeSettings, OriginalSpecController, PARKED_BYTES_PER_TOKEN, PARKED_STATE_ESTIMATE, PINNED_MODEL, + PrefillLayoutOptions, PrefixServe, PromptWeights, QwenSession, Rc, RtMtpLoad, ServeFailure, StackBlock, + StackConfig, StackState, VOCABULARY, at, dbg_el, failure, operator_note, original_serve_residency, prefill_bytes, + vram_note, +}; use crate::qwen_forward::session::original_prompt::draft::OriginalDraftSession; /// The window policies of the environment: the live one, the parked arms and the widest window any of them needs. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/clock_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/clock_tests.rs index 0574c43a..c8c2a308 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/clock_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/clock_tests.rs @@ -1,7 +1,7 @@ //! The retention clock of the prefix cache on a manual clock (STRA-338 S14). use super::tests::{Fake, G, cfg, request}; -use super::*; +use super::{AnyClock, PrefixServe}; use leleka_obs::time::ManualClock; /// The retention clock is the one the cache was built with (STRA-338 S14): a session survives exactly its retention. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs index 5d3c55a7..e0fd1b35 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/prefix/tests.rs @@ -1,6 +1,10 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + AnyClock, ByteSize, ChunkOutcome, Clock, Consider, Error, PolicyParams, PrefixBudget, PrefixConfig, PrefixDevice, + PrefixMatch, PrefixServe, PrefixStore, PrefixSummary, Reject, Start, Stats, Stopwatch, StoreConfig, TailMode, + budget, +}; use crate::backend::original_prompt::{PlanLimits, PromptOptions, PromptPath, PromptPlan, ResumePoint}; pub(super) const G: usize = 256; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs index 69b63281..f2a4bbe0 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_stack/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + ADMITTED_CAPACITIES, Error, ExpertBlobSizes, KvFormat, LoanTier, PlanError, PrefillLayoutOptions, StackConfig, + TURN_TOKEN, plan_error, prefill_bytes, prefill_layout_options, tier_for, +}; #[test] fn a_chunk_borrows_the_smallest_rung_that_holds_it() { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs index c7cbf21c..cba5d972 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_serve_verifier/tests.rs @@ -1,6 +1,8 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + Error, PLE_HISTORY_BYTES, PLE_HISTORY_VALUES, ServeFailure, Stage, assemble_with_window_fallback, window_cap_after, +}; use leleka_cuda_driver::Error as D; #[test] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs index 82dc4af6..354051af 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/original_spec_controller/tests.rs @@ -1,7 +1,11 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). use super::super::original_spec_draft::{DraftPick, FirstSeedPoint, OriginalFirstDraftEngine, TargetSeedRow}; -use super::*; +use super::{ + AdaptiveConfig, AdaptivePolicy, Choice, DraftBatch, DraftPlan, DraftPolicy, DraftPreparation, DraftSampling, Error, + MAX_T, NanGuard, Offer, Origin, OriginalDraftEngine, OriginalSpecController, OriginalSpecEngine, PrefixMemo, Rc, + Result, RoundFacts, SpecConfig, SpecError, SpecStats, SpecWindow, SuffixDrafter, VerifiedWindow, +}; mod golden; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs index 0ca188c4..c4f9ece8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/output_stage_test_replay.rs @@ -1,8 +1,13 @@ //! Methods of `OutputStage`: `test_prefix_begin_target`, `test_reset_replay_record`, `test_reset_replay_capture`, `s... //! Functions: `greedy`, `selected_token`, `validate_weight_owner`, `encode_activation` and 4 more. -#[allow(unused_imports)] -use super::*; +use super::{ + ACTIVATION_BYTES, BindingIdentity, Dimension, EMBEDDING, Error, FiniteF32, FiniteLogits, HeadGreedySelection, + LOGIT_BYTES, LogitValues, OUTPUT_WEIGHT_BYTES, OutputBindingError, OutputWeights, Result, Stage, TokenId, + VOCABULARY, +}; +#[cfg(test)] +use super::OutputStage; // The real ignored reset test opts in explicitly. Other test callers retain // no extra values; production builds have neither this storage nor a reader. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs index e221415b..d7cb62f7 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/output/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BindingIdentity, Dimension, Error, FiniteF32, FiniteLogits, LOGIT_BYTES, LogitValues, OutputWeights, Position, + TokenId, VOCABULARY, combine, decode_logits, greedy, validate_weight_owner, +}; fn finite_values(fill: f32) -> Vec { vec![FiniteF32::new(fill).expect("finite fixture"); VOCABULARY] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch.rs index a77d305c..b5da2426 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch.rs @@ -1,5 +1,11 @@ //! Exclusive current-row storage only; no checkpoint or cross-row finite proof. -use super::*; +use super::{ + BindingIdentity, Cell, Context, DenseWeightCache, DeviceBuffer, Error, LayerId, ModelBinding, Q, QsaAttendBuffers, + QsaAttentionStage, QsaPrepared, QsaReady, QsaSelectedCache, QwenStepTxn, Rc, Result, TokenLayer, admit_budget, + attention_driver_error, download, release_retained, validate_values, +}; +#[cfg(test)] +use super::{SelectedKvBytes, attend_retained, gate_retained, release, upload_bytes}; use std::cell::{RefCell, RefMut}; pub(in crate::qwen_forward) const SCRATCH_BYTES: usize = 108_544; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs index 887bd046..c8354765 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_attention/attention_scratch/gpu.rs @@ -1,5 +1,8 @@ //! Numeric whole-owner test only; never fabricates a model or prepared row. -use super::*; +use super::{ + Cell, Context, DeviceBuffer, Error, Q, Rc, RefCell, Result, SCRATCH_BYTES, SIZES, ScratchBuffers, SelectedKvBytes, + attend_retained, attention_driver_error, gate_retained, release, upload_bytes, validate_values, +}; use crate::model_binding::qwen4exp_input::QsaMatrixKind; use leleka_cuda_driver::{Bf16ProjectionShape, Driver}; use std::panic::{AssertUnwindSafe, catch_unwind, resume_unwind}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs index 22db4250..54fe6a15 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/context.rs @@ -1,8 +1,14 @@ //! Methods of `QsaOwner`: `new`, `matches`. //! Methods of `QsaPrior`: `oracle_capture_parts`, `test_reset_replay_numeric_eq`, `same_native_kv`, `same_pages` and... -#[allow(unused_imports)] -use super::*; +use super::{ + BindingIdentity, Directory, Error, KV, LayerId, PackedKv, Position, QsaOwner, QsaPrior, Rc, Result, Stage, State, + reserve, validate_half, validate_ids, validate_values, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::OracleQsaParts; +#[cfg(test)] +use super::PAGE; /// The serving context in cells (262144 unless configured; see `contract::serving_cells`). pub(super) fn context() -> usize { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs index 2c9e6762..f0a66c49 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident.rs @@ -1,6 +1,17 @@ //! Actor-owned bounded index-key mirror; host QsaPrior remains canonical. //! Only exact immutable parent identity permits incremental device publication. -use super::*; +use super::{ + Bf16ProjectionShape, BindingIdentity, BlockQuery, Context, DenseFormat, DenseWeightCache, DeviceBuffer, Directory, + DriverError, Error, GrRole, InputBindingError, KvPage, LayerId, ModelBinding, PAGE, Position, ProjectionKind, + ProjectionSources, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, QsaAttendBuffers, QsaGated, + QsaInputLease, QsaInputScratch, QsaLayerProjection, QsaMatrixKind, QsaMatrixLayout, QsaMatrixRole, QsaOwner, + QsaPrior, QsaSelectedCache, QsaSelectionRequest, QsaWeights, QwenStepTxn, Rc, ResidualReady, Result, Stage, State, + TokenLayer, admit_budget, context, device_peak, driver_error, reserve, select_with_keys, validate_values, +}; +#[cfg(all(test, target_arch = "x86_64"))] +use super::combined_qsa_observer; +#[cfg(test)] +use super::{KV, QsaPending, select}; use std::cell::Cell; const ROW_BYTES: usize = 128 * 4; #[derive(Debug, PartialEq, Eq)] diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs index ed005940..436d28fd 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/index_resident/synthetic_late_prior.rs @@ -1,8 +1,8 @@ //! Functions: `synthetic_late_prior`, `synthetic_late_prior_for`. //! Split out of `index_resident` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +#[cfg(test)] +use super::{BindingIdentity, Directory, KvPage, LayerId, PAGE, QsaOwner, QsaPrior, Rc, State}; #[cfg(test)] pub(super) fn synthetic_late_prior(position: u64) -> QsaPrior { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/input_reuse_gpu_tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/input_reuse_gpu_tests.rs index 36d00af4..bd710af3 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/input_reuse_gpu_tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/input_reuse_gpu_tests.rs @@ -1,6 +1,9 @@ //! New QSA current-source lease parity; synthetic component, never ModelBinding. #![cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -use super::*; +use super::{ + BindingIdentity, Context, DeviceBuffer, Error, QsaInputLease, QsaInputScratch, QsaMatrixKind, QsaMatrixLayout, + QsaMatrixRole, allocate, dispatch_projection, download, input_scratch, project_input_numeric, upload, +}; use crate::qwen_forward::gdn::LeaseClaim; use input_scratch::INPUT_BYTES; use leleka_cuda_driver::Driver; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs index cd80e1c8..1ba96826 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device.rs @@ -5,7 +5,15 @@ use super::super::dense_weight_cache::QsaResident; use super::super::qsa_attention::PromptDevices; use super::super::qsa_prompt_index::PromptChunkOwners; use super::super::session::{TargetStepOrigin, chunk::QwenChunkTxn}; -use super::*; +use super::{ + Bf16ProjectionShape, BindingIdentity, BlockQuery, Cell, Context, DenseFormat, DenseWeightCache, DeviceBuffer, + Directory, DriverError, Error, GrRole, InputBindingError, LayerId, ModelBinding, Position, ProjectionKind, + ProjectionSources, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, QsaAttendBuffers, QsaGated, + QsaIndexKeyCache, QsaInputLease, QsaInputScratch, QsaLayerProjection, QsaMatrixKind, QsaMatrixLayout, + QsaMatrixRole, QsaOwner, QsaPending, QsaPrior, QsaSelectedCache, QsaSelectionRequest, QsaWeights, QwenStepTxn, Rc, + ResidualReady, Result, Stage, TokenLayer, allocate, context, download, driver_error, project, + project_scratch_out_numeric, upload, validate_values, +}; use crate::qwen_forward::prompt_device_rows::PromptWeights; use leleka_cuda_driver::{ CompletedQsaKvAppend, NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceGrRead, OriginalQsaDeviceSelection, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs index 59b90426..61b07083 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device.rs @@ -3,7 +3,19 @@ //! Root session adapter validates the actual Attention(layer) physical read and //! stores all twelve actual seals before joint target/draft publication. use super::super::super::{input::InputReady, session::QwenSession}; -use super::*; +use super::{ + Bf16ProjectionShape, BindingIdentity, BlockQuery, CompletedQsaKvAppend, Context, DenseFormat, DenseWeightCache, + DeviceBuffer, Directory, DriverError, Error, GrRole, InputBindingError, LayerId, ModelBinding, + NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceGrRead, OriginalQsaDeviceSelection, + OriginalQsaPromptDevice, OriginalQsaPromptWeights, Position, ProjectionKind, ProjectionSources, ProjectionSpec, + PromptChunkOwners, PromptDevices, PromptWeights, Q5KProjectionShape, Q6KProjectionShape, QsaAttendBuffers, + QsaChunkPrior, QsaGated, QsaIndexKeyCache, QsaIndexPrior, QsaInputLease, QsaInputScratch, QsaKvAppendTarget, + QsaLayerProjection, QsaMatrixKind, QsaMatrixLayout, QsaMatrixRole, QsaNativeKind, QsaOwner, QsaPrior, + QsaPromptIndexState, QsaPromptKv, QsaResident, QsaSelectedCache, QsaSelectionRequest, QsaWeights, QwenChunkTxn, + QwenStepTxn, Rc, ResidualReady, Result, Stage, TargetStepOrigin, TokenLayer, allocate, check_prompt_shapes, + context, device_error, download, native, project, project_scratch_out_numeric, prompt_projections, upload, + validate_values, +}; use leleka_cuda_driver::{ OriginalQsaIndexBatch, OriginalQsaIndexCheckpoint, OriginalQsaResidentAppendTarget, OriginalQsaResidentIndex, QsaNativeWeight, ResidentContinuation, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs index bcb2ba60..c179be2c 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar.rs @@ -1,7 +1,14 @@ //! Genuine current scalar target/MTP continuation of the same live resident //! layer. Old scalar projection/gate/Out math is retained; no index/page image. use super::resident_qsa_layer::mint; -use super::*; +use super::{ + BindingIdentity, Context, DenseWeightCache, DeviceBuffer, Error, GrRole, LayerId, ModelBinding, + NativeBatchWorkspace, OriginalQsaIndexCheckpoint, OriginalQsaMappedAppend, OriginalQsaMappedJournal, + OriginalQsaResidentIndex, OriginalQsaResidentTransport, QsaMatrixKind, QsaMatrixRole, QsaResident, QsaWeights, + QwenStepTxn, Rc, ResidentQsaLayer, ResidentQsaPrior, ResidentQsaSeal, ResidualReady, Result, Stage, + TargetStepOrigin, TokenLayer, allocate, device_error, download, project, project_scratch_out_numeric, upload, + validate_values, +}; use leleka_cuda_driver::{ OriginalQsaResidentScalarIndex, OriginalQsaResidentScalarSelection, QsaAttentionInputs, QsaNativeDecode, QsaNativeGate, ResidentContinuation, ScalarStepRows, diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs index e1c89836..75d8fa5d 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/prompt_device/resident_device/scalar/scalar_row_run.rs @@ -8,6 +8,7 @@ use super::{ ScalarOwners, ScalarStep, TargetStepOrigin, TokenLayer, allocate, driver, gate_and_out, mint, upload, validate_values, }; +use crate::qwen_forward::qsa_index::admit_budget; /// The transaction, the input row and the projection branch agree with the layer before any lineage is looked at. fn validate_scalar_row( @@ -90,7 +91,7 @@ impl<'source, 'lease, 'index, 'weights, 'ctx> ResidentQsaScalar<'source, 'lease, let ScalarStep { binding, cache, txn, input } = step; let ScalarOwners { attention, stage, gate_owner } = owners; self.validate(binding, cache, txn, input)?; - super::super::super::admit_budget(self.context)?; + admit_budget(self.context)?; let append = self.kv.append_resident_decode(workspace, stage, &self.prior.0.kv, &self.selected).map_err(driver)?; let attended = self.attend(workspace, attention, &append)?; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache.rs index 6bc7a2a4..3f9127d2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache.rs @@ -1,6 +1,11 @@ //! Lossless selected-cell residency. The immutable host pages remain canonical. //! A lookup address is only an index: every hit also proves a live identical Rc page. -use super::*; +use super::{ + BindingIdentity, Cell, Context, DeviceBuffer, Error, KV, KvPage, QsaOwner, QsaPrepared, QsaPrior, Rc, Result, + device_peak, driver_error, reserve, validate_half, validate_ids, +}; +#[cfg(test)] +use super::{LayerId, Position, QsaPending, TokenLayer}; use leleka_cuda_driver::QsaSelectedKvWorkspace; use std::{collections::HashMap, rc::Weak}; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs index 739c075a..f3e52a4e 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/qsa_index/selected_cache/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of the selected-cell cache (moved out of the file by STRA-338; the test ids are unchanged). -use super::*; +use super::{ + BindingIdentity, Error, KV, LayerDirectory, LayerId, Plan, Position, QsaOwner, QsaPending, QsaPrior, Rc, Result, + TokenLayer, plan, +}; use crate::qwen_forward::contract::{Dimension, TokenId}; fn append(prior: &QsaPrior, word: u16) -> Result { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs index a4d70f47..29121f58 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk.rs @@ -1,6 +1,11 @@ //! Private layer-major staging. Original committed owner never advances here. #![allow(dead_code)] -use super::*; +use super::{ + BindingIdentity, BoundLayerKind, Context, Dimension, Error, FiniteLogits, GdnOwner, GdnPending, GdnPrior, GrRole, + InjectedResidual, InputReady, LayerId, ModelBinding, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, + QsaOwner, QsaPending, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, ThreadId, + TokenId, TokenLayer, chunk, +}; mod txn_groups; mod verify; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs index 5d0e640b..9ccf55b9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn.rs @@ -1,8 +1,16 @@ //! Groups the submodules `qwen_chunk_txn_attention_sources`, `qwen_chunk_txn_begin`, `qwen_chunk_txn_ffn_after_atten... //! Split out of `chunk` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ActiveMicroWindow, AttentionProgress, AttentionSource, BatchProgress, BindingIdentity, BoundLayerKind, + ChunkAttentionRow, ChunkCommit, ChunkDraftPublication, ChunkFfnRow, ChunkMicroWindow, ChunkRowResidual, Context, + Dimension, Error, FfnInjectionRow, FiniteLogits, GdnChunkAnchor, GdnChunkJournal, GdnChunkMicro, GdnChunkRow, + GdnChunkSeal, GdnChunkStart, GdnOwner, GdnPending, GdnPrior, GrRole, InjectedResidual, InputReady, LayerId, + MicroProgress, ModelBinding, PleOwner, PlePending, PlePrior, Position, PreparedLayerRow, PromptInit, QsaIndexPrior, + QsaOwner, QsaPending, QwenChunkTxn, QwenSession, QwenStepTxn, Rc, Result, Row, STATE_CAPACITY, Stage, + TargetStepOrigin, ThreadId, TokenId, TokenLayer, VerifiedDraftPublication, VerifiedTargetPrefix, chunk, + host_charge, host_charge_bounded, +}; mod qwen_chunk_txn_attention_sources; mod qwen_chunk_txn_begin; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs index c287cfb7..53f727f2 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/qwen_chunk_txn/qwen_chunk_txn_micro_window.rs @@ -1,8 +1,12 @@ //! Methods of `QwenChunkTxn`: `check_micro_open`, `micro_misaligned`, `phase_in_flight`, `micro_width` and 19 more. //! Split out of `qwen_chunk_txn` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +use super::{ + ActiveMicroWindow, ChunkMicroWindow, Context, Error, LayerId, Position, QsaIndexPrior, QwenChunkTxn, Rc, Result, + STATE_CAPACITY, +}; +#[cfg(test)] +use super::{Dimension, GrRole, InjectedResidual, Stage}; impl<'session, 'driver> QwenChunkTxn<'session, 'driver> { /// A micro window opens only on an idle windowed transaction, at the cursor, for the current layer. diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs index f72f2015..45411d88 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/test_gdn_component_rows.rs @@ -1,8 +1,13 @@ //! Methods of `TestGdnComponentRows`: `new`, `start`, `row`, `seal`. //! Split out of `chunk` to keep its files under the line limit. -#[allow(unused_imports)] -use super::*; +#[cfg(all(test, target_arch = "x86_64"))] +use super::TestGdnComponentRows; +#[cfg(test)] +use super::{ + BindingIdentity, Dimension, Error, GdnChunkAnchor, GdnChunkRow, GdnChunkSeal, GdnChunkStart, GdnPrior, Position, + Rc, Result, TokenId, TokenLayer, +}; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] impl TestGdnComponentRows { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs index 30a32d38..ed07c9db 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify.rs @@ -1,6 +1,12 @@ //! Private complete-state journal for a bounded target verification window. //! No provisional row is a committed TargetStepProduct or an origin. -use super::*; +use super::{ + ChunkCommit, ChunkRowResidual, Dimension, Error, GdnChunkAnchor, GdnChunkJournal, GdnPrior, GrRole, + InjectedResidual, LayerId, ModelBinding, PlePrior, Position, QsaIndexPrior, QwenChunkTxn, QwenSession, QwenStepTxn, + Rc, Result, Row, STATE_CAPACITY, Stage, TargetStepOrigin, TokenId, TokenLayer, host_charge_bounded, +}; +#[cfg(test)] +use super::{GdnChunkStart, PromptInit}; use crate::qwen_forward::executor::TargetStepProduct; const HOST_LIMIT: usize = 512 * 1024 * 1024; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs index 7a32c319..09432b25 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/chunk/verify/tests.rs @@ -1,6 +1,10 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + Dimension, Error, GdnChunkAnchor, GdnChunkStart, HOST_LIMIT, LayerId, PlePrior, Position, PrefixState, PromptInit, + QwenChunkTxn, QwenSession, Rc, Row, Stage, TokenId, TokenLayer, VerificationJournal, greedy_prefix, + host_charge_bounded, verification_extra_charge, +}; fn token(value: u64) -> TokenId { TokenId::new(value, Dimension::new(248320).unwrap()).unwrap() } diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs index 6eeff8fb..222fe1a9 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt.rs @@ -6,7 +6,12 @@ use super::super::prompt_device_rows::PromptWeights; use super::super::qsa_index::prompt_device::resident_device::{ ParkedLayerSpan, ParkedPrefix, ResidentQsaLayer, ResidentQsaOwners, ResidentQsaPrior, ResidentQsaSeal, SpanExport, }; -use super::*; +use super::{ + BindingIdentity, BoundLayerKind, Context, Dimension, Error, FiniteLogits, GdnOwner, GdnPending, GdnPrior, GrRole, + InjectedResidual, InputReady, LayerId, ModelBinding, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, + QsaOwner, QsaPending, QwenSession, QwenStepTxn, Rc, Result, STATE_CAPACITY, Stage, TargetStepOrigin, ThreadId, + TokenId, TokenLayer, chunk, +}; use std::cell::{Cell, RefCell}; pub(in crate::qwen_forward) mod draft; mod prompt_txn_owners; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs index 1a74d2fa..f02c4e78 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_prompt/draft.rs @@ -1,6 +1,9 @@ //! Canonical Original INT8 draft owner. Actual immutable driver snapshots are //! bound to the real target branch; end metadata never invents older KV cells. -use super::*; +use super::{ + BindingIdentity, DenseWeightCache, Error, ModelBinding, OriginalPromptTxn, QwenSession, Result, Stage, + TargetStepOrigin, +}; use leleka_cuda_driver::{CompletedDraftKv, CompletedOriginalMtpDraft, Context, MtpInt8Snapshot, MtpOriginalInt8}; pub(in crate::qwen_forward) struct OriginalDraftSession<'ctx> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified.rs index 00df7299..d1ea21e8 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified.rs @@ -19,7 +19,9 @@ //! describe a position the session does not hold); a checkpoint restore replaces every prior and ends it. use super::super::qsa_index::prompt_device::resident_device::ResidentQsaPrior; use super::checkpoint::{committed_origin, origin_at}; -use super::*; +use super::{ + Dimension, Error, GdnPrior, LayerId, PlePrior, Position, QwenSession, Result, STATE_CAPACITY, TargetStepOrigin, +}; /// Largest verified window (`kVerifyMaxT`). pub(in crate::qwen_forward) const MAX_WINDOW_ROWS: usize = 8; diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs index b037c6cf..fbeff6cb 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/original_verified/tests.rs @@ -1,6 +1,6 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{Error, GdnPrior, OriginalVerifiedLineage, PlePrior, QwenSession, STATE_CAPACITY, predecessors_after}; use crate::model_binding::qwen4exp_input::BindingIdentity; fn session(gdn: &[usize], ple: bool) -> QwenSession<'static> { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs index 2a5751ed..006c184a 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/reset_replay_snapshot.rs @@ -1,8 +1,10 @@ //! Methods of `ResetReplaySnapshot`: `has_prefix`, `numeric_eq`, `same_shape`, `retained_bytes`. //! Methods of `QwenSession`: `oracle_capture_committed`, `validate_reset_states`, `validate_reset_ple`, `validate_re... -#[allow(unused_imports)] -use super::*; +#[cfg(all(test, target_arch = "x86_64"))] +use super::ResetReplaySnapshot; +#[cfg(test)] +use super::{Dimension, Error, LayerId, ModelBinding, Position, QwenSession, Result, STATE_CAPACITY}; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] impl ResetReplaySnapshot { diff --git a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs index 83b03773..000eec53 100644 --- a/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs +++ b/crates/engine-qwen35-cuda/src/qwen_forward/session/tests.rs @@ -1,6 +1,10 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BoundLayerKind, Context, Error, FiniteLogits, GdnOwner, GdnPending, GdnPrior, GrRole, InjectedResidual, InputReady, + LayerId, ModelBinding, PleOwner, PlePending, PlePrior, Position, QsaIndexPrior, QsaOwner, QsaPending, QwenSession, + Rc, Result, Stage, TargetStepOrigin, ThreadId, TokenId, TokenLayer, +}; use crate::model_binding::qwen4exp_input::BindingIdentity; use crate::qwen_forward::contract::Dimension; diff --git a/crates/engine-qwen35-cuda/src/serve_meta/tests.rs b/crates/engine-qwen35-cuda/src/serve_meta/tests.rs index eb12cea2..7dcb9731 100644 --- a/crates/engine-qwen35-cuda/src/serve_meta/tests.rs +++ b/crates/engine-qwen35-cuda/src/serve_meta/tests.rs @@ -1,6 +1,9 @@ //! Unit tests of this module (split out of its file; the test ids are unchanged). -use super::*; +use super::{ + BuildInfo, CacheFacts, ConfigFacts, MODEL_DIGEST_MAPPING, ModelFile, ModelInfo, Path, ProfileInfo, cache_line, + startup_lines, token, +}; const DIGEST: &str = "sha256:80d5e3333801cedbca81a5c19c24ed6bb48fd56977acd190318f66b23a1766a3"; const PROFILE_SHA: &str = "b5ebb652ad9b091e0e045e44d8adeb49fa7319c2f365c2ad150a3d567221e0cb"; diff --git a/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs b/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs index e254e7d6..c7c5c7ac 100644 --- a/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs +++ b/crates/engine-qwen35-cuda/src/serve_tuning/tests.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{OriginalServeOptions, PrefixCacheOptions, PrefixTail, Tuning, describe}; fn base() -> (OriginalServeOptions, u32) { let options = OriginalServeOptions { diff --git a/crates/engine-qwen35-cuda/src/settings/capture_tests.rs b/crates/engine-qwen35-cuda/src/settings/capture_tests.rs index bee15337..9b9ea93b 100644 --- a/crates/engine-qwen35-cuda/src/settings/capture_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/capture_tests.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{EnvSource, MapEnv, ServeSettings, Settings}; #[test] fn only_the_operator_namespace_is_captured() { diff --git a/crates/engine-qwen35-cuda/src/settings/decode_tests.rs b/crates/engine-qwen35-cuda/src/settings/decode_tests.rs index 3619d1e7..2ecbcadb 100644 --- a/crates/engine-qwen35-cuda/src/settings/decode_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/decode_tests.rs @@ -1,5 +1,5 @@ //! Golden cases of the decode topic: each row is what the call site this field replaced returned for that value. -use super::*; +use super::{DecodeSettings, MapEnv, PleOnChain}; fn decode(pairs: &[(&str, &str)]) -> DecodeSettings { DecodeSettings::from_source(&MapEnv::of(pairs)) diff --git a/crates/engine-qwen35-cuda/src/settings/diagnostics_tests.rs b/crates/engine-qwen35-cuda/src/settings/diagnostics_tests.rs index 5a424651..b0dce80e 100644 --- a/crates/engine-qwen35-cuda/src/settings/diagnostics_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/diagnostics_tests.rs @@ -1,5 +1,5 @@ //! Golden cases of the diagnostics topic: each row is what the call site this field replaced returned for that value. -use super::*; +use super::{DiagnosticsSettings, MapEnv}; fn diag(pairs: &[(&str, &str)]) -> DiagnosticsSettings { DiagnosticsSettings::from_source(&MapEnv::of(pairs)) diff --git a/crates/engine-qwen35-cuda/src/settings/kv_tests.rs b/crates/engine-qwen35-cuda/src/settings/kv_tests.rs index 65eac585..0a619cba 100644 --- a/crates/engine-qwen35-cuda/src/settings/kv_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/kv_tests.rs @@ -1,5 +1,5 @@ //! Golden cases of the kv topic: each row is what the call site this field replaced returned for that value. -use super::*; +use super::{KvSettings, MapEnv}; fn kv(pairs: &[(&str, &str)]) -> KvSettings { KvSettings::from_source(&MapEnv::of(pairs)) diff --git a/crates/engine-qwen35-cuda/src/settings/memory_tests.rs b/crates/engine-qwen35-cuda/src/settings/memory_tests.rs index 4f00d787..90484943 100644 --- a/crates/engine-qwen35-cuda/src/settings/memory_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/memory_tests.rs @@ -1,5 +1,5 @@ //! Golden cases of the memory topic: each row is what the call site this field replaced returned for that value. -use super::*; +use super::{MapEnv, MemorySettings}; fn memory(pairs: &[(&str, &str)]) -> MemorySettings { MemorySettings::from_source(&MapEnv::of(pairs)) diff --git a/crates/engine-qwen35-cuda/src/settings/serve_tests.rs b/crates/engine-qwen35-cuda/src/settings/serve_tests.rs index 3abac8b2..1028654d 100644 --- a/crates/engine-qwen35-cuda/src/settings/serve_tests.rs +++ b/crates/engine-qwen35-cuda/src/settings/serve_tests.rs @@ -1,6 +1,6 @@ //! Golden cases of the serve topic: each row is what the call site this field replaced returned for that value. use super::parse::*; -use super::*; +use super::{MapEnv, ServeSettings}; fn serve(pairs: &[(&str, &str)]) -> ServeSettings { ServeSettings::from_source(&MapEnv::of(pairs))