diff --git a/crates/context/src/context_policy/tests.rs b/crates/context/src/context_policy/tests.rs index 28234dc5..0632b334 100644 --- a/crates/context/src/context_policy/tests.rs +++ b/crates/context/src/context_policy/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the context policy: 2x256k needs no scaling and 1x512k needs YaRN 2, INT8 pool closing, refusal of +//! explicit none past the trained range, stray scale, bad rope knobs and request errors, and state sizing by slots. use super::*; diff --git a/crates/context/src/geometry/tests.rs b/crates/context/src/geometry/tests.rs index c5442f58..8f8c1e2a 100644 --- a/crates/context/src/geometry/tests.rs +++ b/crates/context/src/geometry/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the cell-count geometry: at the trained cell count every value equals its frozen literal, the resident +//! window follows kv_plan, 512k scales linear sizes by exactly two, and invalid cell counts and boundaries. use super::*; diff --git a/crates/context/src/memory_plan/tests.rs b/crates/context/src/memory_plan/tests.rs index daf95e53..9188ddf3 100644 --- a/crates/context/src/memory_plan/tests.rs +++ b/crates/context/src/memory_plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the memory plan arithmetic: real geometry constants, per-cell bytes, INT8 generic versus literal, +//! pool derivation quirks, does-not-close messages, overflow reporting, Q4 versus INT8 closing, FP32 indexer store. use super::*; diff --git a/crates/context/src/rope_scaling/rope_scaling_type.rs b/crates/context/src/rope_scaling/rope_scaling_type.rs index 67ec1721..690a004f 100644 --- a/crates/context/src/rope_scaling/rope_scaling_type.rs +++ b/crates/context/src/rope_scaling/rope_scaling_type.rs @@ -1,5 +1,5 @@ -//! Methods of `RopeScalingType`: `name`, `parse`. Methods of `RopeScalingError`: `reason`. -//! Implements `Default for RopeKernelArgs`, `Display for RopeScalingError` and 5 more. +//! RoPE scaling types and errors: the scaling method names, default kernel arguments, the RopeScaling +//! configuration with its validation and kernel arguments, YaRN ramp and angle, and RoPE table errors and size. use super::{ DEFAULT_FREQ_BASE, PI, RopeKernelArgs, RopeScaling, RopeScalingError, RopeScalingType, RopeTableError, diff --git a/crates/context/src/rope_scaling/tests.rs b/crates/context/src/rope_scaling/tests.rs index 9bf113b5..77d9f5b6 100644 --- a/crates/context/src/rope_scaling/tests.rs +++ b/crates/context/src/rope_scaling/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of RoPE scaling: identity default, YaRN mscale and clamped correction dims, rejection of non-finite or bad +//! configs, prefix-stable chunkable tables, table bytes at charter contexts, and setup/knob resolution. use super::*; diff --git a/crates/cpu-sys/src/c_reference/abi_version.rs b/crates/cpu-sys/src/c_reference/abi_version.rs index c63e63c9..428180ec 100644 --- a/crates/cpu-sys/src/c_reference/abi_version.rs +++ b/crates/cpu-sys/src/c_reference/abi_version.rs @@ -1,5 +1,5 @@ -//! Functions: `abi_version`, `check_i8`, `check_i4`, `dot_i8i8_scalar` and 17 more. -//! Split out of `c_reference` to keep its files under the line limit. +//! Safe Rust wrappers over the C reference kernels: ABI version, int8/int4 dots, MXFP4 x Q8_0 dots and block sums, +//! and the q8r layout, at scalar, AVX2 and AVX-VNNI level, with the shared length checks that make the FFI calls sound. use super::{BLOCK_ELEMS, KernelError, MAX_DOT_LEN, MXFP4_BLOCK_BYTES, Q8_0_BLOCK_BYTES, avx2_available, ffi}; diff --git a/crates/cpu-sys/src/c_reference/quantize_q8_0_scalar.rs b/crates/cpu-sys/src/c_reference/quantize_q8_0_scalar.rs index 2247ae8f..5b8f41c7 100644 --- a/crates/cpu-sys/src/c_reference/quantize_q8_0_scalar.rs +++ b/crates/cpu-sys/src/c_reference/quantize_q8_0_scalar.rs @@ -1,5 +1,5 @@ -//! Functions: `quantize_q8_0_scalar`, `quantize_q8_0_avx2`, `dot_q8_0_q8_0_scalar`, `q8_0_q8_0_isums_scalar` and 10 ... -//! Split out of `c_reference` to keep its files under the line limit. +//! Safe wrappers over the C reference for Q8_0: float quantizer, Q8_0 x Q8_0 dots and block sums, float to half +//! conversion, and the AVX2/AVX-VNNI int8 and int4 dots; each SIMD level is checked against its scalar twin. use super::{KernelError, avx2_available, check_i4, check_i8, check_mx_out, check_q8, check_quantize, ffi}; #[cfg(target_arch="x86_64")] diff --git a/crates/cpu-sys/src/oracle.rs b/crates/cpu-sys/src/oracle.rs index d7c0e351..27935940 100644 --- a/crates/cpu-sys/src/oracle.rs +++ b/crates/cpu-sys/src/oracle.rs @@ -1,5 +1,5 @@ -//! Functions: `block_bytes`, `aligned`, `unaligned`, `dequantize_mxfp4` and 3 more. -//! Split out of `crate` to keep its files under the line limit. +//! Safe wrappers over the pinned ggml MXFP4 and Q8_0 quantize/dequantize routines (compiled C), used as the oracle +//! that the Rust kernels are compared against; copies buffers to 8-byte aligned storage for ggml structs. use super::{BLOCK_ELEMS, MXFP4_BLOCK_BYTES, Q8_0_BLOCK_BYTES}; diff --git a/crates/cpu-sys/src/simd/x86.rs b/crates/cpu-sys/src/simd/x86.rs index fec031f1..b5618cb2 100644 --- a/crates/cpu-sys/src/simd/x86.rs +++ b/crates/cpu-sys/src/simd/x86.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `reductions_and_int_dots`, `mxfp4_q8_dots`, `q8_dots_and_mxfp4_tiles` and 4 more. -//! Split out of `simd` to keep its files under the line limit. +//! x86-64 kernel set: holds the register-tiled macros and the shared safety contract, and declares the kernel groups +//! (int dots, MXFP4 and Q8 dots, tiles, attention and f16 elementwise, Q8_0 quantizer) at AVX2 and AVX-VNNI level. //! AVX2 (+FMA +F16C) and AVX-VNNI kernels. Every function is `unsafe`: the caller must have //! verified the CPU features named in its `target_feature` attribute and that all slices have the diff --git a/crates/cuda-driver/src/api/async_api.rs b/crates/cuda-driver/src/api/async_api.rs index 861c24d6..70f510e0 100644 --- a/crates/cuda-driver/src/api/async_api.rs +++ b/crates/cuda-driver/src/api/async_api.rs @@ -1,5 +1,5 @@ -//! Methods of `AsyncApi`: `load`, `create_stream`, `create_event`, `register` and 12 more. -//! Methods of `MappedApi`: `load`, `register_bank`, `bank_alias`, `unregister_bank` and 12 more. +//! Stub implementations of AsyncApi and MappedApi for builds without a usable CUDA driver (no cuda-driver feature, +//! non-Linux/Windows or non-64-bit target): every method fails with UnsupportedPlatform, so callers compile unchanged. #[cfg(not(all( feature = "cuda-driver", diff --git a/crates/cuda-driver/src/arch_ptx/stream_k_off.rs b/crates/cuda-driver/src/arch_ptx/stream_k_off.rs index f0346c87..88b485a2 100644 --- a/crates/cuda-driver/src/arch_ptx/stream_k_off.rs +++ b/crates/cuda-driver/src/arch_ptx/stream_k_off.rs @@ -1,5 +1,5 @@ -//! Functions: `stream_k_off`, `marker_files_present`, `forced_sms`, `chunk_drain` and 10 more. -//! Split out of `arch_ptx` to keep its files under the line limit. +//! Run-time policy of the per-architecture PTX layer: the stream-K on/off switch (env vars and marker files), the +//! forced SM count and chunk-drain diagnostics, the compute-capability gates, and the sm_86 companion image lookup. use super::STREAM_K_AVOIDED; #[cfg(feature = "sm86")] diff --git a/crates/cuda-driver/src/bringup_trace_enabled.rs b/crates/cuda-driver/src/bringup_trace_enabled.rs index cbd4aaac..14ed6d7d 100644 --- a/crates/cuda-driver/src/bringup_trace_enabled.rs +++ b/crates/cuda-driver/src/bringup_trace_enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `PromptSyncTrace`: `enter`. Methods of `Driver`: `load`, `version`, `device`. -//! Implements `Drop for PromptSyncTrace`, `Drop for RoutedGateUpQ8`. Functions: `combine`, `valid_size`. +//! Driver bring-up core: Driver::load/device, Device::create_context and the Context constructor, the poison flag +//! (PoisonCell) with its trace, the prompt-sync trace guard, and the scratch release of RoutedGateUpQ8. use super::{ Cell, Context, Device, Driver, Error, PoisonCell, PromptSyncTrace, Rc, Result, RoutedGateUpQ8, ffi, qwen_dispatch, diff --git a/crates/cuda-driver/src/closed_kernels/program.rs b/crates/cuda-driver/src/closed_kernels/program.rs index d8ae7e20..944678e2 100644 --- a/crates/cuda-driver/src/closed_kernels/program.rs +++ b/crates/cuda-driver/src/closed_kernels/program.rs @@ -1,5 +1,5 @@ -//! Methods of `Program`: `name`, `ptx`, `pin`, `source` and 1 more. Methods of `Slot`: `kind`. -//! Functions: `admit_ptx`, `admit`, `s_gemv_entry_index`, `conforms` and 5 more. +//! Program catalogue of the closed kernels: name, sealed PTX, pin and CUDA source of each Program, fail-closed +//! PTX admission against its digest pin, and the slot lists and operand sizes of flash, poison and S-GEMV launches. use super::{ Arg, DEVICE_POISON_PTX, Entry, ExperimentalError, FLASH_ENTRIES, FlashBytes, Kernel, MAX_ENTRY_ARGUMENTS, diff --git a/crates/cuda-driver/src/closed_kernels/s_gemv_slots.rs b/crates/cuda-driver/src/closed_kernels/s_gemv_slots.rs index 3efdfc7f..ca42b5e8 100644 --- a/crates/cuda-driver/src/closed_kernels/s_gemv_slots.rs +++ b/crates/cuda-driver/src/closed_kernels/s_gemv_slots.rs @@ -1,5 +1,5 @@ -//! Functions: `s_gemv_slots`, `head_slots`. -//! Split out of `closed_kernels` to keep its files under the line limit. +//! Builds the ordered kernel-argument slots of a planned S-form GEMV (pointers, sizes, code bias, codebook, shift), +//! one layout per kernel variant; kept apart so program.rs holds only the catalogue and its admission. use super::{Kernel, Plan, Role, SForm, Slot}; diff --git a/crates/cuda-driver/src/closed_kernels/tests.rs b/crates/cuda-driver/src/closed_kernels/tests.rs index 1d0fe45c..d78c678d 100644 --- a/crates/cuda-driver/src/closed_kernels/tests.rs +++ b/crates/cuda-driver/src/closed_kernels/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Shared helpers of the closed-kernel tests: they read parameter kinds from the checked-in .cu sources and from the +//! Entry tables so submodules can assert that every Rust signature matches its CUDA entry and every sealed PTX its pin. use super::*; use crate::s_gemv_legacy as sg; diff --git a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs index 5bd08248..734ea422 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `closed_kernels_flash_and_s_gemv`, `closed_kernels_open_admit_run`. -//! Split out of `closed_kernels_gpu` to keep its files under the line limit. +//! Module root of the ClosedKernels owner on a live context: it shares the imports of its two files, one for +//! opening, admitting and running launches and one for the concrete flash / poison / S-GEMV entry points. use super::{ Admitted, ClosedKernels, Context, DeviceBuffer, DriverResult, Error, ExperimentalError, FLASH_SHORT, diff --git a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs index b5ef1a45..7d6fc96c 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_flash_and_s_gemv.rs @@ -1,5 +1,5 @@ -//! Methods of `FlashBuffers`: `admit`, `operands`. -//! Methods of `ClosedKernels`: `native_flash_attn_short`, `poison_f32`, `s_gemv`, `s2_gemv`. +//! The launch entry points of ClosedKernels: short FlashAttention step, quiet-NaN poison fill and the S / S2 GEMV. +//! Each checks its operands (FlashBuffers, s_gemv_operands) and builds one Launch; opening and running are elsewhere. use super::{ ClosedKernels, DeviceBuffer, Error, ExperimentalError, FLASH_SHORT, FlashStepBuffers, Geometry, Operand, diff --git a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_open_admit_run.rs b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_open_admit_run.rs index cea0c28e..58b7154a 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_open_admit_run.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu/closed_kernels/closed_kernels_open_admit_run.rs @@ -1,5 +1,5 @@ -//! Methods of `ClosedKernels`: `open`, `close`, `expect`, `build` and 4 more. -//! Functions: `resolve_functions`, `reject_aliasing`. +//! Lifecycle and launch plumbing of ClosedKernels: open (pin gate, module load, entry resolution), close, and the +//! per-launch checks (signature, geometry, operand admission, alias rejection) that turn slots into a Launch. use super::{ Admitted, ClosedKernels, Context, DriverResult, Error, Geometry, Launch, Operand, Program, Rc, Result, Role, Slot, diff --git a/crates/cuda-driver/src/closed_kernels_gpu/failure.rs b/crates/cuda-driver/src/closed_kernels_gpu/failure.rs index 8d846875..dc6beb5f 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu/failure.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu/failure.rs @@ -1,5 +1,5 @@ -//! Functions: `failure`. -//! Split out of `closed_kernels_gpu` to keep its files under the line limit. +//! Folds a primary driver failure and the outcome of the mandatory context restore into one ExperimentalError, +//! so no restore error is lost behind the first one. use super::{DriverResult, Error, ExperimentalError, combine}; diff --git a/crates/cuda-driver/src/closed_kernels_gpu_smoke/rng.rs b/crates/cuda-driver/src/closed_kernels_gpu_smoke/rng.rs index 813fd76a..03c22045 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu_smoke/rng.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu_smoke/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`, `normal`. Functions: `f16_bits`, `upload`, `download`, `f32s` and 4 more. -//! Split out of `closed_kernels_gpu_smoke` to keep its files under the line limit. +//! Helpers of the closed-kernel GPU smoke tests: a small deterministic Rng (uniform and normal-ish), f32 to f16 bits, +//! device upload / download, opening a program, zeroed KV buffers and JSON-to-vector readers for the reference cases. use super::{ClosedKernels, Context, DeviceBuffer, Program, Rng}; diff --git a/crates/cuda-driver/src/context.rs b/crates/cuda-driver/src/context.rs index dffa6c88..f73096b9 100644 --- a/crates/cuda-driver/src/context.rs +++ b/crates/cuda-driver/src/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `poison`, `retain_driver`, `budget_bytes`, `device_ordinal` and 16 more. -//! Split out of `crate` to keep its files under the line limit. +//! Core of Context, the owner of one CUDA context: budget and allocation accounting, the sticky poison flag, entering +//! the context (CurrentGuard), allocate / deferred frees, synchronize, and the MoE-down pack and vector-add launches. use super::{ Context, CurrentGuard, DeviceBuffer, Error, FixedOperation, PhantomData, Rc, Result, combine, ffi, valid_size, diff --git a/crates/cuda-driver/src/context_gate_up_projection_admission.rs b/crates/cuda-driver/src/context_gate_up_projection_admission.rs index 9a3ef115..fe6174d8 100644 --- a/crates/cuda-driver/src/context_gate_up_projection_admission.rs +++ b/crates/cuda-driver/src/context_gate_up_projection_admission.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `project_routed_gate_up_prepared_weight`, `prepared_scratch`, `gate_up_prepared_shape`, `ga... -//! Split out of `crate` to keep its files under the line limit. +//! Admission of projection launches on a Context: owner, shape, alias and temporary-budget checks for the prepared +//! routed gate/up Q8 path, the native-weight projections and the Q5_K / Q6_K matvec before any native mutation. use super::{ Context, DeviceBuffer, Error, NativeWeights, ProjectionKind, ProjectionShape, ProjectionSpec, Q5KProjectionShape, diff --git a/crates/cuda-driver/src/context_matvec_k_quant_projections.rs b/crates/cuda-driver/src/context_matvec_k_quant_projections.rs index aa3586b2..73855bae 100644 --- a/crates/cuda-driver/src/context_matvec_k_quant_projections.rs +++ b/crates/cuda-driver/src/context_matvec_k_quant_projections.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `matvec_f32`, `q5_k_q8_1`, `q5_k_operation`, `q6_k_q8_1` and 4 more. Defines `MatvecDims`. -//! Split out of `crate` to keep its files under the line limit. +//! Context entry points for the f32 matvec and the Q5_K / Q6_K projections (MatvecDims), the shared Q8_1 activation +//! quantization with its scratch and status temporaries, and the closed-format project_q8_1 dispatch. use super::{ Context, DeviceBuffer, Error, FixedOperation, NativeWeights, ProjectionSpec, Q5KProjectionShape, Q5KShape, diff --git a/crates/cuda-driver/src/context_projection_kernel_slots.rs b/crates/cuda-driver/src/context_projection_kernel_slots.rs index 90cba01a..7b1f946c 100644 --- a/crates/cuda-driver/src/context_projection_kernel_slots.rs +++ b/crates/cuda-driver/src/context_projection_kernel_slots.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `matvec_admission`, `kernel_slot`, `kernel_slot_rest`, `fixed_kernel` and 10 more. -//! Split out of `crate` to keep its files under the line limit. +//! Kernel cache of Context: matvec admission, the per-operation FixedKernel slots, the Q5 / Q6 pair kernels and the +//! projection kernel pairs, each loaded lazily with the context current and unloaded on failure by poisoning. use super::{ Cell, Context, DeviceBuffer, Error, FixedKernel, FixedOperation, FixedPairKernels, MatvecShape, ProjectionKernels, diff --git a/crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs b/crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs index eecabaa0..58bda301 100644 --- a/crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs +++ b/crates/cuda-driver/src/context_q8_1_and_gate_up_projection.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `project_q8_1_weight`, `project_q8_1_operation`, `prepare_routed_gate_up_q8`, `gate_up_sour... -//! Split out of `crate` to keep its files under the line limit. +//! Q8_1 weight projection of one activation and the routed gate/up path: quantizing the activation once into a +//! RoutedGateUpQ8 (prepare), then projecting prepared scratch with each expert weight. use super::{ Context, DeviceBuffer, Error, FixedOperation, NativeWeights, ProjectionShape, ProjectionSpec, Result, RoutedFormat, diff --git a/crates/cuda-driver/src/context_unload_close_destroy.rs b/crates/cuda-driver/src/context_unload_close_destroy.rs index cd84a737..a6947538 100644 --- a/crates/cuda-driver/src/context_unload_close_destroy.rs +++ b/crates/cuda-driver/src/context_unload_close_destroy.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `unload_projections`, `unload_projection_slot`, `unload_q5_kernels`, `unload_q6_kernels` an... -//! Methods of `CurrentGuard`: `finish`, `restore`. Implements `Drop for Context`, `Drop for CurrentGuard`. +//! Teardown of Context: unloading every cached kernel module in a fixed order, close / destroy of the CUDA context, +//! and the Drop impls of Context and CurrentGuard that restore the previously current context. use super::{Context, CurrentGuard, Error, FixedOperation, ProjectionKernels, Rc, Result, combine}; diff --git a/crates/cuda-driver/src/device_buffer.rs b/crates/cuda-driver/src/device_buffer.rs index 2c488fc3..c7a173c9 100644 --- a/crates/cuda-driver/src/device_buffer.rs +++ b/crates/cuda-driver/src/device_buffer.rs @@ -1,5 +1,5 @@ -//! Methods of `DeviceBuffer`: `len`, `is_empty`, `staging`, `copy_from` and 12 more. -//! Implements `Drop for DeviceBuffer`. Functions: `chain_selects_mtp`, `chain_selects_mtp`, `set_chain_down_override`. +//! DeviceBuffer host/device copies (whole buffer and ranges, staged through a host Vec, synchronised) and its release +//! and Drop, plus the LELEKA_CHAIN 'mtp' selector chain_selects_mtp with its no-driver stubs. use super::{DeviceBuffer, Error, Result, combine, compute_drain, original_verify, vram_ledger}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] diff --git a/crates/cuda-driver/src/device_slab/tests.rs b/crates/cuda-driver/src/device_slab/tests.rs index dc14138a..ca9a6561 100644 --- a/crates/cuda-driver/src/device_slab/tests.rs +++ b/crates/cuda-driver/src/device_slab/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the device slab packer: policy validation, in-order aligned placement, hole reuse, direct allocations +//! above the limit, no overlapping ranges, the device memory saved for dense weights, and byte isolation of slab views. use super::*; use crate::vram_ledger::driver_bytes; diff --git a/crates/cuda-driver/src/experimental/kv_shape.rs b/crates/cuda-driver/src/experimental/kv_shape.rs index 3da6dedf..84504913 100644 --- a/crates/cuda-driver/src/experimental/kv_shape.rs +++ b/crates/cuda-driver/src/experimental/kv_shape.rs @@ -1,5 +1,5 @@ -//! Methods of `KvShape`: `real`, `as_qsa`, `base`, `check_q4` and 8 more. Methods of `Context`: `unload_experimental`. -//! Functions: `fwht_grid`, `fwht_bytes`, `q4_step_grid`, `q4_batch_grid` and 12 more. +//! KvShape of the experimental KV-cache kernels (heads, head_dim, page size) with its validity checks for Q4 / INT8 / +//! attention, the pool byte sizes, and the launch-grid planners for FWHT, Q4/Q8 step and gather, keyless and attention. use super::{ Context, ExperimentalError, Grid, KvShape, MAX_GRID_YZ, QsaShapes, Result, cvec, grid_x, grid_yz, invalid, keyless, diff --git a/crates/cuda-driver/src/experimental/mode.rs b/crates/cuda-driver/src/experimental/mode.rs index 5d686f86..bd0cd7da 100644 --- a/crates/cuda-driver/src/experimental/mode.rs +++ b/crates/cuda-driver/src/experimental/mode.rs @@ -1,5 +1,5 @@ -//! Methods of `Mode`: `name`, `bit`. Methods of `OptIn`: `with`, `is_enabled`, `is_empty`, `modes` and 2 more. -//! Implements `Display for ExperimentalError`, `Error for ExperimentalError` and 1 more. +//! The opt-in model of the experimental kernels: Mode and the OptIn set (all off by default), the Program +//! catalogue and the modes each needs, the pin / seal admission gates (fail closed), ExperimentalError, grid helpers. use super::{ CVEC_ENTRIES, CVEC_PTX, Entry, Error, ExperimentalError, KEYLESS_ENTRIES, KEYLESS_PTX, KV_Q4_ENTRIES, KV_Q4_PTX, diff --git a/crates/cuda-driver/src/experimental/tests.rs b/crates/cuda-driver/src/experimental/tests.rs index b22cb8cb..ad643770 100644 --- a/crates/cuda-driver/src/experimental/tests.rs +++ b/crates/cuda-driver/src/experimental/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the experimental kernel programs: entry signatures match their CUDA source, sealed PTX matches its pin, +//! modes are off by default with ordered admission, and KV grids, byte sizes and stream guards equal the Original's. use super::*; diff --git a/crates/cuda-driver/src/experimental_gpu/context.rs b/crates/cuda-driver/src/experimental_gpu/context.rs index 7899d9c2..3ad0a73f 100644 --- a/crates/cuda-driver/src/experimental_gpu/context.rs +++ b/crates/cuda-driver/src/experimental_gpu/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `experimental_program`, `unload_failed`. Functions: `resolve_entries`, `i32_of`, `i64_of`. -//! Split out of `experimental_gpu` to keep its files under the line limit. +//! Loads an experimental Program into a Context: opt-in and pin gates, module load, entry resolution and caching +//! (nothing is published until every entry resolves), plus unload of a failed load and the i32 / i64 argument casts. use super::{ Context, DriverResult, Error, LoadedProgram, OptIn, Program, Rc, Result, admit, combine, failure, ffi, invalid, diff --git a/crates/cuda-driver/src/experimental_gpu/stream_map.rs b/crates/cuda-driver/src/experimental_gpu/stream_map.rs index 74e2b765..05624474 100644 --- a/crates/cuda-driver/src/experimental_gpu/stream_map.rs +++ b/crates/cuda-driver/src/experimental_gpu/stream_map.rs @@ -1,5 +1,5 @@ -//! Methods of `StreamMap`: `bind`. Methods of `Call`: `pointer`, `ro`, `rw`, `ro_at` and 7 more. Functions: `failure`. -//! Split out of `experimental_gpu` to keep its files under the line limit. +//! Argument binding for experimental launches: Call adds checked, context-matched pointer and scalar operands +//! (read-only / read-write, with admitted extents) and StreamMap binds the page-table and slot arrays of the KV stream. use super::{ Admitted, Arg, CTL_INTS, Call, DeviceBuffer, DriverResult, Entry, Error, ExperimentalError, Launch, Result, diff --git a/crates/cuda-driver/src/family_tests.rs b/crates/cuda-driver/src/family_tests.rs index 2905c651..55fff3e2 100644 --- a/crates/cuda-driver/src/family_tests.rs +++ b/crates/cuda-driver/src/family_tests.rs @@ -1,5 +1,5 @@ -//! Functions: `common_checked_geometry_matches_frozen_native_layouts`, `common_invalid_shapes_have_fixed_errors`, `q... -//! Defines `QuantizeBuffers`. +//! Tests of the common projection family: geometry and launch grids equal the frozen native layouts, invalid shapes +//! give fixed errors, misaligned ranges are refused, and quantizer launch / sync / restore errors keep their order. use super::*; const KINDS: [ProjectionKind; 10] = [ diff --git a/crates/cuda-driver/src/ffi/api.rs b/crates/cuda-driver/src/ffi/api.rs index be7e0cf6..053edf2d 100644 --- a/crates/cuda-driver/src/ffi/api.rs +++ b/crates/cuda-driver/src/ffi/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `memory_info`, `mmq_capabilities`, `load_mmq`, `mmq_function` and 56 more. -//! Split out of `ffi` to keep its files under the line limit. +//! Stub of the whole ffi Api (module loads, launches, memory, contexts) for builds without a usable CUDA driver: +//! every method returns UnsupportedPlatform; the real implementation is in driver_backed. #[cfg(not(all( feature = "cuda-driver", diff --git a/crates/cuda-driver/src/ffi/context_handle.rs b/crates/cuda-driver/src/ffi/context_handle.rs index 125070f1..040f2bb6 100644 --- a/crates/cuda-driver/src/ffi/context_handle.rs +++ b/crates/cuda-driver/src/ffi/context_handle.rs @@ -1,5 +1,5 @@ -//! Methods of `ContextHandle`: `synthetic`. -//! Methods of `BufferHandle`: `registered_bank_alias`, `checked_subspan`, `qwen_address`, `validate_extent` and 7 more. +//! Typed handles of device memory and modules: BufferHandle checks extents, sub-spans, alignment, overlap and MoE down +//! slots before a driver call, and the selection of the PTX image and entry name for each projection kind. use super::{BufferHandle, DenseFormat, Error, ProjectionKind, Result, RoutedFormat}; // used only with some cargo features or targets of this crate diff --git a/crates/cuda-driver/src/ffi/driver_backed/api.rs b/crates/cuda-driver/src/ffi/driver_backed/api.rs index 92aaef4b..1ce881dc 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/api.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `memory_info`, `mmq_capabilities`, `load_mmq`, `mmq_function` and 9 more. -//! Split out of `enabled` to keep its files under the line limit. +//! Api calls of the real driver for the fixed-function kernels of the MMQ family: memory info, MMQ capability and +//! shared-memory limit, IQ3 native integer, resident d4 and head-greedy module loads and launches. use super::{ Api, CuDevice, CuResult, Error, FunctionHandle, HeadGreedyArguments, Iq3NativeIntegerArguments, MemGetInfoV2, diff --git a/crates/cuda-driver/src/ffi/driver_backed/device_context_memory_copies.rs b/crates/cuda-driver/src/ffi/driver_backed/device_context_memory_copies.rs index a78dce8a..a4424db4 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/device_context_memory_copies.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/device_context_memory_copies.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `device`, `create`, `destroy`, `push` and 11 more. -//! Split out of `enabled` to keep its files under the line limit. +//! Driver Api calls for devices, contexts and memory: cuDeviceGet, context create / destroy / push / pop, +//! synchronize, allocate / free, host-device copies, zeroing and the device-to-device weight and MoE down copies. use super::{Api, BufferHandle, ContextHandle, CuContext, Error, Result, c_void, check}; diff --git a/crates/cuda-driver/src/ffi/driver_backed/library_drop.rs b/crates/cuda-driver/src/ffi/driver_backed/library_drop.rs index 2b25d9c6..ec9cd468 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/library_drop.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/library_drop.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Library`. Functions: `check`. -//! Split out of `enabled` to keep its files under the line limit. +//! Ownership of the dlopen'ed driver library (dlclose on Drop) and check(), which maps a non-zero CUDA result +//! code to Error::Driver; kept apart as the two primitives every driver-backed call depends on. use super::{CuResult, Error, Library, Result}; diff --git a/crates/cuda-driver/src/ffi/driver_backed/library_load_fixed_operations.rs b/crates/cuda-driver/src/ffi/driver_backed/library_load_fixed_operations.rs index 40827deb..55d98141 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/library_load_fixed_operations.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/library_load_fixed_operations.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `launch_qwen`, `load`, `resolve`, `load_q6_batch_preview` and 4 more. -//! Functions: `is_projection_family`. +//! Loads libcuda.so.1 and resolves the sixteen fixed driver symbols into the Api (dlopen, no CUDA toolkit needed), +//! plus the fixed-operation and Q6 batch module loads, function lookup and the launch_qwen entry point. use super::{ Api, COMMON_QUANTIZER_PTX, ContextCreateV2, ContextDestroyV2, ContextPopCurrentV2, ContextPushCurrentV2, diff --git a/crates/cuda-driver/src/ffi/driver_backed/matvec_projection_launches.rs b/crates/cuda-driver/src/ffi/driver_backed/matvec_projection_launches.rs index 6027f604..c701069d 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/matvec_projection_launches.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/matvec_projection_launches.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `unload`, `launch`, `launch_gr_read_guard`, `launch_matvec` and 8 more. -//! Split out of `enabled` to keep its files under the line limit. +//! Real-driver kernel launches of the dense path: module unload, generic launch, matvec, Q8 quantize, Q5 / Q6 and +//! dense / grouped projections, grouped SwiGLU and the GR read guard, each with its grid and arguments checked. use super::{ Api, FunctionHandle, GrReadGuardArguments, LaunchArguments, MatvecArguments, ModuleHandle, ProjectionArguments, diff --git a/crates/cuda-driver/src/ffi/driver_backed/mmq_original_group_launches.rs b/crates/cuda-driver/src/ffi/driver_backed/mmq_original_group_launches.rs index e9bc1bc4..3298704d 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/mmq_original_group_launches.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/mmq_original_group_launches.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `mmq_original_group_shared_limit`, `load_mmq_original_group`, `mmq_original_group_function`, `l... -//! Split out of `enabled` to keep its files under the line limit. +//! Real-driver loads and launches of the Original's grouped MMQ path: shared-memory limit query, group module and +//! function lookup, the gather and group-helper launches. use super::{ Api, CuDevice, CuResult, Error, FunctionHandle, MMQ_ORIGINAL_GROUP_SYMBOLS, MmqOriginalGatherArguments, diff --git a/crates/cuda-driver/src/ffi/driver_backed/mmq_resident_qsa_selected_launches.rs b/crates/cuda-driver/src/ffi/driver_backed/mmq_resident_qsa_selected_launches.rs index 8621a956..c7105343 100644 --- a/crates/cuda-driver/src/ffi/driver_backed/mmq_resident_qsa_selected_launches.rs +++ b/crates/cuda-driver/src/ffi/driver_backed/mmq_resident_qsa_selected_launches.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `launch_mmq_original_swiglu`, `load_mmq_resident`, `mmq_resident_function`, `launch_mmq_residen... -//! Split out of `enabled` to keep its files under the line limit. +//! Real-driver loads and launches of the resident MMQ pipeline (SwiGLU, quantize, project, fixup), the QSA selected +//! gather kernels and the Qwen asset modules (load_qwen_module, qwen_function). use super::{ Api, Error, FunctionHandle, MmqArguments, MmqFixupArguments, MmqOriginalSwigluArguments, MmqQuantArguments, diff --git a/crates/cuda-driver/src/ffi/function_handle.rs b/crates/cuda-driver/src/ffi/function_handle.rs index c8914d49..95fde86c 100644 --- a/crates/cuda-driver/src/ffi/function_handle.rs +++ b/crates/cuda-driver/src/ffi/function_handle.rs @@ -1,5 +1,5 @@ -//! Methods of `FunctionHandle`: `qwen_success`, `synthetic`. Methods of `LaunchArguments`: `new`. -//! Implements `Drop for LaunchArguments`, `Drop for GrReadGuardArguments` and 3 more. +//! FunctionHandle constructors and the heap-pinned kernel-argument blocks (LaunchArguments, matvec, Q8 quantize, +//! Q5 / Q6 / dense projection, GR read guard): self-referential parameter arrays built once and freed by Drop. use super::{ ArgumentStorage, BufferHandle, GrReadGuardArguments, GrReadGuardStorage, LaunchArguments, MatvecArguments, diff --git a/crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs b/crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs index e292e5d8..bc5f5c01 100644 --- a/crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs +++ b/crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqOriginalGatherArguments`: `new`, `parameters`. -//! Split out of `mmq_abi` to keep its files under the line limit. +//! Parameter block of the Original's gather (copy16) kernel launch: the raw, gate-up and down addresses and +//! 16-byte element counts laid out in the kernel's ABI order. use super::{BufferHandle, MmqOriginalGatherArguments, Owned, c_void}; diff --git a/crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs b/crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs index dad15f8e..3adbe962 100644 --- a/crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs +++ b/crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqResidentArguments`: `native_resident_d4`, `zero`, `finite`, `gather` and 1 more. -//! Methods of `Iq3NativeIntegerArguments`: `dot`, `reduce`, `new`, `parameters`. +//! Parameter blocks for the resident MMQ and native IQ3 launches: resident d4, zero, finite check, gather, IQ3 +//! dot / reduce, Original indexed quantize, grouped MMQ, fixup and SwiGLU, each laid out in its kernel's ABI order. use super::{ BufferHandle, Iq3NativeIntegerArguments, Layout, MmqArguments, MmqFixupArguments, MmqGatherShape, MmqGroupBuffers, diff --git a/crates/cuda-driver/src/ffi/mmq_abi/owned.rs b/crates/cuda-driver/src/ffi/mmq_abi/owned.rs index b80469b7..5d27691c 100644 --- a/crates/cuda-driver/src/ffi/mmq_abi/owned.rs +++ b/crates/cuda-driver/src/ffi/mmq_abi/owned.rs @@ -1,5 +1,5 @@ -//! Methods of `Owned`: `new`, `parameters`. Methods of `MmqQuantArguments`: `new`, `parameters`. -//! Implements `Drop for Owned`. Functions: `fastdiv`. +//! Owned: the heap-pinned Storage (addresses, wide, integers, fastdiv divisors, parameter pointers) behind every MMQ +//! argument block, freed once on Drop; also the fast-division constants and the quantize, MMQ and fixup block builders. use super::{BufferHandle, Layout, MmqArguments, MmqFixupArguments, MmqQuantArguments, Owned, Storage, c_void}; diff --git a/crates/cuda-driver/src/ffi/original_file_source/arena.rs b/crates/cuda-driver/src/ffi/original_file_source/arena.rs index 9fc8d5b3..98632576 100644 --- a/crates/cuda-driver/src/ffi/original_file_source/arena.rs +++ b/crates/cuda-driver/src/ffi/original_file_source/arena.rs @@ -1,5 +1,5 @@ -//! Methods of `Arena`: `bytes`, `pin_limit`, `locked`, `lock_offset` and 5 more. -//! Methods of `Copy`: `into_slice`, `run`. +//! Host arena of the file expert source: a malloc / pinned block with partial mlock, checked writes, reads and +//! aliases of byte ranges, the three-part parallel Copy of expert pieces, page warm-up and worker stack sizing. use super::{Arena, Copy, Error, P, Result}; diff --git a/crates/cuda-driver/src/ffi/original_file_source/check.rs b/crates/cuda-driver/src/ffi/original_file_source/check.rs index be9eecae..0a71f756 100644 --- a/crates/cuda-driver/src/ffi/original_file_source/check.rs +++ b/crates/cuda-driver/src/ffi/original_file_source/check.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `load`, `allocate`, `try_pinned`, `exchange_allocate` and 3 more. -//! Implements `Drop for Opening`, `Drop for Api`. Functions: `check`, `symbol`. Defines `Opening`. +//! The host-memory Api of the file expert source: dlopen of libcuda for page-locked alloc / register / device alias / +//! async copy, arena allocation (pinned or malloc), exchange copies and close, with the symbol and result checks. use super::{Alias, Alloc, Api, Arc, Arena, ArenaSpan, CStr, DtoH, Error, Free, P, Register, Result}; diff --git a/crates/cuda-driver/src/ffi/original_stager/api.rs b/crates/cuda-driver/src/ffi/original_stager/api.rs index 201a4a30..fc167246 100644 --- a/crates/cuda-driver/src/ffi/original_stager/api.rs +++ b/crates/cuda-driver/src/ffi/original_stager/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `record`, `wait`, `copy_slot`, `load` and 13 more. Implements `Drop for Opening`. -//! Functions: `symbol`. Defines `Opening`. +//! Driver Api of the expert stager: dlopen of libcuda, pinned host buffers, events (record / wait / timing / +//! query), async slot copies and the worker context enter / leave that let staging threads issue DMA safely. use super::{ Api, BufferHandle, CStr, ContextHandle, Copy, Elapsed, Error, EventCreate, EventRecord, Handle, HandleCall, diff --git a/crates/cuda-driver/src/ffi/original_stager/check.rs b/crates/cuda-driver/src/ffi/original_stager/check.rs index 3214ad0f..33a271c9 100644 --- a/crates/cuda-driver/src/ffi/original_stager/check.rs +++ b/crates/cuda-driver/src/ffi/original_stager/check.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Api`. Functions: `check`. -//! Split out of `original_stager` to keep its files under the line limit. +//! Result-code check of the stager's driver calls, and the Drop of its Api that dlcloses libcuda only after the +//! last worker holding an Arc of it is gone. use super::{Api, Error, Handle, Result}; diff --git a/crates/cuda-driver/src/ffi/original_stager/host_buffer.rs b/crates/cuda-driver/src/ffi/original_stager/host_buffer.rs index 5e91a1ab..902cb0c5 100644 --- a/crates/cuda-driver/src/ffi/original_stager/host_buffer.rs +++ b/crates/cuda-driver/src/ffi/original_stager/host_buffer.rs @@ -1,5 +1,5 @@ -//! Methods of `HostBuffer`: `pinned`, `capacity`, `slot`. -//! Methods of `CopyJob`: `from_slices`, `bytes`, `copy_to`, `copy_segment` and 1 more. +//! Host side of expert staging: pinned HostBuffer slots, CopyJob (three source slices copied into a slot) and the +//! read-only mmap of the expert file (ExpertFileMap) from which expert byte ranges are read. use super::{CopyJob, Error, ExpertFileMap, HostBuffer, Result, WorkerSlot, c_void}; diff --git a/crates/cuda-driver/src/ffi/projection_tests.rs b/crates/cuda-driver/src/ffi/projection_tests.rs index 5ed16c21..55992694 100644 --- a/crates/cuda-driver/src/ffi/projection_tests.rs +++ b/crates/cuda-driver/src/ffi/projection_tests.rs @@ -1,5 +1,5 @@ -//! Functions: `new_fixed_asset_encoding_refuses_unicode_before_driver_call`, `q4_k_dense_selector_resolves_only_its_... -//! Split out of `ffi` to keep its files under the line limit. +//! Tests of the ffi projection assets: fixed PTX must be ASCII, each format selector (Q4_K, IQ3_S, IQ2_S, Q2_0, +//! IQ4_NL, IQ4_XS) resolves only its own asset and entry, plus handle alignment / overlap and exact parameter widths. use super::*; #[test] diff --git a/crates/cuda-driver/src/ffi/q5_projection_arguments_drop.rs b/crates/cuda-driver/src/ffi/q5_projection_arguments_drop.rs index 4ed5166a..24adc83d 100644 --- a/crates/cuda-driver/src/ffi/q5_projection_arguments_drop.rs +++ b/crates/cuda-driver/src/ffi/q5_projection_arguments_drop.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Q5ProjectionArguments`, `Drop for MatvecArguments`. -//! Split out of `ffi` to keep its files under the line limit. +//! Drop of the Q5 projection and matvec argument blocks: the boxed storage is freed once, and only when the +//! launch never started or completed; after an uncertain sync the owner is forgotten and the block leaks on purpose. use super::{MatvecArguments, Q5ProjectionArguments}; diff --git a/crates/cuda-driver/src/ffi/qsa_selected_arguments.rs b/crates/cuda-driver/src/ffi/qsa_selected_arguments.rs index 3c0db652..e8f3a36f 100644 --- a/crates/cuda-driver/src/ffi/qsa_selected_arguments.rs +++ b/crates/cuda-driver/src/ffi/qsa_selected_arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaSelectedArguments`: `new`, `parameters`. Methods of `HeadGreedyArguments`: `new`, `parameters`. -//! Implements `Drop for QsaSelectedArguments`, `Drop for HeadGreedyArguments`. +//! Parameter blocks of two small kernels, QSA selected (five buffers, layer, count) and head greedy (source, +//! output): boxed, self-referential pointer arrays freed once by Drop unless completion was uncertain. use super::{BufferHandle, HeadGreedyArguments, HeadGreedyStorage, QsaSelectedArguments, QsaSelectedStorage}; diff --git a/crates/cuda-driver/src/ffi/tests.rs b/crates/cuda-driver/src/ffi/tests.rs index 26ca663a..bea24f0e 100644 --- a/crates/cuda-driver/src/ffi/tests.rs +++ b/crates/cuda-driver/src/ffi/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `ffi`. +//! Tests of ffi handle arithmetic: checked sub-spans refuse empty, wrapping and out-of-allocation ranges, matvec +//! address extents are validated, and the raw argument storage keeps its address when its owner moves. #[test] fn checked_subspan_refuses_empty_wrap_and_outside_allocation() { diff --git a/crates/cuda-driver/src/gdn_native_batch/tests.rs b/crates/cuda-driver/src/gdn_native_batch/tests.rs index c9022497..da2072c8 100644 --- a/crates/cuda-driver/src/gdn_native_batch/tests.rs +++ b/crates/cuda-driver/src/gdn_native_batch/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `gdn_native_batch`. +//! Tests of the native GDN batch program: stage slots and sizes, the fixed step order, earliest-status refusal, +//! witness errors, native format geometry, closed kernel table, 256-block launches, bindings, and artifact pin checks. use super::*; diff --git a/crates/cuda-driver/src/kar_decode_levels/tests.rs b/crates/cuda-driver/src/kar_decode_levels/tests.rs index 30532a40..2c2f0b68 100644 --- a/crates/cuda-driver/src/kar_decode_levels/tests.rs +++ b/crates/cuda-driver/src/kar_decode_levels/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the KAR level-decode kernel contract: DecodeGeometry window layouts and bounds, multiply and expert +//! shapes, fail-closed status word, the sealed PTX against its pin, and the Rust constants against the CUDA source. use super::*; diff --git a/crates/cuda-driver/src/kar_decode_levels_gpu/context.rs b/crates/cuda-driver/src/kar_decode_levels_gpu/context.rs index 1cb72921..6e8164f3 100644 --- a/crates/cuda-driver/src/kar_decode_levels_gpu/context.rs +++ b/crates/cuda-driver/src/kar_decode_levels_gpu/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `kar_levels_kernels`, `resolve_kar_entries`, `abandon_kar_module`. -//! Split out of `kar_decode_levels_gpu` to keep its files under the line limit. +//! Loads the KAR level-decode PTX into a Context: pin admission, one cached module, resolution of the decode / +//! multiply / SwiGLU entries (nothing published until all resolve) and unloading of a half-resolved module. use super::{ Context, DriverResult, ENTRY_DECODE, ENTRY_MULTIPLY, ENTRY_SWIGLU, Error, KAR_DECODE_LEVELS_PIN, diff --git a/crates/cuda-driver/src/kar_decode_levels_gpu/expert_mlp.rs b/crates/cuda-driver/src/kar_decode_levels_gpu/expert_mlp.rs index 106e0e07..b718cefc 100644 --- a/crates/cuda-driver/src/kar_decode_levels_gpu/expert_mlp.rs +++ b/crates/cuda-driver/src/kar_decode_levels_gpu/expert_mlp.rs @@ -1,4 +1,5 @@ -//! Moved out of kar_decode_levels.rs by the STRA-338 size pass: the single-token routed expert FFN. +//! Single-token routed expert FFN on the GPU from KAR-packed matrices: buffer allocation and admission, the +//! gate / up / SwiGLU / down launch sequence and the host read-back of the checked output (expert_mlp_to_host). use super::{ Admitted, BLOCK_THREADS, Context, DeviceBuffer, ExpertShape, KarDecodeError, KarDecodeLevels, KarMatrix, Launch, diff --git a/crates/cuda-driver/src/kar_decode_levels_gpu/f32_bytes.rs b/crates/cuda-driver/src/kar_decode_levels_gpu/f32_bytes.rs index 183ba00e..2c7bf28b 100644 --- a/crates/cuda-driver/src/kar_decode_levels_gpu/f32_bytes.rs +++ b/crates/cuda-driver/src/kar_decode_levels_gpu/f32_bytes.rs @@ -1,5 +1,5 @@ -//! Functions: `f32_bytes`, `download`, `failure`, `release_all` and 1 more. -//! Split out of `kar_decode_levels_gpu` to keep its files under the line limit. +//! Small host helpers of the KAR GPU owner: f32 to little-endian bytes, device download, finite-only f32 parse, +//! joint release of buffers, and folding a primary failure with the context restore into one KarDecodeError. use super::{DeviceBuffer, DriverResult, Error, KarDecodeError, Result, combine}; diff --git a/crates/cuda-driver/src/kar_decode_levels_gpu/kar_decode_levels.rs b/crates/cuda-driver/src/kar_decode_levels_gpu/kar_decode_levels.rs index 22f4fc70..afb6bd00 100644 --- a/crates/cuda-driver/src/kar_decode_levels_gpu/kar_decode_levels.rs +++ b/crates/cuda-driver/src/kar_decode_levels_gpu/kar_decode_levels.rs @@ -1,5 +1,5 @@ -//! Methods of `KarDecodeLevels`: `open`, `close`, `admit`, `disjoint` and 15 more. Defines `MultiplyBuffers`. -//! Split out of `kar_decode_levels_gpu` to keep its files under the line limit. +//! The KarDecodeLevels owner: opens the module on a context, admits buffers and builds decode / multiply launches, +//! runs them under one drain, and offers decode_to_host / decode_multiply_to_host with status and finite checks. use super::{ Admitted, BLOCK_THREADS, Context, DecodeGeometry, DecodeMultiplyBuffers, DeviceBuffer, Error, KarDecodeError, diff --git a/crates/cuda-driver/src/kv_stream_gpu/rng.rs b/crates/cuda-driver/src/kv_stream_gpu/rng.rs index f9049b96..fb3dca74 100644 --- a/crates/cuda-driver/src/kv_stream_gpu/rng.rs +++ b/crates/cuda-driver/src/kv_stream_gpu/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`, `unit`, `below`. Functions: `upload`, `addr`, `f32s`, `i32s` and 6 more. -//! Defines `KernelShape`, `ImageLayout`. +//! Shared fixtures of the KV-stream GPU proofs: an xorshift Rng, device upload / address / byte helpers, a kernel +//! launch and module-load wrapper, random value groups and block selections, and the expected pool image layout. use super::{ Arg, Arguments, Context, DeviceBuffer, HD, Module, NativeBatchWorkspace, PAGE, Result, Rng, combine, kv_q8, diff --git a/crates/cuda-driver/src/mapped_expert_bank/context.rs b/crates/cuda-driver/src/mapped_expert_bank/context.rs index dd6c6446..98d0ab8d 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/context.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mapped_expert_bank`, `check_bank_inputs`, `bank_ranges`, `bank_role` and 2 more. -//! Methods of `MappedExpertBank`: `opened`, `load_banks`. Functions: `aligned_copy_enabled`. +//! Opening a MappedExpertBank on a Context: checks the lease and member banks, plans page ranges and the budget +//! charge, loads the mapped driver ABI and registers each bank for a device alias; also the aligned-copy A/B switch. use super::{ BANKS, Context, Error, LayerRole, MappedExpertBank, RegisteredBank, ResidentExpertBankLease, diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_drop.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_drop.rs index 9b1a3184..07ea14d2 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_drop.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `PendingMappedExpertCopy`: `destination_bytes`, `new`, `observe`, `settle_observation` and 6 more. -//! Methods of `Context`: `mapped_expert_copy_scratch`. +//! Lifetime of an in-flight mapped expert copy: PendingMappedExpertCopy (event poll / wait, cleanup, leaking on +//! uncertain completion), its reusable scratch and completion owners, and the Drop of the bank that unregisters it. use super::{ Context, DeviceBuffer, Error, MappedExpertBank, MappedExpertCopyCompletion, MappedExpertCopyScratch, diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_close.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_close.rs index 3f25ce40..f5de0836 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_close.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_close.rs @@ -1,5 +1,5 @@ -//! Methods of `MappedExpertBank`: `retain_uncertain`, `close`. -//! Split out of `mapped_expert_bank_methods` to keep its files under the line limit. +//! Closing a MappedExpertBank: close() and retain_uncertain(), which poisons the context and leaks the bank's +//! ABI and registrations when completion is uncertain, since the device may still read them. use super::{MappedExpertBank, Result}; diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs index 5ff6418e..b202d29e 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pcie_and_triplets.rs @@ -1,5 +1,5 @@ -//! Methods of `MappedExpertBank`: `page_locked`, `locked_experts`, `resident_bytes`, `pcie_alias` and 13 more. -//! Functions: `bank_index`, `expert_role_offset`. +//! Device-side use of a MappedExpertBank: PCIe alias lookup, eligibility checks, and copy_triplet, which launches the +//! mapped-copy kernel for one expert's three tensors into device buffers and tracks it as a pending copy. use super::{ DeviceBuffer, Error, LayerRole, MappedExpertBank, MappedExpertCopyScratch, PendingMappedExpertCopy, Rc, diff --git a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs index e59d5b1b..a19579dc 100644 --- a/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs +++ b/crates/cuda-driver/src/mapped_expert_bank/mapped_expert_bank_operations/mapped_expert_bank_pieces_and_pinning.rs @@ -1,5 +1,5 @@ -//! Methods of `MappedExpertBank`: `cache_context_matches`, `cache_source`, `cache_source_aligned`, `retained_span_ha... -//! Split out of `mapped_expert_bank_methods` to keep its files under the line limit. +//! Host-side views of a MappedExpertBank: cache sources and page-aligned pieces of an expert, and pin_resident, +//! which page-locks the ranked hot experts within a byte budget (round, merge, register) and unwinds on failure. use super::{ Context, Error, LayerRole, MappedExpertBank, PAGE, RegisteredBank, ResidentExpertBankSpan, Result, TensorRole, api, diff --git a/crates/cuda-driver/src/mmq/asset.rs b/crates/cuda-driver/src/mmq/asset.rs index 30763b5d..601fe449 100644 --- a/crates/cuda-driver/src/mmq/asset.rs +++ b/crates/cuda-driver/src/mmq/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mmq_experiment`. -//! Functions: `artifacts_valid`, `asset`, `original_formats_asset`, `bytes` and 1 more. +//! Sealed PTX assets of the MMQ kernels: each artifact is checked once for pinned length, NUL-terminated ASCII and +//! SHA-256 before use (the Original-formats pair against its own pin), plus small buffer helpers and mmq_experiment(). use super::{Context, Error, MmqExperiment, ORIGINAL_FORMATS_FIXUP_PIN, ORIGINAL_FORMATS_MUL_PIN, Result}; diff --git a/crates/cuda-driver/src/mmq/context.rs b/crates/cuda-driver/src/mmq/context.rs index 5ea75417..059ff4f7 100644 --- a/crates/cuda-driver/src/mmq/context.rs +++ b/crates/cuda-driver/src/mmq/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mmq_weight_triplet`, `allocate_triplet`, `publish_triplet`, `admit_formats` and 12 more. -//! Functions: `check_weight_blocks`, `buffer_handles`, `check_padded_targets`, `owned_gate_up_layout`. +//! MMQ weight upload on a Context: format and charge admission, then repacking host or device raw weights into +//! padded MMQ layouts (single, gate/up/down triplet, owned gate-up) with checks that block counts and targets fit. use super::{ Context, DeviceBuffer, Error, Layout, MmqFormat, MmqWeights, ProjectionKind, ProjectionSpec, Result, RoutedFormat, diff --git a/crates/cuda-driver/src/mmq/mmq_experiment.rs b/crates/cuda-driver/src/mmq/mmq_experiment.rs index 92fb02f2..50be4ef4 100644 --- a/crates/cuda-driver/src/mmq/mmq_experiment.rs +++ b/crates/cuda-driver/src/mmq/mmq_experiment.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqExperiment`: `new`, `enable_original_formats`, `function`, `weights` and 16 more. -//! Defines `ObservedRun`. +//! The MMQ experiment owner: loads the MMQ kernel modules and runs one observed projection (quantize, MMA, fixup) +//! with full finite readbacks, so the numeric gate tests can compare each stage with the recorded reference. use super::{ Context, DeviceBuffer, Error, Layout, MmqExperiment, MmqFormat, MmqObservation, MmqProfile, MmqRequest, MmqWeights, diff --git a/crates/cuda-driver/src/mmq/mmq_experiment_drop.rs b/crates/cuda-driver/src/mmq/mmq_experiment_drop.rs index 867908d9..7e3c31f5 100644 --- a/crates/cuda-driver/src/mmq/mmq_experiment_drop.rs +++ b/crates/cuda-driver/src/mmq/mmq_experiment_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWeights`: `allocated_bytes`, `native_buffer`, `native_layout`, `native_spec` and 10 more. -//! Implements `Drop for MmqExperiment`, `Drop for MmqWeights`. +//! Native-path entry points of MmqWeights (Q8_1 quantize, gate/up and down column projections) and the close/Drop +//! implementations of MmqExperiment and MmqWeights, which release the loaded modules and device weight buffers. use super::{ DeviceBuffer, DownColumns, Error, Layout, MmqExperiment, MmqFormat, MmqWeights, NativeWeights, ProjectionKind, diff --git a/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs index 380736e0..a2df0bbc 100644 --- a/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs +++ b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs @@ -1,5 +1,5 @@ -//! Methods of `Receipt`: `load`, `read`. Functions: `digest`, `hex`, `read_regular`, `parse_manifest` and 7 more. -//! Defines `Manifest`. +//! Receipt loader of the MMQ numeric GPU tests: reads the pinned fixture manifest, checks its headers and file list +//! and sha256 pins, and offers the JSON field readers and finite/compare helpers the cases use. use super::{ BTreeMap, CASE_FILES, Component, MetadataExt, OpenOptions, OpenOptionsExt, Path, PathBuf, Pin, Read, Receipt, diff --git a/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs index 483ec40f..027a88f2 100644 --- a/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs +++ b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs @@ -1,5 +1,5 @@ -//! Functions: `cases`, `load_case`, `check_metadata`, `check_geometry`. Defines `Shape`. -//! Split out of `mmq_numeric_gpu_tests` to keep its files under the line limit. +//! Per-format test cases of the MMQ numeric GPU tests: loads each case from the receipt and checks that its recorded +//! geometry, grid and provenance flags match what the closed fixture expects before any kernel runs. use super::{Case, Receipt, field, finite, integer}; diff --git a/crates/cuda-driver/src/mmq/release_triplet.rs b/crates/cuda-driver/src/mmq/release_triplet.rs index 2d873c3c..3f9bef5f 100644 --- a/crates/cuda-driver/src/mmq/release_triplet.rs +++ b/crates/cuda-driver/src/mmq/release_triplet.rs @@ -1,5 +1,5 @@ -//! Functions: `release_triplet`. -//! Split out of `mmq` to keep its files under the line limit. +//! Releases the three device buffers of an MMQ projection in reverse order, keeps the first error and +//! poisons the context when any release fails; shared by the experiment and workspace cleanup paths. use super::{Context, DeviceBuffer, Result}; diff --git a/crates/cuda-driver/src/mmq/resident/asset.rs b/crates/cuda-driver/src/mmq/resident/asset.rs index 69a8d950..f78d5d90 100644 --- a/crates/cuda-driver/src/mmq/resident/asset.rs +++ b/crates/cuda-driver/src/mmq/resident/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `QueuedCommand`: `launch`, `launch_projection`. -//! Methods of `Context`: `mmq_workspace`, `native_mmq_workspace`, `native_integer_iq3_mmq_workspace`, `native_intege... +//! The sealed PTX helper artifact of the resident MMQ path (length and sha256 checked), the queued launch commands +//! built from it, and the Context constructors of the MMQ workspace variants (native and original formats). use super::{Context, Error, MmqWorkspace, QueuedCommand, Result, combine, original_formats_asset}; diff --git a/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs index 43d68c51..29f47269 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs @@ -1,5 +1,5 @@ -//! Functions: `digest`, `read`, `parse_pins`, `read_pinned` and 10 more. -//! Split out of `mmq_native_resident_gpu_tests` to keep its files under the line limit. +//! Fixture and measurement helpers of the native resident MMQ GPU tests: reads the pinned fixture files by +//! manifest size and sha256, moves buffers to and from the device, and reports error metrics between two outputs. use super::{ BTreeMap, Context, DeviceBuffer, MetadataExt, OpenOptions, OpenOptionsExt, Path, PathBuf, Read, Write, finite_f32, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs index aaa08cb5..be2f2088 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Alias`. Functions: `native_hidden_q8`. -//! Split out of `mmq_native_resident_gpu_tests` to keep its files under the line limit. +//! Independent reference for the native resident tests: runs the original CommonQuantize kernel on a real native +//! hidden row and returns its Q8 bytes. Also owns the Drop of the test Alias buffer view. use super::{Alias, CHUNK, Context, DeviceBuffer, FixedOperation, download, ffi}; diff --git a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs index 8d80eb19..9b1e6392 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs @@ -1,5 +1,5 @@ -//! Methods of `Receipt`: `load`, `check_pinned_contents`, `read`. -//! Functions: `digest`, `hex`, `read_regular`, `parse_manifest` and 14 more. +//! Receipt loader of the resident MMQ GPU tests: reads the pinned fixture manifest, checks its headers, file list and +//! sha256 pins (incl. pinned contents), and offers the digest, JSON field and finite/compare helpers the cases use. use super::{ BTreeMap, CASE_FILES, Component, Context, DeviceBuffer, MetadataExt, MmqFormat, OpenOptions, OpenOptionsExt, Path, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs index 4c27b7a1..d675f30c 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for LivePacketAlias`. -//! Split out of `mmq_resident_gpu_tests` to keep its files under the line limit. +//! Drop of LivePacketAlias: puts back the original buffer handle that the alias test view had swapped out. use super::LivePacketAlias; diff --git a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs index 95a392ce..062e0965 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs @@ -1,5 +1,5 @@ -//! Functions: `native_owner`, `native_gate_up_owner`, `native_down_owner`, `direct` and 2 more. -//! Split out of `mmq_resident_gpu_tests` to keep its files under the line limit. +//! Owner-equivalence checks of the resident MMQ tests: the native dual weights (gate/up prepared and grouped, +//! down columns) must produce the same bytes as the raw routed projections; plus the direct and gather checks. use super::{ CHUNK, Context, DOWN, DeviceBuffer, DownColumns, Error, GATE, GROUP, INPUT, MmqWeights, MmqWorkspace, Receipt, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs index 0f2abf10..7a7ad4ab 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs @@ -1,5 +1,5 @@ -//! Methods of `LivePacketAlias`: `new`, `buffer`. -//! Functions: `chain_baseline`, `chain`, `chain_hidden_checks`, `chain_slot_checks` and 8 more. +//! The resident MMQ chain test: runs gate/up, SwiGLU and down through the workspace against the original-first +//! nonresident baseline, checks hidden rows, slot output, short and foreign packets, and the witness probes. use super::{ Context, DOWN, DeviceBuffer, Error, FiniteMmqOutput, GATE, GROUP, HIDDEN, LivePacketAlias, MmqHidden, MmqProfile, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs index b8d85a22..c2cd184b 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `mmq_workspace_bring_up`, `mmq_workspace_gate_up_chunk_close`, `projection_plan`. -//! Split out of `resident` to keep its files under the line limit. +//! Module root of the resident MmqWorkspace: shared imports for its bring-up, gate/up chunk and projection-plan +//! files, each of which owns one phase of the workspace lifecycle. use super::{ CHUNK, Context, DOWN, DeviceBuffer, Error, GATE, GROUP, HIDDEN, INPUT, Layout, MmqChunkActivation, MmqExperiment, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs index 006b1bc1..aef7515d 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWorkspace`: `new`, `check_integer_policy`, `charge`, `bring_up` and 13 more. -//! Split out of `mmq_workspace` to keep its files under the line limit. +//! Construction and bring-up of the resident MmqWorkspace: charges its device budget up front, allocates the +//! eleven fixed buffers, loads the helper kernels and integer/native operators, and runs queued launches. use super::{ Context, DeviceBuffer, Error, MmqWorkspace, QueuedCommand, Result, bytes, combine, ffi, native_activation, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs index 247f5fc8..d1e39e7e 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWorkspace`: `prepare_original_gate_up_chunk`, `prepare_gate_up_chunk_with_operator`, `upload_and_q... -//! Split out of `mmq_workspace` to keep its files under the line limit. +//! Original-prompt gate/up chunk activation of the resident MmqWorkspace (affine D4 quantize, independent of the +//! native integer operators), the upload-and-quantize step it uses, and the workspace close. use super::{CHUNK, Error, INPUT, Layout, MmqChunkActivation, MmqFormat, MmqWorkspace, Result, bytes, combine}; diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs index c28a5808..a31fb0d7 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWorkspace`: `finish_finite`, `finite`, `quantize`, `quantize_with_operator` and 15 more. -//! Functions: `finite_extent`, `finite_verdict`, `finite_output_name`. Defines `StreamKLaunch`, `ProjectPlan`. +//! Projection planning of the resident MmqWorkspace: finite-output proofs, activation quantize, plan and alias +//! validation, the native integer and stream-k projection launches, and the gate/up chunk preparation. use super::{ DOWN, Error, GATE, GROUP, HIDDEN, Layout, MmqChunkActivation, MmqExperiment, MmqFormat, MmqProfile, MmqWeights, diff --git a/crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs index 87dfdd5f..74050151 100644 --- a/crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqChunkActivation`: `gather_gate_up`, `gather_group`, `upload_gather_ids`, `gather_handles`. -//! Methods of `MmqGroupActivation`: `admits`, `gate_up`, `project_swiglu`, `swiglu_hidden` and 1 more. +//! Grouped activation flow of the resident MmqWorkspace: gather of expert rows, gate/up with SwiGLU, down +//! projection and bounded copies of finite Down columns into ten-slot packets. Also the Drop of the workspace. use super::{ CHUNK, DOWN, DOWN_Q8, DeviceBuffer, DownCopyHandles, Error, FiniteMmqOutput, FixedOperation, GATE, GROUP, HIDDEN, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/asset.rs b/crates/cuda-driver/src/mmq/resident/original_group/asset.rs index 260d185d..dcd0d8a4 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/asset.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGroupBank`: `new`, `admit_charge`, `init`, `load_guarded` and 9 more. -//! Implements `Drop for OriginalGroupBank`. Functions: `asset`, `sizes`, `original_mmq_group_bank_bytes`. +//! The OriginalGroupBank: sealed PTX per kernel kind, the eager device-budget charge, module and kernel loading, +//! buffer allocation and bounds-checked buffer/handle access for the original prompt expert groups; Drop frees them. use super::{ Context, DeviceBuffer, Error, FORMATS, MmqFormat, OriginalGroupBank, Result, SEALED, TMP, WIDTHS, combine, ffi, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs index 3c56f1c8..93296fd4 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs @@ -1,5 +1,5 @@ -//! Methods of `Stats`: `new`. Methods of `Core`: `new`. Implements `Drop for ChunkStream`. Functions: `env_number`. -//! Defines `CoreParts`. +//! ChunkStream state for the prompt-chunk expert stream: an ordered list of expert copy entries (layer, expert) +//! feeding the ring slots, the shared Core and timing Stats, the issuer-thread setup and issue depth; Drop stops it. use super::{ ACTIVE, Api, Arc, AtomicBool, AtomicU64, AtomicUsize, BufferHandle, ChunkStream, Core, Entry, Error, Ordering, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs index 1bbf10c5..09a2bae1 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs @@ -1,5 +1,5 @@ -//! Methods of `HostStage`: `new`, `stager_sizes`, `unstarted`, `allocate_ring` and 13 more. -//! Implements `Drop for HostStage`. +//! HostStage: the page-locked ring buffers and helper threads that stage pageable experts on the host ahead of their +//! DMA, plus the STAGE_VERIFY check that a released buffer still equals its source. Drop stops helpers and frees them. use super::{ Arc, AtomicU32, AtomicU64, AtomicUsize, Condvar, Error, HostStage, Job, MAX_JOBS, Mutex, NON_FINITE, Ordering, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs index 621f3660..5ccdd8b4 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `Shared`: `claim`, `finished`, `work`, `await_jobs` and 4 more. -//! Functions: `verify_enabled`, `layer_priority`, `apply_priority`, `block_bytes` and 1 more. +//! Helper-thread side of HostStage: the shared job claim and copy loop, the finite FP16 block-scale check of copied +//! experts, the LELEKA_STAGE_VERIFY switch and the optional Windows page-cache priority for the layers read first. use super::{Arc, Job, NON_FINITE, NORMAL_PRIORITY, Ordering, Shared, thread}; // used only with some cargo features or targets of this crate diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs index e6b95973..244d9891 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqCopySchedule`: `retain_host_metadata_charge`, `ring_slots`, `prompt_stream_active`, `begin... -//! Split out of `copy_ring` to keep its files under the line limit. +//! Public control of the OriginalMmqCopySchedule: begin and end the prompt-chunk expert stream, metadata byte +//! accounting, context validation, and the ordered close of host stage, events and streams after a failure. use super::{ ChunkStream, Context, Error, Events, OriginalGpuStream, OriginalMmqCopySchedule, Rc, Result, StreamEntry, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs index ceb06900..ffa2eba5 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalMmqCopySchedule`. -//! Split out of `copy_ring` to keep its files under the line limit. +//! Drop of OriginalMmqCopySchedule: closes the schedule so its streams, events and host stage are released. use super::OriginalMmqCopySchedule; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs index e5b806d2..78d57b42 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs @@ -1,5 +1,4 @@ -//! Groups the submodules `ring_construction`, `ring_gather_and_finish`, `ring_init` and 2 more. -//! Split out of `copy_ring` to keep its files under the line limit. +//! Module root of the copy Ring: shared imports of its construction, init, prefetch, stage and gather files. use super::{ Api, COMMAND_CAP, Command, Context, DeviceBuffer, Drain, Error, FORMATS, GatherDest, GroupArena, HostStage, Job, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs index f5f2ecb9..45e4ce8a 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs @@ -1,5 +1,5 @@ -//! Methods of `Ring`: `new`, `admitted_slots`. Functions: `schedule_serves_ring`. -//! Split out of `ring` to keep its files under the line limit. +//! Construction of the copy Ring: the rule that a schedule with enough slot events serves a (smaller) arena ring, +//! with its unit tests, and the admission of the arena stage slot count. use super::{Context, Error, OriginalMmqCopySchedule, Result, Ring, RingArena, RingExperts, RingPlan, combine}; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs index 5c31e8ea..c1b2ff4b 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs @@ -1,5 +1,5 @@ -//! Methods of `Ring`: `gather`, `gather_streamed`, `gather_slot`, `check_gather_destination` and 10 more. -//! Split out of `ring` to keep its files under the line limit. +//! Gather and finish side of the copy Ring: gathers a staged expert slot into the group bank on the compute stream, +//! records the slot as used, releases a layer stream entry, and copies status words after both streams drain. use super::{Command, DeviceBuffer, Error, GatherDest, MmqFormat, OriginalGpuStream, Result, Ring, combine, ffi}; use crate::ring_prefetch::RingRefusal; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs index 9eab7ce1..03bd9d40 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs @@ -1,5 +1,5 @@ -//! Methods of `Ring`: `metadata_bytes`, `enqueue`, `flag`, `stage_one` and 10 more. Functions: `profile_copied`. -//! Split out of `ring` to keep its files under the line limit. +//! Staging side of the copy Ring: copies one expert (gate, up, down) into a ring slot from a registered bank or +//! the host stage, as page-aligned supersets or exact pieces, and records its copied event and PCIe profile. use super::{ Api, COMMAND_CAP, Command, Drain, Error, MmqFormat, OriginalGpuEvent, OriginalGpuStream, ResidentExpertBankSpan, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs index fd81ee7e..a0f76ec9 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for Ring`. -//! Split out of `copy_ring` to keep its files under the line limit. +//! Drop of the copy Ring: runs the ordered close so the ring slots, events and host stage are released. use super::Ring; diff --git a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs index 165a0e48..999dbb31 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs @@ -1,5 +1,5 @@ -//! Methods of `ChunkStream`: `entry`, `next_layer_is`, `entry_matches`, `acquire` and 3 more. -//! Methods of `Drain`: `index`. Implements `RingArena for OriginalDeviceGrRead`. +//! Diagnostic switches of the copy ring (skip expert DMA, serialize ring), non-CUDA stubs of ChunkStream, the +//! RingArena view of OriginalDeviceGrRead, and Context::original_mmq_copy_schedule, which opens its streams and events. use super::{ Api, Context, Drain, Error, Events, OriginalEventKind, OriginalMmqCopySchedule, OriginalStreamKind, Rc, Result, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/kind.rs b/crates/cuda-driver/src/mmq/resident/original_group/kind.rs index 7fc7dbdf..4658065e 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/kind.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/kind.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `native_integer_iq3_mmq_original_grouped_workspace`. -//! Implements `GroupArena for OriginalDeviceGrRead`. Functions: `kind`, `shared`, `format_index`, `layout` and 1 more. +//! Format tables of the original grouped MMQ path (kernel kind, shared memory, format index, layout), the Context +//! constructor of the grouped workspace, and the GroupArena span view of the prompt arena. use super::{ BOUNDS, Context, D, Error, FORMATS, GU, GroupArena, H, HQ, IDENTITY, Layout, MmqFormat, MmqWorkspace, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs b/crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs index 13d5c18c..7c246e96 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs @@ -1,5 +1,5 @@ -//! Methods of `MmqWorkspace`: `enable_original_expert_groups`, `enable_original_expert_group_arena`, `original_exper... -//! Methods of `RoutePlan`: `new`. +//! Original expert grouping API of MmqWorkspace: enables the group bank or arena-only mode, and prepares a layer by +//! uploading routes (host or device), validating expert counts, and quantizing the Mixed rows into indexed Q8. use super::{ BOUNDS, Error, GroupArena, IDENTITY, MmqWorkspace, OriginalGroupBank, OriginalMmqLayer, QuantizeSlots, ROW_IDS, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs index 04955e2a..3f3c0ae1 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `finite_and_quantize`, `group_projection`, `original_mmq_layer_stage_experts`. -//! Split out of `original_group` to keep its files under the line limit. +//! Module root of OriginalMmqLayer, one layer of the original grouped MMQ path: its buffer checks, grouped +//! projection and expert staging live in the three files below. use super::{ BOUNDS, D, DeviceBuffer, Error, FORMATS, FiniteScan, GU, H, HQ, IDENTITY, Layout, MmqFormat, OriginalGroupBank, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs index 5197a587..93cf5920 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqLayer`: `bank`, `span`, `handle`, `reject_arena_alias` and 10 more. -//! Split out of `original_mmq_layer` to keep its files under the line limit. +//! OriginalMmqLayer buffer access and safety checks: bank spans and handles, arena alias refusal, the finite-scan +//! status decoding, the activation quantizer lookup, and staging of one expert with source overlap proofs. use super::{ D, DeviceBuffer, Error, FORMATS, FiniteScan, H, MmqFormat, OriginalGroupBank, OriginalMmqLayer, QuantizeSlots, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs index e3b201b4..008e0c5e 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqLayer`: `project`, `project_plan`, `project_kernels`, `project_grid` and 11 more. -//! Defines `ProjectPlan`, `ProjectHandles`. +//! Grouped projection of OriginalMmqLayer: plans the gate/up and down launches (kernels, stream-k grid, fixup), +//! builds their arguments, runs the group (projection, SwiGLU, hidden quantize) and arbitrates finite status. use super::{ BOUNDS, D, Error, FiniteScan, GU, H, HQ, IDENTITY, Layout, MmqFormat, OriginalGroupBank, OriginalMmqLayer, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs index b144167c..dac87960 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqLayer`: `stage_raw`, `stage_slots`, `raw_amount`, `check_raw_handles` and 4 more. -//! Split out of `original_mmq_layer` to keep its files under the line limit. +//! Expert staging into OriginalMmqLayer: picks the next gate/up and down slots, proves raw sources disjoint, and +//! stages an expert from retained registered slices or from a completed prompt-cache prefix. use super::{ Error, MmqFormat, OriginalGroupBank, OriginalMmqLayer, QueuedCommand, Result, WD, WG, commands, ffi, kind, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs index 5a3d5ef0..be1e5b69 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqOutput`: `copy_group_down_to_prompt`, `check_arena_destination`, `copy_expert_down_columns... -//! Methods of `OriginalMmqLayer`: `group_down_spans`, `down_column_handles`, `check_down_destination`, `reject_down_... +//! Output side of an original grouped MMQ layer: copies the finite Down group, or single expert columns, into the +//! prompt Dm arena or Down slots, after proving shapes, owners, extents and non-overlap. use super::{ Context, D, DeviceBuffer, Error, OriginalGroupBank, OriginalMmqLayer, OriginalMmqOutput, Result, combine, ffi, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs index 49a97474..37ebc1c6 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs @@ -1,5 +1,5 @@ -//! Methods of `Producer`: `rejects_context`, `rejects_state`, `check_spans`, `check_formats` and 5 more. -//! Implements `OriginalStreamAllGroupProducer for Producer`. +//! Gather and project steps of the stream-all group Producer: validates the prompt rows, formats and member +//! spans, gathers one expert into the group bank and enqueues its projection, refusing aliased buffers. use super::{ BOUNDS, Command, Context, D, Error, FORMATS, GU, H, HQ, IDENTITY, OriginalGpuStream, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs index 4bdc3c6c..5221fb7a 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMmqLayer`: `enqueue_global_group`, `enqueue_zeroes`, `enqueue_hidden_checks`, `enqueue_hidden... -//! Split out of `stream_all_mmq` to keep its files under the line limit. +//! Stream-all execution on OriginalMmqLayer: enqueues the per-group zeroing, gate/up, SwiGLU, hidden quantize and +//! down launches with finite scans, then drains the stream and arbitrates the four status words per group. use super::{ Command, D, Error, GU, H, HQ, MmqFormat, OriginalGpuStream, OriginalGroupBank, OriginalMmqLayer, diff --git a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs index bb1ec6a8..7dc5306b 100644 --- a/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs @@ -1,5 +1,5 @@ -//! Methods of `Transport`: `new`, `reserve_host`, `check_host_budget`, `check_device_budget` and 5 more. -//! Implements `Drop for Transport`, `Drop for Producer`. +//! Transport of the stream-all producer: the command list, flag and status buffers, host and device budget checks, +//! enqueue onto the GPU stream and copy-back of statuses; Drop of Transport and Producer release them. use super::{ Api, COMMAND_CAP, Command, Context, DeviceBuffer, Error, OriginalGpuStream, Producer, Result, Transport, combine, diff --git a/crates/cuda-driver/src/mmq/tile.rs b/crates/cuda-driver/src/mmq/tile.rs index fe4e2c01..bdbc9d3d 100644 --- a/crates/cuda-driver/src/mmq/tile.rs +++ b/crates/cuda-driver/src/mmq/tile.rs @@ -1,5 +1,5 @@ -//! Methods of `Tile`: `width`, `index`, `original`. -//! Methods of `MmqFormat`: `index`, `entry`, `fixup_entry`, `geometry` and 2 more. +//! Tile widths (J8..J64) and MmqFormat tables of the MMQ path: the original mul_mat_q and stream-k fixup kernel +//! entry symbols per format and tile, format geometry, and the (adaptive) Layout of a projection for a token count. use super::{CStr, Error, Layout, MmqFormat, MmqProfile, Result, Tile}; diff --git a/crates/cuda-driver/src/mmq_original_host_stage/tests.rs b/crates/cuda-driver/src/mmq_original_host_stage/tests.rs index a2fd99e4..fe1c4ac9 100644 --- a/crates/cuda-driver/src/mmq_original_host_stage/tests.rs +++ b/crates/cuda-driver/src/mmq_original_host_stage/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the original host stage: the FP16 block-scale finite rule per routed format, and the helper-thread +//! protocol (wait refuses over-long reads, finish cancels waiters and leaves no helper copying from a released bank). use super::*; #[test] diff --git a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs index 96f7c8e6..a87724b5 100644 --- a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs @@ -1,5 +1,5 @@ -//! Methods of `GuRig`: `new`, `finish`. Methods of `ScalarBuffers`: `new`, `release`, `column`, `down_columns`. -//! Functions: `scalar_products`, `input_unchanged`, `close_owners`, `release_inputs` and 2 more. +//! Numeric run of the grouped gate/up GPU proof: computes every original scalar product first, then the grouped +//! products from the same device owners, repeats with sentinel outputs, and compares them byte for byte. use super::{ Comparison, Context, DeviceBuffer, DownColumns, ProjectionKind, ProjectionSpec, Result, RoutedFormat, diff --git a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs index 87588edb..66bd767d 100644 --- a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs @@ -1,5 +1,5 @@ -//! Methods of `GuardRig`: `new`, `shape_refusals`, `short_refusals`, `foreign_refusal` and 5 more. -//! Functions: `is_finite_words`, `budget_refusal`, `budget_run`, `guards`. Defines `GuardRig`. +//! Refusal checks of the grouped gate/up GPU proof: wrong shape, short or foreign buffers, malformed (NaN/Inf) +//! weights, bad activations and an exhausted table budget must fail without publishing a usable product. use super::{ Context, Device, DeviceBuffer, Error, Result, RoutedFormat, RoutedGateUpQ8, gu_weights, input, read, upload, diff --git a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs index abf613e5..e8f808af 100644 --- a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs @@ -1,5 +1,5 @@ -//! Methods of `GuRig`: `new`, `finish`. Methods of `ScalarBuffers`: `new`, `release`, `column`, `down_columns`. -//! Functions: `upload`, `read`, `gu_weights`, `down_weights` and 7 more. +//! Upload helpers and numeric run of the NC4 grouped gate/up GPU proof: builds deterministic weights and inputs, +//! computes every scalar product first, then compares the four-column grouped products including the T5 tail. use super::{ Comparison, Context, DeviceBuffer, DownColumns, ProjectionKind, ProjectionSpec, Result, RoutedFormat, diff --git a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs index 1d9fb169..fe994db4 100644 --- a/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs @@ -1,5 +1,5 @@ -//! Methods of `GuardRig`: `new`, `shape_refusals`, `short_refusals`, `foreign_refusal` and 7 more. -//! Functions: `is_finite_words`, `close_prepared`, `release_inputs`, `budget_refusal` and 2 more. Defines `GuardRig`. +//! Refusal checks of the NC4 grouped gate/up GPU proof: shape, short and foreign owners, malformed outputs, the +//! four-column tile plus live tail after fault and reset, and the 40-byte table budget refusal. use super::{ Context, Device, DeviceBuffer, Error, Result, RoutedFormat, RoutedGateUpQ8, gu_weights, input, read, upload, diff --git a/crates/cuda-driver/src/moe_prefill_batch/tests.rs b/crates/cuda-driver/src/moe_prefill_batch/tests.rs index fa9af278..db18998f 100644 --- a/crates/cuda-driver/src/moe_prefill_batch/tests.rs +++ b/crates/cuda-driver/src/moe_prefill_batch/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `moe_prefill_batch`. +//! Tests of the MoE prefill batch program: stage slot order and sizes, the fixed program order with combine as the +//! only tail, status arbitration, kernel table and route/combine map checks, binding refusals and the pinned artifact. use super::*; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs index 38b68978..ff7e7ca8 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `Arguments`: `metadata_bytes`, `new`. Methods of `Module`: `load`, `launch`, `copy`, `close`. -//! Split out of `abi` to keep its files under the line limit. +//! Kernel argument list (Arguments, with its metadata byte count) of the fixed-symbol MTP ABI, plus the Module stubs +//! that refuse with UnsupportedPlatform when the CUDA driver is not built in. use super::{Arg, Arguments, Error, Result, c_void}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs index 3c30b37d..32a05b41 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `MappedOwner`: `new`, `new_sized`, `new_for_state`, `new_inner` and 9 more. -//! Implements `Drop for Library`, `Drop for MappedOwner`. Functions: `check`, `host_alloc`. +//! MappedOwner of the MTP ABI: a host-allocated block mapped to a device address, zeroed on creation, with bounded +//! write, read and state-zero access. Loads the driver library symbols; Drop frees the block and the library. use super::{Error, HOST_BYTES, Result}; use std::ffi::c_void; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs index 28becec9..ff18bc5b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpInt8OwnerId`: `same_owner`. Methods of `Pages`: `empty`, `from_vec`, `with_tail`, `len` and 2 more. -//! Implements `Clone for MtpOriginalRingResources`. Functions: `snapshot_memo`. +//! Snapshot bookkeeping of the original MTP int8 KV: owner identity, the copy-on-write Pages list shared by +//! snapshots, snapshot size and position accessors, the completed replay rows, and the snapshot memo switch. use super::{ CompletedMtpAttention, CompletedMtpKvReplay, Context, DeviceBuffer, Error, MtpInt8OwnerId, MtpInt8Snapshot, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs index f70e3e2a..91af945b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `attend`, `check_attend`, `admit_query`, `addresses` and 6 more. -//! Split out of `mtp_original_int8_methods` to keep its files under the line limit. +//! Dense-window INT8 split-K attention of the original MTP ring: admits the query, enqueues the chunk reset, +//! split-K partials and merge launches with a finite check, and the close of the ring. use super::{ Arg, CHUNKS, Command, CompletedMtpAttention, Error, LaunchDims, MTP_ORIGINAL_WINDOW, MtpInt8Snapshot, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs index 7babde8b..e50d1836 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `record_kv_only`, `kv_only_admit`, `kv_only_stage`, `kv_only_run` and 13 more. -//! Split out of `mtp_original_int8_methods` to keep its files under the line limit. +//! KV-only replay of the original MTP int8 ring (record_forward(false) attention tail): quantize, K/V projections, +//! K norm, rope and the per-row int8 append, with finite guards, alias checks and the resulting snapshot. use super::{ Arg, Command, CompletedMtpKvReplay, DeviceBuffer, Error, LaunchDims, MtpInt8Snapshot, MtpOriginalInt8, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs index 8e5242a3..0a1f89ed 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `restore`, `begin_restore`, `restore_resident`, `write_host_pages` and 1 more. -//! Functions: `page_shared`. +//! Snapshot restore of the original MTP int8 ring: invalidates the current witness, writes the host pages the +//! previous witness lacked and rebuilds the modulo ring blocks on the device from the mapped pages. use super::{ Command, Error, HOST_OFFSETS, MtpInt8Snapshot, MtpOriginalInt8, NativeBatchWorkspace, PAGE_BYTES, Page, Rc, Result, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs index 2eb0cf78..d6b270c5 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `planned_device_bytes`, `pinned_host_bytes`, `max_snapshot_payload_bytes`, `max_sna... -//! Functions: `kv_assets_sealed`. +//! Bring-up of the original MTP int8 ring: byte budgets, the sealed PTX check, module loading, host mapping, +//! pool initialisation, and the retained physical resources and status queries of an open ring. use super::{ ATTN_ENTRIES, Cell, Context, DeviceBuffer, Error, KV_ENTRIES, MTP_ORIGINAL_PINNED_HOST_BYTES, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs index 36e9571f..de134a6b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `validate`, `provided`, `validate_pool`, `reject_earlier_overlap` and 12 more. -//! Split out of `mtp_original_int8_methods` to keep its files under the line limit. +//! Admission and execution of the original MTP int8 ring: pool and snapshot validation (overlap and mapped-alias +//! checks), launching command lists on the model stream, and settling their completion or poisoning. use super::{ Arg, Arguments, Command, DeviceBuffer, Error, LaunchDims, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_PINNED_HOST_BYTES, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs index 10780a41..602f0cde 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpOriginalInt8`: `new_original_state`, `bring_up_state`, `load_state_modules`, `adopt_selected` and ... -//! Implements `Drop for MtpOriginalInt8`. Functions: `original_state_sealed`. +//! State adoption of MtpOriginalInt8: seals and loads the state modules, binds the selected ring state or allocates +//! the extra pools, and exposes host addresses and encoded pages; Drop of MtpOriginalInt8 lives here too. use super::{ ATTN_ENTRIES, Context, DeviceBuffer, Error, HOST_OFFSETS, HOST_RUNS, KV_ENTRIES, MappedOwner, Module, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs index 573a484a..0ac34ee7 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs @@ -1,5 +1,5 @@ -//! Methods of `PhysicalRing`: `validate_context`, `unavailable`, `close_inner`, `close_modules` and 1 more. -//! Methods of `Context`: `mtp_original_int8`. Implements `Drop for PhysicalRing`. +//! Physical storage of the original MTP int8 ring: context validation, ordered close of modules and host mapping, +//! the pool layout and row-range checks, and the Context::mtp_original_int8 entry point; Drop of PhysicalRing. use super::{ Context, DeviceBuffer, Error, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_WINDOW, MtpOriginalInt8, PhysicalRing, Result, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs index 445c70ac..48e31e41 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs @@ -1,5 +1,5 @@ -//! Methods of `CompletedDraftKv`: `validate_current`, `first_materialized`, `next_position`, `owner_id` and 3 more. -//! Methods of `OriginalMtpEmbedding`: `native`, `compressed`, `vocab`. +//! Accessors of CompletedDraftKv (the finished draft KV of a prefill: snapshots at a position or window, validity +//! against the ring), the native and compressed MTP embedding table layouts, and the original int8 DraftKvPolicy. use super::{ CompletedDraftKv, CompressedEmbedding, DeviceBuffer, DraftKvPolicy, EmbeddingKind, Error, MtpInt8OwnerId, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs index 4c140c96..b4a3866b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `block_commands`, `kernel_commands`, `original_mtp_prefill_close` and 4 more. -//! Split out of `prefill` to keep its files under the line limit. +//! Root of the MTP prefill recorder: declares the submodules that record block, kernel and projection commands, +//! walk the operands, run and settle the command list, and close the prefill. use super::{ A, Args, BufferHandle, Cmd, CompletedDraftKv, Context, DeviceBuffer, DraftKvFallback, DraftKvOutcome, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs index a18fdaec..f9a11034 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `new`, `sealed_assets`, `open`, `load_modules` and 10 more. -//! Split out of `original_mtp_prefill` to keep its files under the line limit. +//! Bring-up and kernel-command plumbing of OriginalMtpPrefill: loads the five sealed PTX assets, allocates scratch and +//! status words, and offers the kernel/finite command builders plus the weight and scratch alias checks. use super::{ A, Args, BufferHandle, Cmd, Context, DeviceBuffer, ENTRIES, Error, FLAG_WORDS, KernelAt, KernelShape, Mod, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs index 0c5ad030..97bdbc10 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `close`, `close_inner`, `close_module`, `release_buffer`. -//! Split out of `original_mtp_prefill` to keep its files under the line limit. +//! Close of OriginalMtpPrefill: unloads the kernel modules and releases the status and scratch buffers, keeping the +//! first error. use super::{Context, DeviceBuffer, Error, Mod, OriginalMtpPrefill, Result, combine}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs index 8ef557dd..7c88bd82 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `project`, `project_launch`, `project_tile`, `project_grid` and 6 more. -//! Split out of `original_mtp_prefill` to keep its files under the line limit. +//! Projection command builder of OriginalMtpPrefill: picks the tile width and stream-k grid, quantizes and scans the +//! activations, and enqueues the projection kernel and, when needed, the fixup kernel. use super::{ A, Cmd, Error, KernelAt, KernelShape, OriginalMtpPrefill, ProjectionAddresses, ProjectionDims, Region, Result, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs index eb941c7d..f57d94bd 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `record`, `record_call`, `admit`, `fallback_for` and 16 more. -//! Functions: `weight_refs`. +//! Entry point of the original MTP prefill: records the draft KV of a row range into the draft ring, admitting the +//! call, staging weights with disjointness proofs, walking the blocks, and reading back the changed pages. use super::{ Admit, AppendBlock, Block, BufferHandle, Call, CompletedDraftKv, DeviceBuffer, DraftKvFallback, DraftKvOutcome, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs index 006662cb..eeb6b2ac 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefill`: `run`, `checked_status`, `mark_run_failed`, `run_error` and 4 more. -//! Methods of `RunJob`: `new`. Functions: `status_word`. Defines `StatusRead`, `RunJob`, `Settled`. +//! Executes one recorded MTP prefill command list on the device and settles it: uploads staging data, launches every +//! kernel/copy/GEMM, waits on stream and device, reads back the status words and poisons the prefill on failure. use super::{ BufferHandle, Cmd, Error, FLAG_WORDS, NativeBatchWorkspace, OriginalMtpPrefill, OriginalPromptRows, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs index c68af9d7..79eb84cc 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalMtpPrefill`. -//! Split out of `prefill` to keep its files under the line limit. +//! Drop of OriginalMtpPrefill: closes the prefill (releasing its device buffers and modules) on a best-effort basis. use super::OriginalMtpPrefill; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs index 6d43ef26..b8b9297c 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs @@ -1,5 +1,5 @@ -//! Methods of `Region`: `new`, `per_row`, `widths`, `handle` and 1 more. Methods of `Context`: `original_mtp_prefill`. -//! Split out of `prefill` to keep its files under the line limit. +//! The scratch Region of the MTP prefill: carves one device buffer into 20 aligned per-row roles for a row batch +//! and hands out bounds-checked sub-handles; also the Context entry point original_mtp_prefill. use super::{BufferHandle, Context, Error, OriginalMtpPrefill, Region, Result, aligned, q8_bytes}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs index 0cd399b1..b0006624 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs @@ -1,5 +1,4 @@ -//! Methods of `Context`: `original_mtp_full_forward`. -//! Split out of `full_forward` to keep its files under the line limit. +//! Context entry point original_mtp_full_forward: builds the full-forward MTP drafter program from retained weights. use super::{Context, OriginalMtpFullForward, OriginalMtpRetainedFullWeights, Rc, Result}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs index 61f5b759..7a724d1c 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_mtp_shared_layout`, `admit_layout_charge`, `original_mtp_shared_layout_device_byt... -//! Functions: `shared_layout_charge`, `layout_setup`, `ring_assets_sealed`. +//! Context constructors for the shared Original MTP layout: one device arena used by the scalar prefill and the +//! full forward, with its budget charge, admission and sealed-PTX checks; _with_ring also builds the ring state. use super::{ Context, Error, MtpOriginalInt8, OriginalLayoutSetup, OriginalMtpFullForward, OriginalMtpRetainedFullWeights, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs index 0943b1f4..f6ff6031 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs @@ -1,5 +1,5 @@ -//! Methods of `CompletedOriginalMtpDraft`: `ids`, `probabilities`, `count`, `final_snapshot` and 4 more. -//! Split out of `full_drafter` to keep its files under the line limit. +//! Read accessors of a finished MTP draft (ids, probabilities, count, positions, snapshot) and the check that it is +//! still the current snapshot of the ring it was drafted on. use super::{CompletedOriginalMtpDraft, Error, MtpInt8Snapshot, MtpOriginalInt8, Rc, Result}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs index 6155f154..beb8adf7 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `original_mtp_drafter_chain_gate`, `original_mtp_drafter_finish_chain`, `original_mtp_draft... -//! Split out of `full_drafter` to keep its files under the line limit. +//! Root of OriginalMtpDrafter: declares its submodules (construction, round launch, chain finishing, pipelined chain, +//! chain gate, keep-bank) and holds their shared imports. use super::{ AcceptedWindow, AdmittedRound, CompletedOriginalMtpDraft, Context, DirectVerifierRows, DraftKvOutcome, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs index 2f82f982..fa8502cb 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDrafter`: `finish_inner`, `finish_chain`, `fail_if_poisoned`, `finish_first_step` and 10 m... -//! Functions: `chain_key`. Defines `ChainPlan`, `ChainStepAt`, `ChainGraphs`. +//! Finishing half of an MTP draft: reads back the first round graph, runs the chain steps that follow while the host +//! works, closes the ring mutation, and releases verifier bindings, records the scalar prefill and closes the drafter. use super::{ CompletedOriginalMtpDraft, Context, DraftKvOutcome, Error, InFlightDraft, MTP_ORIGINAL_MAX_CELLS, MtpInt8Snapshot, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs index 55f8fbd0..23017647 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDrafter`: `launch_inner`, `launch_prepare`, `launch_record`, `launch_enqueue` and 9 more. -//! Split out of `original_mtp_drafter` to keep its files under the line limit. +//! Launching half of an MTP draft: admits the request against the ring and prior state, stages the first residual, +//! records the round graph once and enqueues it on the draft stream; launch_inner leaves the draft in flight. use super::{ AcceptedWindow, AdmittedRound, Context, DirectVerifierRows, DraftRoundRequest, DraftSampling, DraftTarget, Error, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs index 184dd67c..98d9540f 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDrafter`: `new`, `unregistered`, `validate_context`, `metadata_bytes` and 3 more. -//! Split out of `original_mtp_drafter` to keep its files under the line limit. +//! Construction and validation of OriginalMtpDrafter from a full forward plus a scalar prefill, and the blocking +//! draft and draft_first entry points that launch and finish a draft in one call. use super::{ AcceptedWindow, CompletedOriginalMtpDraft, Context, DraftRoundRequest, DraftSampling, DraftTarget, Error, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs index 02690c5b..798aa020 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullPolicy`: `for_capture`, `capture_key`, `validate_selected`. -//! Methods of `OriginalMtpDrafter`: `draft_inner`, `launch_from_verifier`, `finish_from_verifier`, `draft_in_flight`... +//! The verifier-coupled drafting API: launch, finish and draft_from_verifier over the verifier window, with Drop +//! of the drafter and the capture-key and validation rules of OriginalMtpFullPolicy that key the cached round graphs. use super::{ AcceptedWindow, CompletedOriginalMtpDraft, DraftKvPolicy, DraftRoundRequest, DraftSampling, DraftTarget, Error, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs index b5e5214d..539e403e 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDrafter`: `loaded_max_t`, `loaded_coupled`, `idle_public`, `plan_public_prefill` and 12 more. -//! Functions: `resume_copies`, `fill_public_records`. +//! Public (crate-level) lifecycle of a loaded OriginalMtpDrafter: idle, public prefill planning, KV resume copies +//! from the host pools, and the array-based draft_public / draft_first_public adapters over the graph executor. use super::{ CompletedOriginalMtpDraft, DraftSettings, Error, FM, HOST_OFFSETS, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_WINDOW, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs index c80d797b..0896da56 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpPrefillPlan`: `residual`, `tokens`, `bulk_records`, `metadata_bytes` and 3 more. -//! Methods of `OriginalMtpPrefillActions`: `group_action`, `bulk_action`, `mapped_action`. +//! The public prefill plan of the MTP drafter: read access to its residual, tokens and bulk records, the per-row +//! step words, and OriginalMtpPrefillActions, the iterator that yields the device actions in order. use super::{ Error, MTP_ORIGINAL_MAX_CELLS, MtpOriginalInt8, OriginalDeviceResidual, OriginalMtpPrefillAction, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs index b610acc8..0d9f0ccc 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs @@ -1,5 +1,4 @@ -//! Methods of `OriginalMtpDrafter`: `copy_public_draft_output`. -//! Split out of `round_lifecycle` to keep its files under the line limit. +//! Copies a completed draft into the caller public arrays (ids and optional probabilities), zeroing the unused tail. use super::{CompletedOriginalMtpDraft, Error, OriginalMtpDrafter, Result}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs index 77e310db..564de4d5 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `full_forward_program_alias_checks`, `original_mtp_full_forward`. -//! Split out of `full_forward` to keep its files under the line limit. +//! Root of the full-forward program builder: separates the alias-checking program assembly from the prefix command +//! recording, and holds their shared imports. use super::{ Arg, Arguments, BufferHandle, Context, DeviceBuffer, DraftKvPolicy, EmbeddingKind, Error, F, FA, ForwardPrefix, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs index 5c7f5e27..b5fc131b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `program`, `program_commands`, `program_addrs`, `program_prefix` and 10 more. -//! Split out of `full_forward_prefix_program` to keep its files under the line limit. +//! Builds the OriginalMtpForwardProgram of one draft step (prefix, tail commands, addresses, owners) and refuses any +//! device buffer of the full-forward scratch that aliases a weight, scalar or ring buffer it must not overlap. use super::super::mtp_original_check_batch_program::{CheckBatchModules, merge_prefix, merge_tail}; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs index 97e12e07..5cfc4199 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `prefix_commands`. -//! Split out of `full_forward_prefix_program` to keep its files under the line limit. +//! Builds the full=true T1 prefix command list of the draft step from the retained model roles; it only records +//! commands and launches nothing. Its row, part and embedding helpers are the prefix_parts and prefix_rows submodules. use super::{ Arg, BufferHandle, DeviceBuffer, DraftKvPolicy, EmbeddingKind, Error, LaunchShape, MTP_ORIGINAL_MAX_CELLS, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs index 7ab839ac..f4594285 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs @@ -1,5 +1,5 @@ -//! Methods of `FullOwned`: `validate`, `validate_original`, `handle`, `original_handle` and 12 more. -//! Implements `Drop for FullOwned`. Functions: `extra_slot`. +//! Resource ownership of FullOwned, the scratch bank of the full forward: validation, role handles and addresses +//! inside the shared or private arena, ordered close of modules, mapped memory, scratch and extra banks, and Drop. use super::{ BufferHandle, CHUNKS, Context, DeviceBuffer, Error, FM, FullOwned, MtpOriginalInt8, OriginalMtpScalarPrefill, Rc, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs index de25e0c4..d52a37e3 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpDraftProgram`: `enqueue_commands`, `capture`, `capture_all`, `capture_catchup` and 17 more. -//! Split out of `full_round` to keep its files under the line limit. +//! Capture and per-round staging of OriginalMtpDraftProgram: replays the coupled stage, catch-up, forward program and +//! post commands into a graph, stages each round or chain step into the mapped records, and reads the step output back. use super::super::mtp_original_check_batch_program::launch_prefix_command; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs index aadb7817..7b449ad6 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs @@ -1,5 +1,5 @@ -//! Functions: `post_select`. -//! Split out of `full_round` to keep its files under the line limit. +//! Builds the post-step selection command: wires the residual rows, token ids, row index and mapped readback +//! addresses of a draft step into the selection kernel launch that records the draft token and probability. use super::{ Error, FullCommand, OriginalMtpForwardProgram, Result, SelectionReadback, SelectionSource, SelectionTarget, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs index 293ca488..fc568fb8 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `stage_first_residual`, `check_staging_window`, `check_first_repeat`, `insta... -//! Methods of `OriginalMtpDraftProgram`: `uses_direct_verifier_window`. +//! Staging of the first-round residual and verifier window for the MTP draft program: writes the mapped cell records, +//! repeats or direct-copies the completed residual rows (cross-stream fence) and rebinds a round to the verifier bank. use super::{ DirectVerifierRows, Error, F, LaunchShape, MTP_ORIGINAL_MAX_CELLS, MtpOriginalInt8, NativeHeadSelection, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs index ad7abda5..e60b6b83 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs @@ -1,5 +1,5 @@ -//! Methods of `StagedSource`: `validate`. -//! Methods of `FullOwned`: `mapped_window_offset`, `validate_staged`, `validate_staged_ahead`. +//! Round and chain-step preparation of the MTP draft program (prepare_round, prepare_step, prepare_chain_step): the +//! before/after command lists, the selection kernel launch, staged-source validation and the graph-resource impl. use super::super::mtp_original_check_batch_program::merge_prefix; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs index 4cce1d9e..dbe51f17 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs @@ -1,5 +1,5 @@ -//! Defines `MatVecBuffers`, `MatVecShape`. -//! Split out of `full_forward` to keep its files under the line limit. +//! Root of the matrix-vector planning helpers of the full forward: the MatVecBuffers and MatVecShape descriptors +//! shared by the final-GR, finite-tail and MoE block planners in its submodules. use super::{ CHUNKS, DeviceBuffer, DraftKvPolicy, Error, F, ForwardPrefix, FullCommand, LaunchShape, NativeHeadDispatch, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs index bdd5e3b7..2f7d2168 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `gr_weight`, `final_gr`, `final_gr_native`, `final_gr_native_tail` and 4 more. -//! Split out of `matrix_vector_buffers_and_shape` to keep its files under the line limit. +//! Command recording for the final GR block of the MTP draft step: the native fused path, or the staged path of +//! norm, 320-column projection, 1280-column projection and 4-way reduction kernels. use super::{ Error, F, ForwardPrefix, FullCommand, LaunchShape, MatVecBuffers, MatVecShape, OriginalMtpFullForward, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs index e63ab63a..8b90b795 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `finite_tail`, `q8_tail`, `quant`, `mmvq` and 3 more. -//! Functions: `second_mlp_entry`. +//! Small command builders of the draft step tail: finiteness and Q8 flag checks, input quantization, the +//! quantized and float matrix-vector launches, and the fused MLP GR kernel launch with its 114 by-value words. use super::{ Error, F, ForwardPrefix, FullCommand, LaunchShape, MatVecBuffers, MatVecShape, NativeHeadDispatch, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs index 76af732b..45596309 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `plan`, `validate_plan`, `slot`, `slots` and 11 more. Defines `PlanBufs`. -//! `plan` records the commands of one draft step in the order of the former single function; the attention block is ... +//! Plans the commands of one draft step of OriginalMtpFullForward in the order of the former single function: +//! validation, then the attention block (Q, RoPE, windowed attention, gate, residual); MoE and tail are a sibling. use super::{ CHUNKS, DraftKvPolicy, Error, F, ForwardPrefix, FullCommand, LaunchShape, MatVecBuffers, MatVecShape, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs index fee41622..87186b95 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpForwardProgram`: `capture`, `capture_prefix`, `capture_coupled_stage`, `capture_flag_reset... -//! Functions: `history_bytes`. +//! Capture and post-drain checks of OriginalMtpForwardProgram: replays the prefix, coupled stage, flag reset and tail +//! commands into a graph, then validates the status flags, reads the step output and stages coupled sampler state. use super::mtp_original_check_batch_program::{ CheckBatchModules, is_tail_batch, launch_prefix_command, launch_tail_batch, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs index 810646c2..92c2f637 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs @@ -1,5 +1,4 @@ -//! Implements `Sealed for OriginalMtpForwardProgram`, `OriginalGraphResources for OriginalMtpForwardProgram`. -//! Split out of `full_forward` to keep its files under the line limit. +//! Marks OriginalMtpForwardProgram as a graph resource: validates its context, tail, ring, buffers and mapped owner. use super::{Context, Error, OriginalGraphResources, OriginalMtpForwardProgram, Result, checked}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs index bfa3cf2c..a41a8a78 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpFullForward`: `planned_device_bytes`, `new`, `new_internal`, `allocated_bytes` and 4 more. -//! Split out of `full_forward` to keep its files under the line limit. +//! Construction and lifecycle of OriginalMtpFullForward, the tail (head, sampler) half of the MTP draft: device-byte +//! planning, new (private or shared Original layout), size accounting, context validation and close. use super::mtp_original_full_init::FullGeometry; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs index 31f2dc11..fd6ce05f 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpRetainedPrefix`: `from_scalar`, `native`, `validate_context`, `check_roles` and 1 more. -//! Methods of `OriginalMtpRetainedFullWeights`: `retain`, `validate_context`, `metadata_bytes`, `head_rows` and 2 more. +//! Retained model weights of the MTP draft: the prefix roles and embedding (OriginalMtpRetainedPrefix) and the full +//! set with draft head and optional vocab subset (OriginalMtpRetainedFullWeights), with extent and disjointness checks. use super::{ BufferHandle, Context, DeviceBuffer, Error, FULL_EXTENTS, FullForwardHead, OriginalMtpNativeEmbedding, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs index c9451841..4197eb45 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpSessionPlan`: `from_primary`, `sized`, `max_cells`, `experts_per_token` and 11 more. -//! Split out of `session_coupling` to keep its files under the line limit. +//! OriginalMtpSessionPlan: the pure geometry of the MTP session (ring cells, attention capacity, page counts, rope and +//! canonical host bytes) computed from the primary shape, plus its read accessors; allocates nothing. use super::{Error, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_WINDOW, OriginalMtpSessionPlan, Result}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs index 99f994c9..87a8acb5 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpSessionResources`: `retain_primary`, `check_primary`, `check_plan`, `check_tables` and 14 ... -//! Methods of `SessionOwned`: `check_live`, `validate`. Functions: `session_native_asset`, `session_legacy_asset`. +//! Session resources of the MTP drafter shared with SessionState: retains and validates the rope tables and module, +//! builds the rope plan (addresses, aliasing checks, kernel arguments), and loads the sealed session assets. use super::{ BufferHandle, Cell, Context, DeviceBuffer, Error, F, FA, FM, OriginalMtpRopeForm, OriginalMtpSessionPlan, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs index 298fc04f..bd93496b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpSessionRopePlan`: `capture`. -//! Implements `Drop for SessionOwned`, `Sealed for OriginalMtpSessionRopePlan` and 1 more. +//! Teardown and graph capture of the session rope: Drop of SessionOwned (module close, leak on poison), and the capture +//! of OriginalMtpSessionRopePlan into a graph, with the sealed-asset probe. use super::{ Context, Error, LaunchShape, OriginalCapture, OriginalGraphResources, OriginalMtpRopeForm, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs index cab1ee37..affd9eb9 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs @@ -1,5 +1,5 @@ -//! Items of the parent module. -//! Split out of `symbols` to keep its files under the line limit. +//! The ASSETS table of the MTP full forward: each sealed PTX image of the crate with the kernel entry names it exports, +//! indexed by the asset constants (the chain and sm120 daily modules sit last, loaded only when selected). use super::CStr; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs index 9c9d9896..42a5c788 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs @@ -1,5 +1,4 @@ -//! Items of the parent module. -//! CHAIN_ASSET, DAILY_ASSET, DAILY_CHUNK, DAILY_MERGE_V2, CHAIN_QSA_CHUNK, CHAIN_QSA_MERGE_N .... +//! Indices of the chain and sm120 daily modules in ASSETS and of their kernel entries (chunk, merge, sampler). /// Index of the chain module in `ASSETS` (absent from the loaded modules unless `LELEKA_CHAIN` selects `mtp` or /// `head`). diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs index 523ca586..f7ef4a66 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_scalar_prefix`, `push`, `daily_mtp`, `chain_mtp_assets` and 2 more. -//! Split out of `full_forward` to keep its files under the line limit. +//! Shared helpers of the draft step builders: validation of the scalar prefix owner, the command-push helper, and the +//! switches that select the sm120 daily or chain attention assets and the fixed kernel entries. use super::{ Error, F, FA, FullCommand, LaunchShape, OriginalGpuStream, OriginalMtpScalarPrefill, Result, SCALAR_FLAGS, checked, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs index 69b48cb1..37e3db2b 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs @@ -1,5 +1,5 @@ -//! Methods of `Scratch`: `new`. Methods of `Context`: `original_mtp_scalar_prefill`. -//! Implements `Sealed for GraphResources`, `OriginalGraphResources for GraphResources`. +//! GraphResources of the scalar prefill as a graph resource (context, ring, weights, buffer and mapped checks), plus +//! the Scratch layout of per-token buffer sizes and offsets, and the Context entry point original_mtp_scalar_prefill. use super::{ Context, Error, GraphResources, OriginalGraphResources, OriginalMtpScalarPrefill, Result, Scratch, aligned, checked, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs index 637539f6..9eb3106c 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `call_admission`, `group_capture`, `group_loop` and 5 more. -//! Split out of `scalar` to keep its files under the line limit. +//! Root of the scalar MTP prefill: declares the submodules for call admission, group capture and loop, kernel commands, +//! operands, GR recording, construction and close, and holds their shared imports. use super::{ Arg, Arguments, BufferHandle, Context, DeviceBuffer, DraftKvOutcome, ENTRIES, EmbeddingKind, Error, GR_ENTRIES, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs index ff8dede1..6c75e862 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpScalarPrefill`: `assets_ready`, `planned_device_bytes`, `planned_host_bytes`, `host_metada... -//! Split out of `original_mtp_scalar_prefill` to keep its files under the line limit. +//! Construction of OriginalMtpScalarPrefill: byte planning, shape and sealed-asset admission against the budget, then +//! allocation of scratch, records, status, stream, modules and mapped memory (private or shared layout). use super::{ Context, ENTRIES, Error, GR_ENTRIES, KV_ENTRIES, MAX_PROMPT, MTP_ORIGINAL_MAX_CELLS, Module, OriginalGraphRegistry, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs index 3216a2e3..54bf87ce 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpScalarPrefill`: `close`, `close_inner`, `finish_host`, `close_stream` and 3 more. -//! Split out of `original_mtp_scalar_prefill` to keep its files under the line limit. +//! Ordered teardown of OriginalMtpScalarPrefill: closes graphs, stream, modules, device buffers and mapped memory, +//! poisoning the context and leaking resources the device may still touch when a step fails. use super::{Context, DeviceBuffer, Error, Module, OriginalGpuStream, OriginalMtpScalarPrefill, Rc, Result, combine}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs index 912b0361..cf20cab6 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpScalarPrefill`: `gr`, `gr_chunks`, `gr_chunk_kernel`, `record` and 1 more. -//! Split out of `original_mtp_scalar_prefill` to keep its files under the line limit. +//! Records the GR kernels of the scalar prefill (norm, chunked projection, reduction) per prompt rows, and the public +//! record entry that adds the draft K/V of the rows and drains any pending graphs. use super::{ BufferHandle, DraftKvOutcome, GrRows, LaunchShape, NativeBatchWorkspace, OriginalDeviceResidual, diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs index 4559d79b..96f79a41 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalMtpScalarPrefill`. -//! Split out of `scalar` to keep its files under the line limit. +//! Drop of OriginalMtpScalarPrefill: closes the prefill (releasing device buffers, modules and stream) best-effort. use super::OriginalMtpScalarPrefill; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs index 59395bad..9e03ea5f 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs @@ -1,5 +1,5 @@ -//! Methods of `StateLayout`: `new`, `region_sizes`. Functions: `a16`. -//! Split out of `ring_state` to keep its files under the line limit. +//! Layout of the Original ring state buffer: StateLayout sizes and offsets the 12 regions (resident or windowed) +//! for a draft width, with the 16-byte alignment helper a16 and the total byte size. use super::{Error, MTP_ORIGINAL_MAX_CELLS, MTP_ORIGINAL_WINDOW, Result, StateLayout}; diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs index 1e2580f7..b2cb78ce 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs @@ -1,5 +1,5 @@ -//! Methods of `PreparedState`: `attempt`, `budgeted_layout`, `build`, `pin_hosts` and 6 more. -//! Implements `Drop for PreparedState`. Functions: `pin_failure`, `enter_poisoning`. +//! Preparation of the ring state (PreparedState): budgeted layout, device and pinned host allocation, identity table, +//! zeroing and rollback on failure; pin_failure tells pinned-allocation failures (which allow fallback) from others. use super::cleanup_fns::{close_mapped, release_state}; use super::{ diff --git a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs index 0b9ab227..cdceb6a3 100644 --- a/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs @@ -1,5 +1,5 @@ -//! Methods of `Selected`: `from_prepared`, `provides`, `span`, `locate` and 10 more. Implements `Drop for Selected`. -//! Functions: `main_span_index`. +//! Selected, the chosen state of the ring: the prepared state paired with the shared main-bank spans, with span lookup, +//! alias and overlap checks, page reads, transfer and close. use super::cleanup_fns::{close_mapped, release_state}; use super::{ diff --git a/crates/cuda-driver/src/mtp_original_full_ffi/tests.rs b/crates/cuda-driver/src/mtp_original_full_ffi/tests.rs index 7df6ca7a..1d0847b7 100644 --- a/crates/cuda-driver/src/mtp_original_full_ffi/tests.rs +++ b/crates/cuda-driver/src/mtp_original_full_ffi/tests.rs @@ -1,4 +1,4 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the q-split copy2d descriptor: it stays inside both tail owners for every T, device-to-device only. use super::*; /// `copy2d` hands the driver a raw descriptor of fixed extents; the two owners it names (`TailLayout` roles diff --git a/crates/cuda-driver/src/native_head/alias_tests.rs b/crates/cuda-driver/src/native_head/alias_tests.rs index 8e543328..98f9e10e 100644 --- a/crates/cuda-driver/src/native_head/alias_tests.rs +++ b/crates/cuda-driver/src/native_head/alias_tests.rs @@ -1,5 +1,5 @@ -//! Functions: `payload`, `map_payload`, `alias_over`, `read_through_the_first_alias` and 3 more. -//! Split out of `native_head` to keep its files under the line limit. +//! Tests that a device alias of a mapped host table reads the host bytes, costs no device memory, is not freed when +//! dropped, and works for both the mapped table and the native embed table. use super::*; diff --git a/crates/cuda-driver/src/native_head/dispatch.rs b/crates/cuda-driver/src/native_head/dispatch.rs index 54f498dd..16ef3a87 100644 --- a/crates/cuda-driver/src/native_head/dispatch.rs +++ b/crates/cuda-driver/src/native_head/dispatch.rs @@ -1,5 +1,5 @@ -//! Functions: `dispatch`, `head_launch_shape`, `iq_columns`, `kind_geometry` and 3 more. -//! Split out of `native_head` to keep its files under the line limit. +//! Kernel dispatch of the native head projection: from the weight kind, token count and dispatch options picks the +//! kernel name, grid and block shape of the plain or IQ head kernels (column counts, rows divisor, mode). use super::{Error, NativeHeadDispatch, Result}; pub(super) fn dispatch( diff --git a/crates/cuda-driver/src/native_head/head_owned.rs b/crates/cuda-driver/src/native_head/head_owned.rs index f141902c..f466fc6d 100644 --- a/crates/cuda-driver/src/native_head/head_owned.rs +++ b/crates/cuda-driver/src/native_head/head_owned.rs @@ -1,5 +1,5 @@ -//! Methods of `HeadOwned`: `validate`, `close`, `is_released`, `leak_all` and 4 more. -//! Methods of `Context`: `original_native_head`. Implements `Drop for HeadOwned`. +//! HeadOwned, the owner of the native head weights, scalar Q8 scratch and kernels: validation, upload, ordered release +//! or leak on an uncertain context, plus the Context entry point original_native_head and the OriginalNativeHead API. use super::{ Cell, Command, Context, DeviceBuffer, Error, HeadOwned, Kernels, NativeHeadDispatch, NativeHeadPayload, diff --git a/crates/cuda-driver/src/native_head/iq_entries_types.rs b/crates/cuda-driver/src/native_head/iq_entries_types.rs index 82758dcb..96bb69e5 100644 --- a/crates/cuda-driver/src/native_head/iq_entries_types.rs +++ b/crates/cuda-driver/src/native_head/iq_entries_types.rs @@ -1,5 +1,5 @@ -//! Defines `OriginalNativeHeadGraphResources`, `NativeHeadProjectionFlight`. -//! IQ_ENTRIES, SAMPLER_ENTRIES, OriginalNativeHeadGraphResources, NativeHeadProjectionFlight. +//! Kernel entry-name tables of the IQ head kernels and the samplers, the OriginalNativeHeadGraphResources trait that +//! exposes a verifier resource head bank, and the NativeHeadProjectionFlight state of an in-flight projection. use super::{ Command, DeviceBuffer, OriginalGpuStream, OriginalGraphResources, OriginalNativeHead, OriginalNativeHeadRows, diff --git a/crates/cuda-driver/src/native_head/native_asset.rs b/crates/cuda-driver/src/native_head/native_asset.rs index 5b99f1e2..890d0656 100644 --- a/crates/cuda-driver/src/native_head/native_asset.rs +++ b/crates/cuda-driver/src/native_head/native_asset.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeHeadDispatch`: `from_original_environment`. -//! Methods of `Kernels`: `load`, `load_modules`, `module`, `close`. Implements `Default for NativeHeadDispatch`. +//! Sealed PTX loading of the native head (pinned native, IQ and sampler images), the Kernels loader, supported kinds, +//! row sizes, geometry and admission checks, and the NativeHeadDispatch defaults with its environment switch. use super::{ Arg, Command, Context, DeviceBuffer, Error, IQ_ASSET_PIN, IQ_ENTRIES, Kernels, Module, NATIVE_ASSET_PIN, diff --git a/crates/cuda-driver/src/native_head/native_asset_pin_types.rs b/crates/cuda-driver/src/native_head/native_asset_pin_types.rs index fc73d156..0786a36e 100644 --- a/crates/cuda-driver/src/native_head/native_asset_pin_types.rs +++ b/crates/cuda-driver/src/native_head/native_asset_pin_types.rs @@ -1,5 +1,5 @@ -//! Defines `NativeHeadSampling`, `NativeHeadPayload`, `NativeHeadDispatch` and 11 more. -//! NATIVE_ASSET_PIN, IQ_ASSET_PIN, SAMPLER_ASSET_PIN, RESERVE, NativeHeadSampling, NativeHeadDispatch .... +//! Data types of the native head (sampling inputs, payload, dispatch options, kernels, owners, rows, flights, +//! selection) with the size and digest pins of the three sealed PTX assets and the device reserve. use super::{ Cell, Command, Context, DeviceBuffer, MappedAllocation, Module, OriginalGpuStream, Rc, RefCell, SamplerParams, diff --git a/crates/cuda-driver/src/native_head/native_entries_types.rs b/crates/cuda-driver/src/native_head/native_entries_types.rs index ecc08cbe..d8a4e4df 100644 --- a/crates/cuda-driver/src/native_head/native_entries_types.rs +++ b/crates/cuda-driver/src/native_head/native_entries_types.rs @@ -1,5 +1,4 @@ -//! Items of the parent module. -//! NATIVE_ENTRIES. +//! NATIVE_ENTRIES: kernel entry names of the native head PTX module, in module index order. pub(super) const NATIVE_ENTRIES: &[&str] = &[ "head_quant", diff --git a/crates/cuda-driver/src/native_head/original_native_embed.rs b/crates/cuda-driver/src/native_head/original_native_embed.rs index 2a3cce94..a4c59676 100644 --- a/crates/cuda-driver/src/native_head/original_native_embed.rs +++ b/crates/cuda-driver/src/native_head/original_native_embed.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalNativeEmbed`: `validate_context`, `kind`, `bytes`, `is_mapped` and 6 more. -//! Methods of `NativeEmbedFlight`: `wait`. +//! OriginalNativeEmbed, the native token embedding table: single-token gather, per-T row gathers for graphs +//! (OriginalNativeEmbedRows), a non-owning table alias, and the in-flight NativeEmbedFlight with close and drop. use super::{ Arg, Command, Context, DeviceBuffer, Error, NativeEmbedFlight, OriginalCapture, OriginalGpuStream, diff --git a/crates/cuda-driver/src/native_head/original_native_embed_rows_original_graph.rs b/crates/cuda-driver/src/native_head/original_native_embed_rows_original_graph.rs index ad400d94..e3eb5f0d 100644 --- a/crates/cuda-driver/src/native_head/original_native_embed_rows_original_graph.rs +++ b/crates/cuda-driver/src/native_head/original_native_embed_rows_original_graph.rs @@ -1,5 +1,4 @@ -//! Implements `OriginalGraphResources for OriginalNativeEmbedRows`. -//! Split out of `native_head` to keep its files under the line limit. +//! Marks OriginalNativeEmbedRows as a graph resource by delegating context validation to it. use super::{Context, OriginalGraphResources, OriginalNativeEmbedRows, Result}; diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows.rs b/crates/cuda-driver/src/native_head/original_native_head_rows.rs index 3fd3d754..72b6e5cb 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows.rs @@ -1,5 +1,4 @@ -//! Groups the submodules `original_native_head_rows_greedy_submit`, `original_native_head_rows_sampling`. -//! Split out of `native_head` to keep its files under the line limit. +//! Root of OriginalNativeHeadRows: declares the greedy/submit and sampling submodules and holds their shared imports. use super::{ Arg, Cell, Command, Context, DeviceBuffer, Error, HeadOwned, MappedAllocation, NativeHeadFlight, diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs b/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs index b752b2df..5e8a44b1 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_greedy_submit.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalNativeHeadRows`: `new`, `allocate_buffers`, `set_finite_verdict_in_graph`, `finite_verdict_in... -//! Functions: `sampling_needed`. +//! Construction and execution of OriginalNativeHeadRows (the per-T head of the verifier): buffer allocation, finite- +//! logit verdict word, projection and greedy command build, graph capture, stream submit and selection read-back. use super::{ Arg, Cell, Command, Context, DeviceBuffer, Error, HeadOwned, MappedAllocation, NativeHeadFlight, diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_sampling.rs b/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_sampling.rs index 302ef68b..344fb49e 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_sampling.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows/original_native_head_rows_sampling.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalNativeHeadRows`: `sample_commands`, `sample_args`, `history_shared_bytes`, `greedy_sample` an... -//! Defines `SampleArgs`. +//! Sampler launches of OriginalNativeHeadRows (greedy, one-block, split and merge kernels) with per-stream scratch +//! and penalty-history shared memory, plus completed-logits access and the ordered close or leak of the rows. use super::{ Arg, Command, DeviceBuffer, Error, NativeHeadSampling, OriginalNativeHeadRows, Result, SamplerParams, SamplerPath, diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows_drop_original_graph.rs b/crates/cuda-driver/src/native_head/original_native_head_rows_drop_original_graph.rs index 05449365..bd17b488 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows_drop_original_graph.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows_drop_original_graph.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeHeadFlight`: `finish`. -//! Methods of `NativeHeadSelection`: `ids`, `position`, `vocabulary`, `into_ids`. +//! Lifecycle of the head results: Drop and graph-resource impls of OriginalNativeHeadRows, NativeHeadFlight finish and +//! drop, NativeHeadSelection accessors, and EmbedOwned (the embedding table owner) with original_native_embed. use super::{ Cell, Context, DeviceBuffer, EmbedOwned, Error, IQ_ENTRIES, MappedAllocation, Module, NativeHeadFlight, diff --git a/crates/cuda-driver/src/native_head/original_native_head_rows_original_native.rs b/crates/cuda-driver/src/native_head/original_native_head_rows_original_native.rs index 8647add7..4fb26902 100644 --- a/crates/cuda-driver/src/native_head/original_native_head_rows_original_native.rs +++ b/crates/cuda-driver/src/native_head/original_native_head_rows_original_native.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeHeadProjectionFlight`: `wait`. -//! Implements `OriginalNativeHeadGraphResources for OriginalNativeHeadRows`, `Drop for NativeHeadProjectionFlight`. +//! Graph-resource access to the head rows (OriginalNativeHeadGraphResources), NativeHeadProjectionFlight wait/drop +//! that poison the head on a failed drain, and a probe of whether the three native head PTX assets are sealed. use super::{ NativeHeadProjectionFlight, OriginalNativeHeadGraphResources, OriginalNativeHeadRows, Result, iq_asset, diff --git a/crates/cuda-driver/src/native_head/projection_commands.rs b/crates/cuda-driver/src/native_head/projection_commands.rs index 5254da6d..af1a7f25 100644 --- a/crates/cuda-driver/src/native_head/projection_commands.rs +++ b/crates/cuda-driver/src/native_head/projection_commands.rs @@ -1,5 +1,5 @@ -//! Functions: `projection_commands`, `admit_projection`, `quant_command`, `head_command`. Defines `ProjectionBuffers`. -//! Split out of `native_head` to keep its files under the line limit. +//! Command list of one output-head projection: Q8 quantisation of the mixed hidden state, then the head matmul +//! to logits. Checks buffer sizes and pairwise disjointness first, so the dispatcher only sees admitted launches. use super::{ Arg, Command, DeviceBuffer, Error, HeadOwned, Result, address, admit, cmd, disjoint, dispatch, diff --git a/crates/cuda-driver/src/native_parity/native_parity_expert.rs b/crates/cuda-driver/src/native_parity/native_parity_expert.rs index 979cd24a..f674b0f0 100644 --- a/crates/cuda-driver/src/native_parity/native_parity_expert.rs +++ b/crates/cuda-driver/src/native_parity/native_parity_expert.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeParityExpert`: `diagnostics`, `release`, `release_inner`. -//! Methods of `Temporary`: `new`, `release`, `release_inner`. +//! Lifetime of one parity-harness expert: lazily allocated diagnostic buffers (dequant targets, reversed rows), +//! release/Drop that drain the stream and free every buffer, the blocking readback, and the gate/up/down kernel tables. use super::{ BenchResult, DeviceBuffer, Error, FF, H, NativeParityExpert, Rc, State, Temporary, bytes_i32, first, message, diff --git a/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_dequantize_diagnostics.rs b/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_dequantize_diagnostics.rs index 4ee5c541..88392b44 100644 --- a/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_dequantize_diagnostics.rs +++ b/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_dequantize_diagnostics.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeParity`: `dequantize_expert_role`, `read_dequantized`, `embed_expert_gate`, `release_expert` an... -//! Functions: `check_gate_rows`, `gate_embed_command`, `dequant_commands`, `q5_commands` and 1 more. +//! Diagnostic operations of the native parity harness: per-role expert dequantisation, gate embedding, the Q5_1 and +//! BF16 embedding checks, and expert release. They exist to compare device output with the Original, not to serve. use super::{ Arg, BenchResult, Command, DeviceBuffer, FF, H, NativeParity, NativeParityExpert, Rc, Temporary, address, diff --git a/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_expert_enqueue.rs b/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_expert_enqueue.rs index e8105ad5..b7ba0220 100644 --- a/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_expert_enqueue.rs +++ b/crates/cuda-driver/src/native_parity/native_parity_operations/native_parity_expert_enqueue.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeParity`: `new`, `idle`, `expert`, `old_kernels` and 9 more. -//! Functions: `expert_head_args`, `old_iq_mmvq`, `scratch_slots`, `gate_up_args` and 1 more. +//! Setup and run of one parity expert: harness construction (sealed PTX, stream, module), staging weights and routing, +//! launching the gate/up and down kernels (old or split IQ MMVQ variant) and reading the f32 result back. use super::{ Api, Arg, BenchResult, Cell, Command, Context, DeviceBuffer, H, Layout, NT, NativeParity, NativeParityExpert, Rc, diff --git a/crates/cuda-driver/src/native_parity/sealed_ptx.rs b/crates/cuda-driver/src/native_parity/sealed_ptx.rs index aece3cb8..3fe371b3 100644 --- a/crates/cuda-driver/src/native_parity/sealed_ptx.rs +++ b/crates/cuda-driver/src/native_parity/sealed_ptx.rs @@ -1,5 +1,5 @@ -//! Functions: `sealed_ptx`, `message`, `first`, `native_parity_iq_supported` and 9 more. -//! Split out of `native_parity` to keep its files under the line limit. +//! Shared plumbing of the native parity harness: the pinned sealed PTX, error-to-message adapters, and the tables of +//! block-quantised formats the harness supports with their elements and bytes per block (row byte sizes). use super::{Arg, BenchResult, Command, DeviceBuffer, FF, H, Layout, Result, SEALED_PTX_PIN}; diff --git a/crates/cuda-driver/src/native_prompt_device/original_device_block.rs b/crates/cuda-driver/src/native_prompt_device/original_device_block.rs index dbeb7f9d..7e1bcbcd 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_device_block.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_device_block.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalDeviceBlock`: `lease_identity`. -//! Methods of `Context`: `original_prompt_device`, `original_ple_history`, `check_history_budget`. +//! Handles that carry prompt rows on the device between stages: the residual, the GR-read lease and the finished +//! block, with final-row readback and finite checks; plus Context entry points for the prompt device and PLE history. use super::{ Context, Error, GrNativeProfile, OriginalDeviceBlock, OriginalDeviceGrRead, OriginalDeviceResidual, diff --git a/crates/cuda-driver/src/native_prompt_device/original_ple_history.rs b/crates/cuda-driver/src/native_prompt_device/original_ple_history.rs index 39b9d909..1c216eee 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_ple_history.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_ple_history.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPleHistory`: `device`, `final_values`, `allocated_bytes`, `close` and 1 more. -//! Methods of `LaunchGeometry`: `new`. Implements `Drop for OriginalPleHistory`. +//! Device-resident PLE history buffer (read-back at commit, close/Drop) plus the small launch and guard value types +//! (LaunchGeometry, ScanExtent, PhaseGuards, WeightExtent) and kernel/scan helpers shared by the prompt-device phases. use super::{A, BufferHandle, C, DeviceBuffer, Error, KernelArguments, OriginalPleHistory, Result}; diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device.rs index 4241598c..4e47de4b 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `gr_read_phases`, `inject_phases`, `original_prompt_device_apply_ple` and 8 more. -//! Split out of `native_prompt_device` to keep its files under the line limit. +//! Parent module of the prompt device's phases: one child per phase (bring-up, initialize, GR read, inject, PLE, +//! close), each adding methods to OriginalPromptDevice, plus the phase command builders; shares their imports. use super::{ A, BufferHandle, C, Context, DeviceBuffer, Error, GR_ENTRIES, GR_PTX, GR_SHA, GrNativeProfile, GrNormRequest, diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs index eb269c85..594bd7a6 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `apply_ple`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! Applies PLE (per-layer embedding) to the prompt residual in sub-batches: builds each chunk's commands, runs them, +//! and marks the history failed if a chunk errors. The command lists themselves live in ple_apply_phases. use super::ple_apply_phases::ple_commands; use super::{ diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_bring_up.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_bring_up.rs index 5dd99b92..36c1dd94 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_bring_up.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `device_bytes`, `new`, `blank`, `init_resources` and 12 more. -//! Functions: `check_sealed_assets`. +//! Construction and validation of the prompt device: checks the pinned PLE/GR PTX, allocates status words, loads the +//! four kernel modules, and checks that leases, spans and weights are live, disjoint and sized before any phase runs. use super::{ BufferHandle, Context, DeviceBuffer, Error, GR_ENTRIES, GR_PTX, GR_SHA, GrNativeProfile, KernelModule, diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_close_modules.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_close_modules.rs index 43660c39..9b29339a 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_close_modules.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_close_modules.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `close_inner`. Functions: `poison_on_error`, `close_module`, `release_owner`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! Teardown of the prompt device: closes kernel modules and releases buffers under the context guard, leaking them +//! (and poisoning the context) when the context is already unusable, so a failed close cannot free live GPU memory. use super::{Context, DeviceBuffer, Error, KernelModule, OriginalPromptDevice, Result, combine}; diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs index 7c9c4ccb..07874b52 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `read_gr_impl`, `gr_read_plan`, `gr_read_spans`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! GR read phase of the prompt device: validates the epsilon and weights, builds the plan of spans and weight extents, +//! and runs it under the finite guards, turning a residual into a GR-read lease. use super::gr_read_phases::{GR_READ_NAMES, GR_READ_ORDER, GrReadPlan}; use super::{ diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs index 5e7021da..42d2dd77 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `initialize_rows`, `upload_initial`, `settle_upload`, `run`. -//! Functions: `stage_rows`. +//! Uploads the initial prompt rows (residual-stream and PLE embedding values) to the device in one staged pass, +//! and the shared run helper that executes a phase command list under finite guards and settles the result. use super::run_phases::RunBuffers; use super::{ diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs index 8334c9d3..448e8590 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `inject_gr`, `inject_gr_fused`, `close`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! GR injection phase: rechecks the finished block, then writes the GR output back into the residual rows, plain or +//! fused with the following RMS norm (inject_gr_fused), under the finite guards; also the explicit close. use super::inject_phases::{inject_commands, inject_fused_commands}; use super::{ diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_read_gr.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_read_gr.rs index 7fd1d414..6dca67ff 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_read_gr.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_read_gr.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalPromptDevice`: `read_gr`, `read_gr_normed`. -//! Split out of `original_prompt_device` to keep its files under the line limit. +//! Public entry points of the GR read phase for a plain residual and for an already normed one; they check the +//! gamma/epsilon pairing and delegate to read_gr_impl, which owns the plan and launch. use super::{ DeviceBuffer, Error, GrNormRequest, NativeBatchWorkspace, OriginalDeviceGrRead, OriginalDeviceNormedResidual, diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device_drop.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device_drop.rs index 04a3245c..bb09555f 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device_drop.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalPromptDevice`. -//! Split out of `native_prompt_device` to keep its files under the line limit. +//! Drop for OriginalPromptDevice: closes the device's modules and buffers if the owner did not call close. use super::OriginalPromptDevice; diff --git a/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs index eb0280d7..fbce4362 100644 --- a/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs +++ b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs @@ -1,5 +1,5 @@ -//! Defines `Rng`, `Launch`. -//! ENABLE, Rng, Launch. +//! Shared test types of the GR GPU proofs: the LELEKA_PREFILL_STAGE_GPU switch that enables them, the xorshift +//! random generator (Rng) that makes their inputs reproducible, and the Launch tuple describing one kernel launch. use super::{A, KernelModule}; diff --git a/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs index 14ee023f..60e95f96 100644 --- a/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs +++ b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`. Functions: `f32_bytes`, `upload`, `h`, `download` and 1 more. -//! Split out of `gr_gpu_tests` to keep its files under the line limit. +//! Test helpers of the GR GPU proofs: the xorshift step of Rng, f32 byte encoding, buffer upload/download wrappers, +//! and run_all, which launches kernels in order on the workspace stream and drains it. use super::{BufferHandle, Context, DeviceBuffer, KernelArguments, Launch, NativeBatchWorkspace, Rng}; use crate::ple_batch_ffi::LinearLaunch; diff --git a/crates/cuda-driver/src/original_conversation_state/tests.rs b/crates/cuda-driver/src/original_conversation_state/tests.rs index 772a91fe..809bd486 100644 --- a/crates/cuda-driver/src/original_conversation_state/tests.rs +++ b/crates/cuda-driver/src/original_conversation_state/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the conversation-state layout against the Original: running-state region sizes (golden C++ values), +//! the KV pool spans per state format and streaming mode, the draft KV staying outside the arena, and span bounds. use super::super::{OriginalLayerBounds, OriginalSessionGeometry, OriginalSessionKvPolicy, OriginalSessionLayout}; use super::*; diff --git a/crates/cuda-driver/src/original_expert_cache/original_cache_prefix.rs b/crates/cuda-driver/src/original_expert_cache/original_cache_prefix.rs index fb1f213b..96ba205e 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_cache_prefix.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_cache_prefix.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalCachePrefix`: `completed_slot_span`. -//! Methods of `Context`: `original_expert_cache_uniform`, `original_expert_cache_sized`. +//! Cache prefix view: finding the completed (Filled) slot span of one layer/expert, and the Context constructors that +//! open an expert cache with uniform slots or with per-slot sizes. use super::{Context, OriginalCachePrefix, OriginalExpertCache, OriginalExpertSlots, Result, State}; diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_drop.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_drop.rs index 63f2d2c2..4754d88b 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_drop.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalExpertCache`. -//! Split out of `original_expert_cache` to keep its files under the line limit. +//! Drop for OriginalExpertCache: closes the cache (drains copies, releases the arena) if the owner did not close it. use super::OriginalExpertCache; diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs index 81fe90a8..7864529b 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_adaptive_swaps.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertCache`: `arm_swaps`, `record_swap_event`, `swaps_pending`, `swap_copies_running` and 15... -//! Split out of `original_expert_cache_methods` to keep its files under the line limit. +//! Expert cache: the adaptive swap batch (arm event, poll/wait, publish swapped slots) and the queued fills from a +//! mapped bank or probe bytes, with admission checks, the copy stream choice and the liveness guard. use super::original_expert_cache_open_and_slots::{check_total, span_layer}; use super::{ diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_file_slot_fill.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_file_slot_fill.rs index 5e9dc6a8..b34dbf84 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_file_slot_fill.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_file_slot_fill.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertCache`: `fill_file_slot_queued`, `check_file_queue`, `digest_conflict`, `owner_mismatch... -//! Split out of `original_expert_cache_methods` to keep its files under the line limit. +//! Expert cache: fills of a slot from a file-backed expert blob, queued or blocking, with the source-digest and +//! owner checks, host-byte accounting of pending fills, read-back verification of a slot and the queue sync. use super::{ Error, MappedExpertBank, OriginalExpertCache, Rc, ResidentExpertBankSpan, Result, RetainedFill, State, api, diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs index c812c7bb..5167ea63 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_open_and_slots.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertCache`: `validate_file_source_context`, `completed_file_source_member`, `open`, `unopen... -//! Functions: `span_layer`, `check_total`, `queue_span_copies`. Defines `SwapPlan`, `SlotRegion`. +//! Expert cache opening and slot bookkeeping: the free-VRAM and budget check before the single arena allocation, +//! zeroing, slot/owner/layer-range queries and counters, and the planning and copy of queued slot swaps. use super::{ Context, Error, MappedExpertBank, OriginalExpertCache, OriginalExpertSlots, Rc, ResidentExpertBankSpan, Result, diff --git a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs index b776f767..eb62a26b 100644 --- a/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs +++ b/crates/cuda-driver/src/original_expert_cache/original_expert_cache_operations/original_expert_cache_verify_and_lend.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertCache`: `verify_slot`, `check_verify`, `compare_spans`, `completed_slot` and 9 more. -//! Split out of `original_expert_cache_methods` to keep its files under the line limit. +//! Expert cache audits and loans: read-back byte verification of a filled slot against its source, lending the cache +//! tail slots to a prefill (choose_loan, lend_prefill_tail, needs_refill), plus poison, close and leak-all teardown. use super::original_expert_cache_open_and_slots::span_layer; use super::{ diff --git a/crates/cuda-driver/src/original_expert_stager/context.rs b/crates/cuda-driver/src/original_expert_stager/context.rs index abb40859..1c5b431c 100644 --- a/crates/cuda-driver/src/original_expert_stager/context.rs +++ b/crates/cuda-driver/src/original_expert_stager/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_expert_stager`, `original_file_expert_stager`, `open_original_stager`, `abandon_s... -//! Methods of `OriginalExpertStager`: `spawn_workers`. Functions: `shared_state`. Defines `StagerPlan`, `StagerTables`. +//! Opening of the expert stager: the Context entry points for a bank-backed or file-backed source, the ring and thread +//! plan with its host-byte admission, the pinned slot buffers and events, the shared worker state and the worker spawn. use super::{ Arc, AtomicBool, AtomicU8, AtomicU64, AtomicUsize, Condvar, Context, Error, FileExpertSourceLease, FileSource, diff --git a/crates/cuda-driver/src/original_expert_stager/original_stager_batch.rs b/crates/cuda-driver/src/original_expert_stager/original_stager_batch.rs index 483855f8..27ab6f8c 100644 --- a/crates/cuda-driver/src/original_expert_stager/original_stager_batch.rs +++ b/crates/cuda-driver/src/original_expert_stager/original_stager_batch.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalStagerBatch`: `len`, `is_empty`, `issue`, `issue_target` and 3 more. -//! Methods of `OriginalStagerCompleted`: `into_parts`. Implements `Drop for OriginalStagerBatch`. +//! One in-flight batch of the expert stager: ordered issue of staged jobs to device destinations, finish and Drop of +//! the batch, the assembled file blob accessors, and the stager's file-source blob and job construction. use super::{ Context, DeviceBuffer, Error, FileExpertSourceLease, HEADROOM, LayerRole, Ordering, OriginalExpertStager, diff --git a/crates/cuda-driver/src/original_expert_stager/original_stager_options.rs b/crates/cuda-driver/src/original_expert_stager/original_stager_options.rs index 9c527e8a..fb90629a 100644 --- a/crates/cuda-driver/src/original_expert_stager/original_stager_options.rs +++ b/crates/cuda-driver/src/original_expert_stager/original_stager_options.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalStagerOptions`: `from_environment`, `dimensions`. -//! Methods of `OriginalStagerJob`: `new`, `layer`, `expert`. +//! Stager configuration and its source: ring/thread sizing from STRATA_STAGER_* settings, the job type naming one +//! layer and expert, and how a bank or file source validates itself and turns a job into a raw copy job. use super::{ Error, FileSource, LayerRole, OriginalStagerJob, OriginalStagerOptions, ResidentExpertBankLease, diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs index a2903ebc..f387f772 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertStager`: `run_stream_all_forward`, `admit_forward`, `check_forward_caps`. -//! Methods of `OriginalStreamAllForward`: `settle`, `validate_rows`, `with_compute`, `consume_layer` and 1 more. +//! Forward variant of the stream-all transport: run_stream_all_forward admits host and cache costs for layers +//! first..end, gives a consumer the forward scope and settles its rows; also consume_layer and its grouped form. use super::{ BufferHandle, Entry, Error, GPU_RING_MAX, HEADROOM, Issuer, JoinHandle, MAX_JOBS, META_CAP, OriginalExpertStager, diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs index 19f156c8..3de99efc 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `original_stream_all_options_issuer`, `original_expert_stager`, `original_stream_all` and 1... -//! Split out of `stream_all` to keep its files under the line limit. +//! Parent module of the stream-all scope: its issuer, run_stream_all, the live scope and the scope phases; +//! shares their imports and re-exports issuer_thread for the stager's worker setup. use super::{ Arc, AtomicBool, AtomicUsize, BufferHandle, Entry, Error, EventBank, GPU_RING_MAX, HEADROOM, Issuer, JoinHandle, diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs index 86bb8d03..955953ad 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalExpertStager`: `run_stream_all`. -//! Split out of `original_stream_all_options` to keep its files under the line limit. +//! run_stream_all: opens one all-expert stream scope over the prompt rows (preflight, budget, targets, queued jobs, +//! issuer), runs the consumer inside it and finishes the scope, which guarantees join and drain even on panic. use super::stream_phases::{arm_scope, finish_scope, open_scope, start_or_cleanup}; use super::{ diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs index ef921aee..032005b4 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalStreamAll`: `issue_inline`, `healthy`, `give_back`, `release_unused` and 5 more. -//! Implements `Drop for OriginalStreamAll`. +//! The live stream-all scope: inline or threaded issue of copy jobs, health checks, releasing unused experts to the +//! copy/used event ring, consume_layer for producers, issuer join, cleanup, and a Drop that retains owners on failure. use super::{ BufferHandle, Entry, Error, ORIGINAL_MMQ_GROUP, Ordering, OriginalGpuStream, OriginalStreamAll, diff --git a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs index bdb9d094..e8109530 100644 --- a/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalStreamAllOptions`: `from_environment`, `eligible`. Methods of `EventBank`: `retire`. -//! Functions: `issuer_thread`, `issue_all`. +//! Issuer side of stream-all: options read from STRATA_PREFILL_* settings (minimum rows, issuer thread on/off), +//! event bank retirement, and the issuer thread that issues every copy job in ascending order. use super::{ Arc, Error, EventBank, Issuer, Ordering, OriginalGpuStream, OriginalPromptRows, OriginalStreamAllCompleted, diff --git a/crates/cuda-driver/src/original_expert_stager/tests.rs b/crates/cuda-driver/src/original_expert_stager/tests.rs index cf258b03..5070efe9 100644 --- a/crates/cuda-driver/src/original_expert_stager/tests.rs +++ b/crates/cuda-driver/src/original_expert_stager/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the expert stager's stop fence: after stop returns, no worker may still be claiming a job that +//! would copy from a released source (helpers run the real claim prologue against a shared state and flag late claims). use super::*; diff --git a/crates/cuda-driver/src/original_expert_stager_ffi/tests.rs b/crates/cuda-driver/src/original_expert_stager_ffi/tests.rs index c8366693..d917ad28 100644 --- a/crates/cuda-driver/src/original_expert_stager_ffi/tests.rs +++ b/crates/cuda-driver/src/original_expert_stager_ffi/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the stager's raw copy boundary: a CopyJob refuses empty, oversized or overlapping parts and writes nothing +//! on refusal, and an expert file map hands out only parts inside the mapping (Windows and Unix test mappings). use super::*; diff --git a/crates/cuda-driver/src/original_file_expert_source/available_memory.rs b/crates/cuda-driver/src/original_file_expert_source/available_memory.rs index 6c1de3fd..b85f4e19 100644 --- a/crates/cuda-driver/src/original_file_expert_source/available_memory.rs +++ b/crates/cuda-driver/src/original_file_expert_source/available_memory.rs @@ -1,5 +1,5 @@ -//! Functions: `available_memory`, `text`, `value`, `meminfo_available` and 6 more. -//! Split out of `original_file_expert_source` to keep its files under the line limit. +//! Host memory available to the file expert source on Unix: MemAvailable from /proc/meminfo, lowered by the cgroup +//! memory limits of the process and its ancestors, so budget checks respect containers; any parse failure is an error. use super::{Error, Result}; diff --git a/crates/cuda-driver/src/original_file_expert_source/file_expert_source_swap_exchanges.rs b/crates/cuda-driver/src/original_file_expert_source/file_expert_source_swap_exchanges.rs index ad134c52..b5d68d5c 100644 --- a/crates/cuda-driver/src/original_file_expert_source/file_expert_source_swap_exchanges.rs +++ b/crates/cuda-driver/src/original_file_expert_source/file_expert_source_swap_exchanges.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `reserve_exchanges`, `admit_exchanges`, `replace_exchange`, `stage_swaps` ... -//! Implements `Drop for OriginalFileExpertSource`. Functions: `available_memory`. Defines `Candidate`. +//! File expert source exchange arena: reserving it, staging swaps by copying outgoing cache slots into exchange +//! entries, and committing them once the cache fills are complete; also Drop and the Windows available_memory. use super::{ EXPERTS, Error, Exchange, N, NONE, OriginalExpertCache, OriginalFileExpertSource, OriginalSourceSwap, Result, abi, diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs index c5e5b0c1..672cf64a 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `build_cache_complement`. -//! Split out of `original_file_expert_source_methods` to keep its files under the line limit. +//! Builds the cache complement: after the primary cache is complete and fenced, plans and fills one host arena +//! (pinned if asked) with every expert the cache does not hold, cleaning up or leaking the arena by failure kind. use super::build_phases::{ArenaFillPlan, alloc_failed, discard_arena, leak_arena, poison_parts}; use super::{Error, OriginalExpertCache, OriginalFileExpertSource, OriginalResidentOptions, Result, combine}; diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_prefetch.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_prefetch.rs index 525f61db..5d41ea00 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_prefetch.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_prefetch.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `prefetch_impl`, `prefetch_jobs`, `claim_prefetch`, `note_warm_hit` and 7 ... -//! Functions: `fetch_worker`, `scoped_fetch`. Defines `FetchOutcomes`. +//! File expert source prefetch and teardown: claims stages for wanted experts, copies them in parallel worker +//! threads, accounts hits and fetches, and closes or retains the source's arenas and stages. use super::{ AtomicUsize, EXPERTS, Error, Instant, LAYERS, Mutex, N, NONE, Ordering, OriginalFileExpertSource, Result, abi, diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs index d35bb7a1..1003f5d8 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_stages_and_blobs.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `plan`, `claim_stage`, `stage_victim`, `grow_stage` and 13 more. -//! Functions: `omit_table`. +//! File expert source stages and blobs: the layout plan, an LRU of staged experts, and blob reads from arena, +//! exchange, stage or the file itself (blob, copy_blob, warm, prefetch), with read counters. use super::{ EXPERTS, Error, Instant, LAYERS, N, NONE, OriginalFileExpertSource, OriginalFileSourceBlob, Result, Stage, abi, diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_status_counters.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_status_counters.rs index f9503201..57cdc19e 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_status_counters.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_status_counters.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalFileExpertSource`: `live`, `validate_context`, `parts`, `source_digest` and 15 more. -//! Split out of `original_file_expert_source_methods` to keep its files under the line limit. +//! File expert source status and accounting: liveness and context checks, expert part views from the mapped file, +//! residency and pinned-byte counters, per-layer begin, and the host metadata charge and admission of extra bytes. use super::{ Context, Error, Exchange, GIB, LAYERS, LayerRole, META_CAP, NONE, OriginalFileExpertSource, diff --git a/crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs b/crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs index 0241d9e2..5da701fc 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_resident_options_and_blob.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalResidentOptions`: `from_environment`. -//! Methods of `OriginalFileSourceBlob`: `bytes`, `layer`, `expert`, `source_digest` and 6 more. +//! Resident-source options (defaults, STRATA_PARTIAL_PIN settings), accessors of a file source blob (bytes, parts, +//! role sizes, pinned state, device alias), and the Context constructor that assembles a file expert source. use super::{ Cell, Context, EXPERTS, Error, ExpertFileMap, FileExpertSourceLease, GIB, HashMap, LAYERS, LayerRole, N, diff --git a/crates/cuda-driver/src/original_file_expert_source_ffi/tests.rs b/crates/cuda-driver/src/original_file_expert_source_ffi/tests.rs index ea4bc9dd..2b2c875c 100644 --- a/crates/cuda-driver/src/original_file_expert_source_ffi/tests.rs +++ b/crates/cuda-driver/src/original_file_expert_source_ffi/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the pinned/host arena boundary: write, part and overwrite stay inside the block, copy records refuse +//! overlap, empty, null or oversize pieces, and the partial-pin cap parses a positive prefix or falls back to 24 GiB. use super::*; diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/api.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/api.rs index 53e9707b..1f368af0 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/api.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `load`, `stream_create`, `stream_destroy`, `stream_sync` and 23 more. -//! Split out of `abi` to keep its files under the line limit. +//! Api stand-in for platforms without the CUDA driver (feature off, or not 64-bit Linux/Windows): every +//! call returns UnsupportedPlatform, so the GPU schedule compiles everywhere and fails cleanly at load. #[cfg(not(all( feature = "cuda-driver", diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs index 3c773a2b..0763ddac 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs @@ -1,5 +1,5 @@ -//! Defines `Handle`, `Library`, `StreamCreate` and 21 more. -//! Split out of `abi` to keep its files under the line limit. +//! Declarations of the GPU schedule's driver table: the C signatures of the CUDA driver calls it binds, the Api +//! struct holding them with the refused-call latches, and the children that load and call them. use super::{Error, Result}; use std::ffi::{CStr, c_void}; diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs index d579ee40..92d28fa8 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `load`, `stream_create`, `warm_callback_thread`, `warm_callback_thread` and 19 more. -//! Functions: `symbol`. +//! Driver table of the GPU schedule: dlopen of the CUDA driver and binding of every symbol (plus the optional batch +//! copy and stream-write ones), then the stream, event, graph capture and launch calls and callback-thread warm-up. use super::{ Api, Begin, CStr, CopyBatch, CopyH2d, End, Error, EventCall, EventCreate, EventElapsed, EventRecord, GraphCall, diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs index 0b9954fb..0a54018a 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs @@ -1,5 +1,5 @@ -//! Methods of `Api`: `copy_h2d`, `copy_h2d_many`, `copy_h2d_batched`, `can_write_u32` and 3 more. -//! Split out of `platform` to keep its files under the line limit. +//! Asynchronous host-to-device copies of the GPU schedule (single, grouped or one cuMemcpyBatchAsync) and the stream +//! writes or host callbacks that raise a ring flag after the copies, with fallback once the driver refuses a call. use super::{Api, BatchAttributes, CopyBatch, Error, Handle, Raise, Result, check, raise_after_copies}; diff --git a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs index 70ce463e..659a95c7 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs @@ -1,5 +1,5 @@ -//! Implements `Drop for Library`. Functions: `check`, `raise_after_copies`, `noop_host_fn`, `callback_warmup_enabled`. -//! Split out of `platform` to keep its files under the line limit. +//! Small helpers of the driver table: dlclose on Drop, mapping a driver return code to an error, the host function +//! that raises a flag word, and the no-op callback and LELEKA_CB_WARMUP switch used to warm the callback thread. use super::{Error, Library, Raise, Result, c_void}; diff --git a/crates/cuda-driver/src/original_gpu_schedule/original_gpu_graph.rs b/crates/cuda-driver/src/original_gpu_schedule/original_gpu_graph.rs index 68e200fb..f647e168 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/original_gpu_graph.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/original_gpu_graph.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGpuGraph`: `validate`, `nodes`, `policy`, `validate_context` and 14 more. -//! Methods of `OriginalGraphFlight`: `query`, `wait`, `wait_ms`. +//! A captured CUDA graph executable of the GPU schedule: enqueue or launch on a stream, the in-flight handle with +//! query/wait/timeout, the receipts (stream drain, event, wait) that allow its resources to be reused, and close/Drop. use super::{ Context, Duration, Error, Instant, OriginalCapturePolicy, OriginalGpuEvent, OriginalGpuGraph, OriginalGpuStream, diff --git a/crates/cuda-driver/src/original_gpu_schedule/original_gpu_stream.rs b/crates/cuda-driver/src/original_gpu_schedule/original_gpu_stream.rs index 5ef95ac0..75638180 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/original_gpu_stream.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/original_gpu_stream.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGpuStream`: `validate_context`, `is_failed`, `priority`, `query` and 9 more. -//! Split out of `original_gpu_schedule` to keep its files under the line limit. +//! The GPU schedule's stream handle: context and failure checks, observational priority, query and synchronize, +//! enqueue of host-to-device copies and flag raises, graph capture on the stream, and the drain receipt. use super::{ CUDA_ERROR_OUT_OF_MEMORY, Cell, Context, Error, Instant, OriginalCapture, OriginalCapturePolicy, OriginalGpuGraph, diff --git a/crates/cuda-driver/src/original_gpu_schedule/original_graph_key.rs b/crates/cuda-driver/src/original_gpu_schedule/original_graph_key.rs index abe3260f..fd8b616f 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/original_graph_key.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/original_graph_key.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGraphKey`: `validate`, `policy`. -//! Methods of `OriginalGraphRegistry`: `new`, `planned_metadata_bytes`, `metadata_bytes`, `captures` and 7 more. +//! Graph identity and cache: OriginalGraphKey names a capturable graph (layer pre/post, token, verify window, MTP +//! steps) with range check and capture policy; OriginalGraphRegistry records, looks up and clears cached graphs. use super::{ Context, Error, OriginalCapture, OriginalCapturePolicy, OriginalGpuGraph, OriginalGpuStream, OriginalGraphKey, diff --git a/crates/cuda-driver/src/original_gpu_schedule/set_side_streams_wanted.rs b/crates/cuda-driver/src/original_gpu_schedule/set_side_streams_wanted.rs index 108a45f8..61265544 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/set_side_streams_wanted.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/set_side_streams_wanted.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalCapture`: `has_side`, `side_fork`, `side_end`, `side_join` and 2 more. -//! Methods of `OriginalGpuEvent`: `handle`, `validate_context`, `record`, `wait_on` and 6 more. +//! Side streams and events of the GPU schedule: the switch for a verifier-window capture to fork two side streams, +//! their creation/teardown, fork/end/join in a capture, and the OriginalGpuEvent record, wait, query, timing and close. use super::{ Context, Error, OriginalCapture, OriginalEventKind, OriginalGpuEvent, OriginalGpuStream, Rc, Result, diff --git a/crates/cuda-driver/src/original_gpu_schedule/transport.rs b/crates/cuda-driver/src/original_gpu_schedule/transport.rs index a674eadc..a6366a24 100644 --- a/crates/cuda-driver/src/original_gpu_schedule/transport.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/transport.rs @@ -1,5 +1,5 @@ -//! Methods of `Stream`: `bump`, `validate`, `run`, `close` and 1 more. -//! Methods of `Context`: `original_default_gpu_stream`, `original_gpu_stream`, `original_gpu_event`. +//! Driver-call plumbing of the GPU schedule: error classification (transport, recoverable out-of-memory), poisoning of +//! the context on failure, the per-stream run/close guard, and the Context constructors for streams and events. use super::{ CUDA_ERROR_OUT_OF_MEMORY, Cell, Context, Error, OriginalCapturePolicy, OriginalEventKind, OriginalGpuEvent, diff --git a/crates/cuda-driver/src/original_moe_prompt_device/blank.rs b/crates/cuda-driver/src/original_moe_prompt_device/blank.rs index c94da085..5d06526d 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/blank.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/blank.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_moe_prompt_device`. Functions: `blank`, `kernel`, `gemm`, `phase` and 2 more. -//! Split out of `original_moe_prompt_device` to keep its files under the line limit. +//! Shared builders of the MoE prompt device: zeroed host buffers, kernel and GEMM command constructors, span +//! lookups for phase and common prompt-row roles, the dequant kernel index per GDN format, and the Context entry point. use super::{ A, BufferHandle, Command, Context, Error, GdnNativeFormat, GemmOperands, GemmSize, KernelArguments, diff --git a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_drop.rs b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_drop.rs index 295a5020..44563657 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_drop.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMoePromptLayer`: `experts`, `counts`, `metadata_bytes`, `execute_original_copy_ring` and 8 more. -//! Implements `Drop for OriginalMoePromptDevice`. Functions: `source_in_layer`. +//! Per-layer MoE prompt execution (OriginalMoePromptLayer): route order and counts, the copy-ring, MMQ and stream-all +//! expert executions, the slot-table upload and weighted combine finish; also Drop for OriginalMoePromptDevice. use super::{ A, BufferHandle, Command, Error, ExpertStreamLayer, MappedExpertBank, MmqWorkspace, NativeBatchWorkspace, diff --git a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_new_run.rs b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_new_run.rs index 87c6dfee..4d9fb06b 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_new_run.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_new_run.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMoePromptDevice`: `new`, `allocate_and_load`, `allocated_bytes`, `handle` and 9 more. -//! Split out of `original_moe_prompt_device_methods` to keep its files under the line limit. +//! Construction and command runner of the MoE prompt device: budget check, status and scratch allocation, kernel +//! module loading, weight and span admission, and run, which issues commands and checks the finite-status words. use super::{ A, BufferHandle, Command, Context, DQ_ENTRIES, DeviceBuffer, Error, KernelModule, MOE_ENTRIES, diff --git a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs index 0b1cd43b..c324864d 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMoePromptDevice`: `prepare`, `close`. -//! Split out of `original_moe_prompt_device_methods` to keep its files under the line limit. +//! MoE prepare phase: validates the GR-read rows against the device, runs the router and grouping commands and builds +//! the per-layer route plan (expert order and counts) that the layer then executes; also the explicit close. use super::prepare_phases::{MOE_NAMES, route_plan}; use super::{ diff --git a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_release.rs b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_release.rs index 9f29ad81..0fb26b0a 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_release.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_release.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMoePromptDevice`: `close_inner`, `is_released`, `retain_poisoned`. -//! Split out of `original_moe_prompt_device_methods` to keep its files under the line limit. +//! Teardown of the MoE prompt device: closes kernel modules and releases buffers under the context guard, or leaks +//! them when the context is poisoned so a failed close never frees GPU memory a stuck stream may still touch. use super::{Error, OriginalMoePromptDevice, Result, combine}; diff --git a/crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs index e2688a35..abcc659f 100644 --- a/crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpLoadMeter`: `start`, `finish`. Functions: `inconsistent`, `mismatch`. -//! Split out of `loaded` to keep its files under the line limit. +//! Load accounting of the MTP draft actor: OriginalMtpLoadMeter measures the VRAM a load added (monotonic, same +//! device) and the helpers that build the load-failure errors for inconsistent owners or mismatched facts. use super::{ Context, Error, OriginalMtpDraftHead, OriginalMtpLoadEvidence, OriginalMtpLoadFailure, OriginalMtpLoadMeter, diff --git a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs index 5b811546..23620f29 100644 --- a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `draft_rounds`, `original_mtp_actor_adopt_loaded`. -//! Split out of `loaded` to keep its files under the line limit. +//! Parent module of the MTP draft actor: one child for adopting loaded owners and one for draft rounds, +//! both adding methods to OriginalMtpActor; shares their imports. use super::{ AcceptedWindow, ActorRefusal, CompletedOriginalMtpDraft, Context, CoupledDraftHost, CoupledPlan, CoupledPreference, diff --git a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs index aa3f2858..ed5c3d0d 100644 --- a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpActor`: `adopt`, `admit`, `check_loaded`, `coupled_setup` and 22 more. -//! Split out of `original_mtp_actor` to keep its files under the line limit. +//! Adoption and accessors of the MTP draft actor: takes the loaded drafter, ring and weights, verifies them against the +//! plan and load evidence, sets up coupled drafting, and exposes the settings, restore and end-of-request calls. use super::{ ActorRefusal, Context, CoupledDraftHost, CoupledPlan, CoupledPreference, CoupledSetupReceipt, DraftSettings, Error, diff --git a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs index 15c47de1..97faa2ec 100644 --- a/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalMtpActor`. -//! Split out of `loaded` to keep its files under the line limit. +//! Drop glue of the loaded MTP actor: dropping it closes the device resources it still holds, ignoring close errors. use super::OriginalMtpActor; diff --git a/crates/cuda-driver/src/original_mtp_draft_vocab/tests.rs b/crates/cuda-driver/src/original_mtp_draft_vocab/tests.rs index 0f877da1..d322d04a 100644 --- a/crates/cuda-driver/src/original_mtp_draft_vocab/tests.rs +++ b/crates/cuda-driver/src/original_mtp_draft_vocab/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the draft-vocabulary selection: setting spellings, the recorded digest table, refusal of wrong digests, +//! malformed files and symlinks, and the round trip from draft tokens to full vocabulary ids. use super::*; use crate::original_mtp_coupled::subset_inverse; diff --git a/crates/cuda-driver/src/original_mtp_rt/read_index.rs b/crates/cuda-driver/src/original_mtp_rt/read_index.rs index ae975026..c02e58d6 100644 --- a/crates/cuda-driver/src/original_mtp_rt/read_index.rs +++ b/crates/cuda-driver/src/original_mtp_rt/read_index.rs @@ -1,5 +1,5 @@ -//! Functions: `read_index`, `read_dense`, `expert_bank_bytes`, `expert_scales_finite` and 10 more. -//! Split out of `original_mtp_rt` to keep its files under the line limit. +//! File readers of the MTP runtime pack: dense.txt index, dense blob, experts.bin chunk streaming with the Inf/NaN +//! scale scan, and the draft vocabulary selection. Each mirrors the Original mtp.cpp read semantics and size limits. use super::{ DENSE_LIMIT, DRAFT_VOCAB_MAX_IDS, DenseIndex, DraftVocab, EXPERT_SCALE_OFFSET, INDEX_LIMIT, Path, PathBuf, Read, diff --git a/crates/cuda-driver/src/original_mtp_rt/rt_error.rs b/crates/cuda-driver/src/original_mtp_rt/rt_error.rs index d4e0a955..a655fbf9 100644 --- a/crates/cuda-driver/src/original_mtp_rt/rt_error.rs +++ b/crates/cuda-driver/src/original_mtp_rt/rt_error.rs @@ -1,5 +1,5 @@ -//! Methods of `RtError`: `message`, `index_message`, `pack_message`, `limit_message`. -//! Methods of `OriginalMtpTensorKind`: `parse`, `index_name`, `row_bytes`. +//! Parsing and error text of the MTP runtime pack index: RtError messages in the Original mtp.cpp wording, tensor kind +//! parsing and row sizes, the dense.txt parser with extent, required-name and finiteness checks, regular-file opening. use super::{DenseIndex, File, MAX_TENSORS, OriginalMtpTensorKind, Path, RtError, RtResult, TensorEntry, fs}; diff --git a/crates/cuda-driver/src/original_mtp_rt/tests.rs b/crates/cuda-driver/src/original_mtp_rt/tests.rs index 012e1b49..2bd09591 100644 --- a/crates/cuda-driver/src/original_mtp_rt/tests.rs +++ b/crates/cuda-driver/src/original_mtp_rt/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the MTP runtime pack readers: index parsing, extent and finiteness checks, expert streaming error order, +//! and refusal of symlinked files; submodules hold the cases. use super::fixtures::*; use super::*; diff --git a/crates/cuda-driver/src/original_sampler/asset.rs b/crates/cuda-driver/src/original_sampler/asset.rs index a4039aa8..9e525396 100644 --- a/crates/cuda-driver/src/original_sampler/asset.rs +++ b/crates/cuda-driver/src/original_sampler/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `Launch`: `new`. Methods of `Context`: `original_sampler`. Functions: `asset`. -//! Split out of `original_sampler` to keep its files under the line limit. +//! Loads the sealed PTX asset of the Original sampler, builds a kernel Launch description, and opens the sampler +//! from a Context. use super::{ASSET_PIN, Arg, Command, Context, Launch, OriginalSampler, Result}; diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_drop.rs b/crates/cuda-driver/src/original_sampler/original_sampler_drop.rs index 7601d557..80df25e4 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_drop.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalSampler`. Functions: `sampler_asset_sealed`. -//! Split out of `original_sampler` to keep its files under the line limit. +//! Drop glue of the Original sampler (closes its device resources) and the probe for a sealed PTX asset. use super::{OriginalSampler, asset}; diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_bring_up.rs b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_bring_up.rs index 87d9881c..f137ecb2 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_bring_up.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSampler`: `new`, `unloaded`, `check_budget`, `allocate_and_load` and 11 more. -//! Split out of `original_sampler_methods` to keep its files under the line limit. +//! Bring-up of the Original sampler: budget check, device buffer and kernel module allocation, buffer admission checks, +//! scratch growth for the split path, and uploads. Everything done before the first launch. use super::{ Context, DRAFTS, DeviceBuffer, ENTRIES, Error, HIST, KernelModule, MappedAllocation, OriginalSampler, RESERVE, diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_close_resources.rs b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_close_resources.rs index e165ef6b..652587c7 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_close_resources.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_close_resources.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSampler`: `close_inner`, `is_released`, `close_module_and_mapped`, `retain_module_and_mapped`. -//! Functions: `release_buffer`. +//! Teardown of the Original sampler: releases buffers, kernel module and mapped staging inside an entered context, +//! or retains them when the context is poisoned. use super::{Context, DeviceBuffer, Error, KernelModule, OriginalSampler, Result, combine}; diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_coupled_draft.rs b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_coupled_draft.rs index 1a0418a9..f6e25e1d 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_coupled_draft.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_coupled_draft.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSampler`: `set_subset`, `stage_coupled_round`, `write_round_staging`, `launch_stage` and 11 m... -//! Split out of `original_sampler_methods` to keep its files under the line limit. +//! Coupled draft sampling of the Original sampler: installs the draft-head vocabulary subset, stages a round's +//! parameters and history, and runs penalties, widest split and coupled merge for one draft logits row. use super::{Arg, DRAFTS, DeviceBuffer, Error, HIST, Launch, OriginalSampler, Result, SamplerParams, combine}; diff --git a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_run_verify_window.rs b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_run_verify_window.rs index 07fa1fcf..07a6a955 100644 --- a/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_run_verify_window.rs +++ b/crates/cuda-driver/src/original_sampler/original_sampler_operations/original_sampler_run_verify_window.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSampler`: `run`, `issue_guarded`, `launch_all`, `read_outputs` and 10 more. -//! Methods of `SampleArgs`: `split_partial`, `greedy`, `old`, `fused`. Functions: `zeroed`, `split_merge`. +//! Verify-window sampling of the Original sampler: uploads row histories, launches the greedy, fused or split-merge +//! kernels, reads the sampled ids back and settles the drain. Launch arguments are built here. use super::{ Arg, Error, Launch, OriginalSampler, Result, SampleRequest, SampleWindow, SamplerLaunchShape, SamplerParams, diff --git a/crates/cuda-driver/src/original_session_state/add.rs b/crates/cuda-driver/src/original_session_state/add.rs index 4f889d7b..0aadfb63 100644 --- a/crates/cuda-driver/src/original_session_state/add.rs +++ b/crates/cuda-driver/src/original_session_state/add.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSessionGeometry`: `original`, `dimensions`, `validate`, `recurrence_bytes` and 14 more. -//! Methods of `OriginalSessionSpan`: `end`, `at`. Functions: `add`, `mul`, `product`, `align` and 6 more. +//! Byte-size model of an Original session: checked arithmetic helpers, the OriginalSessionGeometry dimensions and +//! the sizes of the GDN, GR, MoE, block and QSA scratch regions, plus the span and cursor helpers that carve an arena. use super::{Cursor, Error, OriginalSessionGeometry, OriginalSessionQsaLayout, OriginalSessionSpan, Result}; diff --git a/crates/cuda-driver/src/original_session_state/original_session_layout.rs b/crates/cuda-driver/src/original_session_state/original_session_layout.rs index aa72834b..c30295db 100644 --- a/crates/cuda-driver/src/original_session_state/original_session_layout.rs +++ b/crates/cuda-driver/src/original_session_state/original_session_layout.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalSessionLayout`: `new`, `gdn_point_at`, `gdn_local_index`, `gdn_point_spans` and 1 more. -//! Methods of `OriginalSessionState`: `session_init_carve`, `validate_context`, `layout`, `with_carved_arena` and 3 ... +//! Layout and lifecycle of a session state: finds the GDN point spans and the primary QSA layout, carves the arena, +//! registers and releases the primary RoPE tables, and closes the state. use super::{ ALIGN, Context, Cursor, DeviceBuffer, Error, OriginalLayerBounds, OriginalSessionGeometry, OriginalSessionKvPolicy, diff --git a/crates/cuda-driver/src/original_session_state/qsa_price.rs b/crates/cuda-driver/src/original_session_state/qsa_price.rs index d5868ad1..861b2b6a 100644 --- a/crates/cuda-driver/src/original_session_state/qsa_price.rs +++ b/crates/cuda-driver/src/original_session_state/qsa_price.rs @@ -1,5 +1,5 @@ -//! Methods of `PoolSizes`: `new`, `select`, `without_key`, `hybrid`. Methods of `KvSizes`: `new`. -//! Functions: `qsa_price`, `kv_placement`, `tier_off`, `smaller_tier` and 11 more. +//! Pricing and carving of QSA session state: K/V placement tier (drafter ring, clock-resident, full), pool and table +//! sizes, the region-by-region carve of one state, and the pure total session_bytes of the Original sequence. use super::{ ALIGN, Cursor, Error, OriginalSessionGeometry, OriginalSessionKvPolicy, OriginalSessionQsaLayout, diff --git a/crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs b/crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs index 181354a5..cec52903 100644 --- a/crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs +++ b/crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyCpuSink`: `plan_capacity`, `staging_capacity`, `copies_landed`, `group_ids` and 1 more. -//! Functions: `dma_options`. +//! Publishing of a group's GPU plan from the CPU sink: capacity and group-id accessors, publish_gpu_plan (flag A, PCIe +//! share staged by DMA, flag B), and the DMA option switches with their platform defaults. use super::{ Error, OriginalExpertCache, OriginalGpuStream, OriginalVerifyGpuPlan, OriginalVerifyPcieSource, Result, diff --git a/crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs b/crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs index 6479ae08..d1e21fba 100644 --- a/crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs +++ b/crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs @@ -1,5 +1,5 @@ -//! Functions: `dma_options_for`. -//! Split out of `gpu_plan` to keep its files under the line limit. +//! Pure platform and environment rule behind the DMA staging options: WSL2 and native Windows make the batch copy +//! and the stream write opt-in. Separate from dma_options so it can be tested with a fake environment. /// `dma_options` for a platform and an environment: `wsl` (WSL2 passthrough) makes the batch copy and the stream /// write opt-in, `windows` (native) the batch copy only. diff --git a/crates/cuda-driver/src/original_verify/gr/assets.rs b/crates/cuda-driver/src/original_verify/gr/assets.rs index 06205ba2..236d45ef 100644 --- a/crates/cuda-driver/src/original_verify/gr/assets.rs +++ b/crates/cuda-driver/src/original_verify/gr/assets.rs @@ -1,5 +1,5 @@ -//! Methods of `GrVariant`: `from_env_value`. Methods of `GrConfig`: `from_device`, `query`, `down_entry`. -//! Functions: `assets`, `cap_to_optin`, `shared_attributes`, `tiled_down_geometry` and 6 more. +//! Assets and per-device configuration of the GR (hyper-connection read/write) kernel family: variant choice from the +//! environment, shared-memory attributes, tiled down geometry, row checks and the argument-word helpers. use super::{ ARGS_WORDS, ATTR_COMPUTE_CAPABILITY_MAJOR, ATTR_COMPUTE_CAPABILITY_MINOR, ATTR_MAX_SHARED_PER_BLOCK, diff --git a/crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs b/crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs index 93c88527..49fe47f5 100644 --- a/crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs +++ b/crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs @@ -1,5 +1,5 @@ -//! Functions: `plan_hc_read`, `hc_read_of_rows`, `hc_read_rows`, `hc_read_norm` and 9 more. -//! Split out of `gr` to keep its files under the line limit. +//! Planner of the GR read launches (norm, down, up) per window half, the final residual write of the last layer +//! and the per-token head mix. Picks tiled, buffered or fused down kernels by card limits. use super::{ A, ArenaMap, Bf16GemvExtents, D, DOWN_BLOCKS, E_NORM, E_SPLIT, E_UP, EPS, Error, GR_FUSED, GR_NORM, GR_POST, diff --git a/crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs b/crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs index 08a7707e..1069c8aa 100644 --- a/crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs +++ b/crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs @@ -1,5 +1,5 @@ -//! Methods of `PleScratch`: `at`. -//! Methods of `OriginalVerifyGrBinding`: `new`, `half`, `half_addrs`, `head_addrs` and 4 more. +//! Planner of the layer-1 PLE (per-layer embedding) block, one launch list per window row, and the GR binding that +//! validates and hands out the device addresses of the hyper-connection halves, the head and the PLE buffers. use super::{ A, ArenaMap, Bf16GemvExtents, Context, D, DeviceBuffer, Error, GrWindow, HC, HC_DOWN_BYTES, HC_INJECT_BYTES, diff --git a/crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs b/crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs index 92dc69cf..aea2b2fa 100644 --- a/crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs +++ b/crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeKnobs`: `mode17`. Methods of `ExpertBlob`: `words`. -//! Functions: `pcie_fast_kernel`, `pcie_kernel_name`, `pcie_grid`, `assets` and 13 more. +//! MoE family setup: assets, knobs and PCIe staging copy kernel choice, the expert blob formats a window supports, +//! the MoE buffer binding with its address checks, and the small arena helpers shared by the MoE planners. use super::{ ArenaMap, AssetSpec, COMBINE, Context, DeviceBuffer, ELEMENT, EXPERTS, Error, ExpertBlob, HEAD_IQ_EXPERT, MoeKnobs, diff --git a/crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs b/crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs index 6170e2a7..2ed7aa16 100644 --- a/crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs +++ b/crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs @@ -1,5 +1,5 @@ -//! Methods of `GroupPlan`: `new`, `launches`, `upstream_layout`, `swiglu_quant` and 4 more. -//! Functions: `plan_expert_groups`, `group_kernels`, `fused_gate_up_entry`, `plan_hit_add` and 5 more. +//! Planner of the routed-expert launches of a window group: gate/up, SwiGLU with q8_1 quantization and down projection +//! per tier, then the hit add and the MoE combine (batched, native per row, or legacy). use super::super::down; use super::{ diff --git a/crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs b/crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs index d5f2a149..e2c64495 100644 --- a/crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs +++ b/crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs @@ -1,5 +1,5 @@ -//! Methods of `BatchedRows`: `new`. Methods of `RouterSpans`: `mixed`, `logits`, `ids`, `weights`. -//! Functions: `plan_f32_to_bf16`, `plan_route`, `plan_router`, `router_batched` and 5 more. +//! Planner of the MoE front end: f32 to bf16 conversion, router logits with top-10 selection (batched or per row), +//! and the shared expert (conversion, projections, SwiGLU, gate scalar). use super::{ A, ArenaMap, Bf16GemvExtents, E_NATIVE_SWIGLU, E_QUANTIZE_Q8_1, E_ROUTE, E_ROUTER_TOP10, E_SCALAR_GATE, diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs index aaa686fc..ceb53f7e 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `original_verify_window`, `verify_gdn_fused_step`, `verify_gdn_journal_ladder_logits_scan` ... -//! Split out of `original_verify` to keep its files under the line limit. +//! Parent of the GDN journal of the verify window: shares the imports of its submodules (window geometry, fused step, +//! logits scan, stage and commit, launch plumbing) so each one stays a single responsibility. use super::{ ASSET, ASSET_SHA, Arg, Command, Context, DeviceBuffer, EPS, Error, LAYER_BYTES, Module, OriginalCapture, diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/original_verify_window.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/original_verify_window.rs index 282c94d4..5a75b907 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/original_verify_window.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/original_verify_window.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyWindow`: `validate_mtp_geometry`, `retained_residual_address_for_mtp`, `actual_mtp_resi... -//! Functions: `verify_assets_sealed`. +//! Geometry admission and residual-bank access of OriginalVerifyWindow for the MTP drafter, plus the probe that tells +//! whether the two verifier PTX assets are sealed. use super::{ASSET, ASSET_SHA, Error, OriginalVerifyWindow, QSA_ASSET, QSA_ASSET_SHA, Result, handle, sealed_asset}; diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs index f38438f3..de6a6b3d 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyGdnJournal`: `capture_ladder`, `capture_ple_snapshot`, `validate_completed_logits`, `lo... -//! Methods of `OriginalVerifyResources`: `new`. +//! Journal captures of the verify window: the ladder diagnostic, PLE history snapshots, and the finite scan over the +//! head logits (post-drain or as graph nodes); also the verify resource bundle and the journal accessors. use super::{ Arg, Command, Context, DeviceBuffer, Error, OriginalCapture, OriginalGraphResources, OriginalVerifyBank, diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs index 812d175d..deccfa88 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyGdnJournal`: `capture_layer_stage`, `stage_operands`, `stage_commands`, `stage_conv_com... -//! Methods of `FusedSpans`: `launch`. Functions: `single_command`. Defines `StageOperands`, `FusedSpans`. +//! GDN layer stage (convolution, alpha/beta, recurrence) and the commit graph of the journal: per-layer commit and +//! the fused 36-layer commit launch, with the affine-span checks the fused form relies on. use super::{ Arg, Command, EPS, Error, LAYER_BYTES, OriginalCapture, OriginalGraphResources, OriginalVerifyGdnJournal, diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs index ce3c4645..22e14570 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyGdnJournal`: `ple_buffer`, `submit`, `submit_qsa`, `submit_with` and 16 more. -//! Functions: `launch_commands`, `admit_window_launches`, `window_module`. +//! Launch plumbing of the GDN journal: admits and submits window commands and launches on the capture stream, loads +//! window assets, and records the graph inputs, profile stamps and the group doorbell. use super::{ Arg, Command, Context, DeviceBuffer, Error, Module, OriginalCapture, OriginalVerifyGdnJournal, Rc, Result, chain, diff --git a/crates/cuda-driver/src/original_verify/proj/admit_matrix.rs b/crates/cuda-driver/src/original_verify/proj/admit_matrix.rs index b3ee4320..547d2866 100644 --- a/crates/cuda-driver/src/original_verify/proj/admit_matrix.rs +++ b/crates/cuda-driver/src/original_verify/proj/admit_matrix.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyProjBinding`: `new`, `gdn_addrs`, `qsa_addrs`, `assets`. Functions: `admit_matrix`. -//! Split out of `proj` to keep its files under the line limit. +//! Binding of the native projection matrices of the verifier window: admits each GDN and QSA matrix by exact byte size +//! and hands out per-layer device addresses and the sealed assets those weight types need. use super::{ AssetSpec, Context, Error, GdnProjectionAddrs, HEAD_IQ, HEAD_NATIVE, NativeWeight, OriginalVerifyGdnProjections, diff --git a/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs b/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs index 8f2cd43f..03f7cc54 100644 --- a/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs +++ b/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs @@ -1,5 +1,5 @@ -//! Defines `NativeWeight`, `OriginalVerifyNativeMatrix`, `OriginalVerifyGdnProjections` and 4 more. -//! HEAD_IQ_ENTRIES, BF16_ENTRIES, HEAD_NATIVE, HEAD_IQ, BF16, NativeWeight .... +//! Sealed PTX asset specs of the projection family (native MMVQ, IQ-type MMVQ, BF16 GEMV) with their entry-name tables, +//! and the native weight, projection matrix and address types shared by the projection planners. use super::{AssetSpec, DeviceRef, HEAD_NATIVE_ENTRIES}; diff --git a/crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs b/crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs index 99bd4c56..d786d79c 100644 --- a/crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs +++ b/crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs @@ -1,5 +1,5 @@ -//! Items of the parent module. -//! HEAD_NATIVE_ENTRIES. +//! Entry-point name table of the sealed native head PTX asset (q8_1 quantize and the MMVQ kernel variants), +//! kept apart because it is a long literal list checked against the PTX. pub(super) const HEAD_NATIVE_ENTRIES: &[&str] = &[ "head_quant", diff --git a/crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs b/crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs index 54f53021..89803530 100644 --- a/crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs +++ b/crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs @@ -1,5 +1,5 @@ -//! Methods of `StridedRows`: `new`. Methods of `Bf16GemvExtents`: `new`. -//! Functions: `q8_1_row_bytes`, `is_iq_kind`, `mmvq_assets`, `mmvq_asset` and 17 more. +//! Launch planners of the projection family: q8_1 quantization, native MMVQ and BF16 GEMV (extents, strides, kernel +//! entry choice), and the window projection producers. Pure addresses in, Launch out. use super::{ A, ArenaMap, AssetSpec, BF16, BF16_ENTRIES, Error, GdnProjectionAddrs, HEAD_IQ, HEAD_NATIVE, Launch, LaunchExtent, diff --git a/crates/cuda-driver/src/original_verify/qsa/assets.rs b/crates/cuda-driver/src/original_verify/qsa/assets.rs index 82c85dd3..d5321190 100644 --- a/crates/cuda-driver/src/original_verify/qsa/assets.rs +++ b/crates/cuda-driver/src/original_verify/qsa/assets.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyQsaPolicy`: `mode17`, `validate`. Methods of `QsaRope`: `new`, `from_rope`, `is_identity`. -//! Functions: `assets`, `cluster_assets`, `daily_assets`, `shared_attributes` and 4 more. +//! QSA (quantized sparse attention) setup of the verifier window: sealed assets and shared-memory attributes, the +//! mode17 policy and its validation, RoPE constants, and the KV and weight bindings with their admission checks. use super::{ ATTENTION, ATTN_CHUNK, AssetSpec, CLUSTER, CLUSTER_ENTRIES, Context, DECODE_POSTOPS, Error, GATE, KV_APPEND, diff --git a/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs index 39d1eeed..ae08106f 100644 --- a/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs +++ b/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `qsa_window_prelude_rows`, `qsa_window_query_key_paths`, `qsa_window_select_and_attend`. -//! Split out of `qsa` to keep its files under the line limit. +//! Parent of QsaWindow, the launch planner of one QSA layer in the verifier window; its submodules split the prelude +//! rows, the query/key paths and the select-and-attend steps while sharing these imports. use super::{ A, ATTENTION, ATTN_CHUNK, ArenaMap, Bf16GemvExtents, CLUSTER, CLUSTER_ENTRIES, CLUSTER_MAX_QUERIES, DECODE_POSTOPS, diff --git a/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs index 0459ec45..85d5d571 100644 --- a/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs +++ b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaWindow`: `new`, `span`, `rows`, `rms` and 12 more. Functions: `append_launch`. -//! Split out of `qsa_window` to keep its files under the line limit. +//! QsaWindow launch planners for the query, key and index paths: RMS norm and RoPE, indexer k and q projections, +//! k norm with RoPE, q/gate split, and the KV append into the resident pool and host copy. use super::{ A, ArenaMap, Bf16GemvExtents, DECODE_POSTOPS, EPS, Error, KV_APPEND, Launch, LaunchExtent, OriginalVerifyGeometry, diff --git a/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs index 7013d241..f2f8030e 100644 --- a/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs +++ b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaWindow`: `block_scores_topk`, `scores_launch`, `topk_launch`, `kv_resolve` and 5 more. -//! Defines `AttnDims`, `AttnSpans`. +//! QsaWindow launch planners for block selection and attention: block scores and top-k, KV streaming resolve, +//! split decode attention (chunk and merge) and the output gate. use super::{ A, ATTENTION, ATTN_CHUNK, CLUSTER, CLUSTER_ENTRIES, CLUSTER_MAX_QUERIES, Error, GATE, Launch, LaunchExtent, diff --git a/crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs b/crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs index cf50a6f0..df488b80 100644 --- a/crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs +++ b/crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyCpuSink`: `with_output`. -//! Methods of `OriginalVerifier`: `new`, `open`, `unopened`, `bank` and 9 more. +//! Construction and window recording of OriginalVerifier: opens the bank, records the window and commit graphs (fused +//! or per-layer commit), sets the PCIe mode and split, plus the CPU sink output accessor. use super::{ Context, Error, OriginalCapture, OriginalCapturePolicy, OriginalEventKind, OriginalNativeHeadGraphResources, diff --git a/crates/cuda-driver/src/original_verify/schedule/original_verifier.rs b/crates/cuda-driver/src/original_verify/schedule/original_verifier.rs index 7fc00a37..ae8a90ba 100644 --- a/crates/cuda-driver/src/original_verify/schedule/original_verifier.rs +++ b/crates/cuda-driver/src/original_verify/schedule/original_verifier.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifier`: `run`, `commit`, `commit_after_stage`, `complete_commit_sync`. -//! Split out of `schedule` to keep its files under the line limit. +//! Run and commit entry points of OriginalVerifier: run executes the cached window graph with the CPU/GPU split, +//! commit stages the accepted rows and launches the commit graph, asynchronously or drained. use super::{ Error, NativeHeadSampling, OriginalGpuStream, OriginalNativeHeadGraphResources, OriginalVerifier, diff --git a/crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs b/crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs index 21d63c85..dd04915f 100644 --- a/crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs +++ b/crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifier`: `pending_commit_event`, `wait_commit`, `complete_pending_commit`, `discard_window`... -//! Split out of `schedule` to keep its files under the line limit. +//! Post-run lifecycle of OriginalVerifier: pending commit wait, discarding a window for a retry, access to the +//! completed window, committed GDN and QSA state, diagnostics, and the watchdog release of the GPU waits. use super::{ DeviceBuffer, Duration, Error, Instant, OriginalGpuEvent, OriginalNativeHeadGraphResources, OriginalVerifier, diff --git a/crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs b/crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs index f443dc7d..f09ebd14 100644 --- a/crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs +++ b/crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifier`: `read_logit_rows`, `copy_logits`, `window_logprobs`, `window_logprobs_topk` and 7 ... -//! Implements `Drop for OriginalVerifier`. +//! Read-back side of OriginalVerifier: logits and logprob rows, bring-up residual and ladder dumps, the bounded +//! stream drain that aborts GPU waits, and the close and Drop teardown. use super::{ Context, DeviceBuffer, Duration, Error, Instant, LogitRows, LogprobReadout, OriginalGpuStream, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules.rs b/crates/cuda-driver/src/original_verify/share_window_modules.rs index 47a365c8..82e1b5b3 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `verify_bank_and_canonical_gdn_open`, `original_verify_bank`, `physical` and 1 more. -//! Split out of `original_verify` to keep its files under the line limit. +//! Parent of the verify bank files: opening the bank and canonical GDN, the bank staging, its physical resources and +//! the plan and window row accessors, with the imports they share. use super::{ ASSET, ASSET_SHA, Arg, CANONICAL_BYTES, Canonical, Cell, Command, Context, DeviceBuffer, DeviceRef, ENTRIES, Error, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/original_verify_bank.rs b/crates/cuda-driver/src/original_verify/share_window_modules/original_verify_bank.rs index da0a506e..fabcc860 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules/original_verify_bank.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules/original_verify_bank.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyBank`: `new`, `staged_window`, `staged_keep`, `completed_row` and 14 more. -//! Split out of `share_window_modules` to keep its files under the line limit. +//! Host-side staging of OriginalVerifyBank: creation, staging of tokens, positions, PLE values and the commit keep +//! count into the mapped words, completed-row access, and the release of the GPU waits. use super::{ ASSET, ASSET_SHA, Context, Error, OriginalVerifyBank, OriginalVerifyGeometry, OriginalVerifyLayout, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/physical.rs b/crates/cuda-driver/src/original_verify/share_window_modules/physical.rs index 844716f7..ff32cce0 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules/physical.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules/physical.rs @@ -1,5 +1,5 @@ -//! Methods of `Physical`: `validate`, `span`, `ensure_window_assets`, `select_ready` and 15 more. -//! Implements `Drop for Physical`. Functions: `group_specs`, `reuse_loaded`. Defines `WindowGroup`, `ReadyModule`. +//! Physical: the device resources behind a verify bank (kernel modules, mapped staging, arena, profile stamps), its +//! window-module loading with sharing across banks of a context, shared-memory configuration, and teardown. use super::{ Cell, Context, DeviceBuffer, ENTRIES, Error, MappedAllocation, Module, OriginalVerifyLayout, Physical, QSA_ENTRIES, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs index e9c57ef3..7b4bff6a 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_and_canonical_gdn_open.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_verify_canonical_gdn`, `original_verify_bank`. -//! Methods of `Canonical`: `upload_layers`, `reseed`, `allocated_bytes`, `validate_context` and 4 more. +//! Entry points that open a verify bank and the canonical GDN image on a Context, the checked helpers shared by the +//! bank files (admit, poison, sealed asset), and the canonical state upload, reseed, read and close. use super::{ ASSET, ASSET_SHA, Arg, CANONICAL_BYTES, Canonical, Cell, Command, Context, DeviceBuffer, ENTRIES, Error, diff --git a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs index 7c1b10b5..e3337dc4 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules/verify_bank_plan_and_window_rows.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyBank`: `read_profile`, `doorbell_sequence`, `publish_empty_plan`, `zero_plan_header` an... -//! Methods of `OriginalVerifyRow`: `position`, `validate_context`, `residual`. +//! Bank-side plan and journal access: profile read, doorbell sequence, empty plan publication, PCIe source retention, +//! GDN journal construction with operand checks, and the accessors of completed rows and windows. use super::{ Context, DeviceBuffer, DeviceRef, Error, MappedAllocation, OriginalGraphResources, OriginalVerifyBank, diff --git a/crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs b/crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs index 7d9be575..b1c95a89 100644 --- a/crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyExpertLayout`: `new`, `with_role_bytes`, `blob_bytes`, `role_bytes`. -//! Methods of `OriginalVerifyWindowResources`: `new`, `rows`, `with_projections`, `with_gr` and 4 more. +//! Resources of a recorded verify window: the list of every sealed kernel asset, the expert layout, and the window +//! resource bundle that attaches projections, GR, QSA and MoE bindings, loads assets before capture and serves weights. use super::{ AssetSpec, Context, Error, GdnProjectionAddrs, GrConfig, HcHalf, MoeLayerAddrs, OriginalGraphResources, diff --git a/crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs b/crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs index f9fdc60c..b787c3c8 100644 --- a/crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifier`: `record_literal_window`, `record_all`. -//! Functions: `resolve_cluster_topk`, `resolve_sm120_switches`, `pcie_role_bytes`, `graph_oom_at`. +//! Recording of all verify window graphs (T = 1..max_t) and the commit graph by OriginalVerifier, with the +//! per-recording resolution of cluster top-k and sm_120 switches, PCIe role bytes, and graph out-of-memory naming. use super::{ Error, OriginalVerifier, OriginalVerifyGraphResources, OriginalVerifyWindowOps, OriginalVerifyWindowResources, diff --git a/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs b/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs index e4e15ee6..eeab0dc1 100644 --- a/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyWindowOps`: `capture_finite_verdict`, `plan_copy_addresses`, `wait_plan_glue`, `copy_hi... -//! Implements `WindowOps for OriginalVerifyWindowOps`. Functions: `pcie_fetch_launch`, `pcie_rebase_command`. +//! The WindowOps implementation that turns each window step (embed, GR, projections, GDN, QSA, router, experts, PCIe +//! staging, combine, head) into recorded launches, plus the finite-verdict capture and PCIe fetch helpers. use super::side_qsa_branches::QsaSideLayer; use super::{ diff --git a/crates/cuda-driver/src/original_verify_gpu_plan/tests.rs b/crates/cuda-driver/src/original_verify_gpu_plan/tests.rs index 6af32b33..7fed2165 100644 --- a/crates/cuda-driver/src/original_verify_gpu_plan/tests.rs +++ b/crates/cuda-driver/src/original_verify_gpu_plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the GPU plan sink: DMA option defaults per platform, the plan block carve, empty and corrupt plans, +//! and when flag B waits for the PCIe staging copies. use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_gr/tests.rs b/crates/cuda-driver/src/original_verify_window_gr/tests.rs index 22c6cd31..24ac948e 100644 --- a/crates/cuda-driver/src/original_verify_window_gr/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_gr/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the GR window planner: launch words, variant choice from card limits, fused and tiled down kernels, +//! head chain and head mix, against a fake arena layout; submodules hold the per-kernel cases. use super::super::kernels::{LayoutMap, test_geometry}; use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_moe/tests.rs b/crates/cuda-driver/src/original_verify_window_moe/tests.rs index a40b5bed..48a3dd22 100644 --- a/crates/cuda-driver/src/original_verify_window_moe/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_moe/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the MoE window planner against a fake arena: launch ABI against the PTX entries, plus the PCIe staging copy +//! kernel, down sub16 plan, hit add and shared gate cases in the submodules. use super::super::kernels::{LayoutMap, test_geometry}; use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_ops/tests.rs b/crates/cuda-driver/src/original_verify_window_ops/tests.rs index fa2d0633..317c9682 100644 --- a/crates/cuda-driver/src/original_verify_window_ops/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_ops/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the window asset and layout bookkeeping: graph out-of-memory naming, sealed and unique window assets, +//! and the expert layout bounds. use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_planner/tests.rs b/crates/cuda-driver/src/original_verify_window_planner/tests.rs index 0bc5d7b1..bd115e29 100644 --- a/crates/cuda-driver/src/original_verify_window_planner/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_planner/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the whole window recorder with a fake WindowOps and weights: the planned launch order for every window +//! size and group, with submodules for the fused GR down, QSA prelude, head chain and combine switches. use super::super::kernels::{LayoutMap, test_geometry}; use super::super::moe::MoeLayerAddrs; diff --git a/crates/cuda-driver/src/original_verify_window_proj/tests.rs b/crates/cuda-driver/src/original_verify_window_proj/tests.rs index a1523298..5376dd99 100644 --- a/crates/cuda-driver/src/original_verify_window_proj/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_proj/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the projection planners: pinned assets and entries, q8_1 quantize and MMVQ dispatch, BF16 GEMV single or +//! multi choice, IQ kinds, and the window projection addresses and matrix sizes. use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_qsa/tests.rs b/crates/cuda-driver/src/original_verify_window_qsa/tests.rs index 66b53468..156683d0 100644 --- a/crates/cuda-driver/src/original_verify_window_qsa/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_qsa/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the QsaWindow planners against a fake arena: launch ABI against the PTX entries; submodules cover the +//! q path splits, sealed asset pins and the Original weight sizes. use super::super::kernels::{LayoutMap, test_geometry}; use super::*; diff --git a/crates/cuda-driver/src/original_verify_window_record/tests.rs b/crates/cuda-driver/src/original_verify_window_record/tests.rs index 5bb69f12..78723db4 100644 --- a/crates/cuda-driver/src/original_verify_window_record/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_record/tests.rs @@ -1,4 +1,4 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the window recorder call order with a logging WindowOps: layer sequences, rings, flags and split windows. use super::*; diff --git a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/blas.rs b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/blas.rs index ae7371a4..280e261f 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/blas.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/blas.rs @@ -1,5 +1,5 @@ -//! Methods of `Blas`: `load`, `init_handle`, `stream`, `gemm` and 7 more. -//! Functions: `gemm_shape_admitted`, `gdn_shape_admitted`, `gdn_bf16_shape_admitted`, `gdn_f16_shape_admitted`. +//! cuBLAS wrapper of the batch FFI: loads the library with a private stream and workspace, the single GemmEx call and +//! its BF16 and F16 entry points, and the admission of the closed Original GEMM and GDN shapes. use super::{ Blas, BufferHandle, Create, Destroy, Error, GdnGemmLayout, Gemm, GemmDims, GemmOperands, GemmScalars, InputType, diff --git a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs index b00bce01..cc1176a4 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/kernel_module_launch_and_close.rs @@ -1,5 +1,5 @@ -//! Methods of `Blas`: `close_inner`. -//! Methods of `KernelModule`: `load`, `init_functions`, `launch`, `launch_dynamic` and 5 more. +//! Closing of the cuBLAS wrapper, and the KernelModule that loads a PTX image and launches its entries (plain, dynamic +//! shared memory, cluster), reports the device geometry, and closes. use super::{ BatchArg, Blas, CStr, ClusterShape, Destroy, Error, FuncSetAttribute, KernelArguments, KernelModule, Launch, diff --git a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/library.rs b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/library.rs index 2dbc80b2..b48f9d0c 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/driver_backed/library.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/driver_backed/library.rs @@ -1,5 +1,5 @@ -//! Methods of `Library`: `open`. Implements `Drop for Library`. Functions: `check`. -//! Split out of `enabled` to keep its files under the line limit. +//! Owned dlopen handle of the private driver library used by the PLE batch FFI (open, dlclose on drop) and the +//! check helper that turns a nonzero driver return code into Error::Driver. use super::{CStr, Error, Library, Result, c_int}; diff --git a/crates/cuda-driver/src/ple_batch_ffi/kernel_arguments.rs b/crates/cuda-driver/src/ple_batch_ffi/kernel_arguments.rs index 49a96990..7f8d816a 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/kernel_arguments.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/kernel_arguments.rs @@ -1,5 +1,5 @@ -//! Methods of `KernelArguments`: `new`. Methods of `Blas`: `load`, `stream`, `gemm_bf16`, `gemm_f16` and 4 more. -//! Split out of `ple_batch_ffi` to keep its files under the line limit. +//! Argument pack for PLE batch kernel launches, plus the stub Blas and KernelModule used on builds without a 64-bit +//! Linux/Windows CUDA driver: every operation there answers Error::UnsupportedPlatform. use super::{BatchArg, KernelArguments}; diff --git a/crates/cuda-driver/src/ple_batch_queue/assets.rs b/crates/cuda-driver/src/ple_batch_queue/assets.rs index 5df09b44..a447fa5d 100644 --- a/crates/cuda-driver/src/ple_batch_queue/assets.rs +++ b/crates/cuda-driver/src/ple_batch_queue/assets.rs @@ -1,5 +1,6 @@ -//! Methods of `PleBatchCompletion`: `rows`, `numerical_refusal`, `take_row`. -//! Methods of `PleBatchQueue`: `read_row`, `settle_row`. Functions: `assets`, `check_ptx`. +//! Sealed PTX assets and row read-back of the PLE batch queue: verifies pinned PTX digest and length, and reads +//! one completed row (streams and history) to the host, poisoning the context if the drain is uncertain. +//! Also holds the Context constructors of the queue and the completion that reports numerical refusals. use super::{ BufferHandle, Context, Error, PACK_PTX, PACK_PTX_BYTES, PACK_PTX_SHA256, PTX, PTX_BYTES, PTX_SHA256, diff --git a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_drop.rs b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_drop.rs index bfc3a540..e31d8223 100644 --- a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_drop.rs +++ b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `Command`: `launch`. Methods of `ScanExtent`: `new`. Implements `Drop for PleBatchQueue`. -//! Functions: `push`, `scan`, `staging`, `float_staging` and 2 more. Defines `ScanExtent`. +//! Command list primitives of the PLE batch queue: how a recorded Kernel or Gemm command is launched, helpers that +//! append kernel and finite-scan commands, host staging/decode of f32 buffers, and the queue Drop (best-effort close). use super::{A, Blas, BufferHandle, Command, Error, KernelArguments, KernelModule, PleBatchQueue, Result}; use crate::ple_batch_ffi::{GemmDims, GemmOperands, GemmScalars, LinearLaunch}; diff --git a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_bring_up.rs b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_bring_up.rs index 7ca3ab91..89e5c30a 100644 --- a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_bring_up.rs +++ b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_bring_up.rs @@ -1,5 +1,6 @@ -//! Methods of `PleBatchQueue`: `new`, `new_capacity`, `init_resources`, `load_modules` and 9 more. -//! Functions: `batch_sizes`, `check_required`. +//! Bring-up and invariants of the PLE batch queue: sizes its 15 device buffers for a row capacity, checks the memory +//! budget, loads the pack and batch kernel modules, and validates that buffers and weights belong to the context, have +//! the right size and do not overlap. use super::{ BufferHandle, Context, DeviceBuffer, ENTRIES, Error, KernelModule, PACK_ENTRIES, PLE_BATCH_QUEUE_BYTES, diff --git a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_close.rs b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_close.rs index 095c1c2f..837b4bec 100644 --- a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_close.rs +++ b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_close.rs @@ -1,5 +1,5 @@ -//! Methods of `PleBatchQueue`: `close`, `close_inner`, `close_guard`. Functions: `close_or_leak`, `poison_on_error`. -//! Split out of `ple_batch_queue_methods` to keep its files under the line limit. +//! Teardown of the PLE batch queue: closes kernel modules and releases device buffers under the context guard, and +//! leaks them instead of freeing when the context is poisoned, so a failed close never double-frees. use super::{Context, Error, PleBatchQueue, Result, combine}; use crate::CurrentGuard; diff --git a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs index a60cac91..4c5f9ce3 100644 --- a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs +++ b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs @@ -1,5 +1,5 @@ -//! Methods of `PleBatchQueue`: `compose`. -//! Split out of `ple_batch_queue_methods` to keep its files under the line limit. +//! The public compose entry of the PLE batch queue: stages a batch, uploads, launches the kernels and GEMMs, reads +//! the numerical statuses back and settles the result; the phase helpers it calls live in compose_phases. use super::{NativeBatchWorkspace, PleBatchCompletion, PleBatchQueue, PleBatchSources, PleClosedWeights, Result}; diff --git a/crates/cuda-driver/src/projection_grids_and_bounds.rs b/crates/cuda-driver/src/projection_grids_and_bounds.rs index efab9b9a..f280237a 100644 --- a/crates/cuda-driver/src/projection_grids_and_bounds.rs +++ b/crates/cuda-driver/src/projection_grids_and_bounds.rs @@ -1,5 +1,5 @@ -//! Functions: `q4_k_native_indices_fit`, `q4_k_last_signed_byte_offset`, `bounded_projection_size`, `check_projectio... -//! Split out of `crate` to keep its files under the line limit. +//! Host-side shape admission of dense Q4_K and generic projections and of Q5_K: byte sizes, quantizer and projection +//! grids, the signed 32-bit offset limit of the Q4_K PTX, and the alias/extent checks of the three buffers. use super::{DenseFormat, Error, ProjectionKind, ProjectionShape, ProjectionSpec, Q5KShape, Result, ffi, valid_size}; diff --git a/crates/cuda-driver/src/prompt_sync_trace_types.rs b/crates/cuda-driver/src/prompt_sync_trace_types.rs index ab682ac9..11d42a23 100644 --- a/crates/cuda-driver/src/prompt_sync_trace_types.rs +++ b/crates/cuda-driver/src/prompt_sync_trace_types.rs @@ -1,5 +1,5 @@ -//! Defines `PromptSyncTrace`, `Driver`, `Device` and 8 more. -//! PromptSyncTrace, Error, Result, Bf16ProjectionShape, Driver, Device .... +//! Core handle types of the CUDA driver crate: Driver, Device, Context (budget, poison flag, per-context kernel slots), +//! the fixed-kernel selectors, the projection shape record and the PromptSyncTrace bring-up guard. use super::{Cell, DeviceBuffer, Rc, RefCell, experimental, ffi, kar_decode_levels, original_verify, qwen_dispatch}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] diff --git a/crates/cuda-driver/src/q5_kshape_types.rs b/crates/cuda-driver/src/q5_kshape_types.rs index 638b5f60..5da4b6f1 100644 --- a/crates/cuda-driver/src/q5_kshape_types.rs +++ b/crates/cuda-driver/src/q5_kshape_types.rs @@ -1,5 +1,5 @@ -//! Defines `Q5KShape`, `Q6KShape`, `MatvecShape` and 2 more. -//! Q5KShape, Q6KShape, MatvecShape, CurrentGuard, DeviceBuffer. +//! Plain records shared by the projection code: Q5_K, Q6_K and matvec shapes (byte sizes and launch grids), the +//! CurrentGuard push/pop context guard and DeviceBuffer, the exact byte allocation borrowed from a Context. use super::{Context, PhantomData, Rc, ffi}; diff --git a/crates/cuda-driver/src/q6_k_shape.rs b/crates/cuda-driver/src/q6_k_shape.rs index dfd983e3..55234643 100644 --- a/crates/cuda-driver/src/q6_k_shape.rs +++ b/crates/cuda-driver/src/q6_k_shape.rs @@ -1,5 +1,5 @@ -//! Functions: `q6_k_shape`, `q6_abi_extents`, `q6_checked_bytes`, `q6_grids` and 4 more. -//! Split out of `crate` to keep its files under the line limit. +//! Shape admission for Q6_K projections, the f32 matvec and the vector add: checked byte sizes, ABI extents and launch +//! grids, plus the allocation checks that keep the matvec output from aliasing its inputs. use super::{Error, MatvecShape, Q6KShape, Result, ffi, valid_size}; diff --git a/crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs b/crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs index 3941d94a..f6e73761 100644 --- a/crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs +++ b/crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`. Functions: `upload`, `download`, `with_gpu`, `handle` and 8 more. -//! Split out of `gpu_tests` to keep its files under the line limit. +//! Shared fixtures of the QSA late-kernel GPU tests: a xorshift Rng, device upload/download, with_gpu setup, +//! synthetic block scores and step words, and the checks of the fast top-k and score scan against the Original kernels. use super::{A, CAP, Context, DeviceBuffer, Driver, ENABLE, KernelArguments, Rng, SelectionRig, TOPK_FAST, scan_both}; use crate::ple_batch_ffi::LinearLaunch; diff --git a/crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs b/crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs index 306771e3..2dacf89b 100644 --- a/crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs +++ b/crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs @@ -1,5 +1,5 @@ -//! Functions: `scan_both`, `bench_cases`, `bench_scores`, `topk_variants` and 4 more. -//! Split out of `gpu_tests` to keep its files under the line limit. +//! GPU test helpers that run the Original score scan and the late fast scan on the same scores, the benchmark case +//! table with its synthetic score generator, and the top-k variants (ref, fast, wide, sample, cluster) that are timed. use super::{ A, BenchRig, CAP, Context, DeviceBuffer, KernelArguments, Rng, Run, SCORE_SCAN_FAST, SelectionRig, TOPK_FAST, diff --git a/crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs b/crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs index d2ad47ab..ab55c2fc 100644 --- a/crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs +++ b/crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs @@ -1,5 +1,5 @@ -//! Functions: `time_scores_and_topk`, `time_warm`. -//! Split out of `gpu_tests` to keep its files under the line limit. +//! GPU timing helper of the QSA late tests: launches the decode scores kernel and the reference top-k at one +//! (position, query count) shape and reports warm microseconds per launch. use super::{ A, CAP, Context, DeviceBuffer, KernelArguments, KernelModule, Rng, decode_inputs, handle, topk_args, upload, diff --git a/crates/cuda-driver/src/qsa_native_batch/native_projections.rs b/crates/cuda-driver/src/qsa_native_batch/native_projections.rs index 75aec2f5..ea836fd1 100644 --- a/crates/cuda-driver/src/qsa_native_batch/native_projections.rs +++ b/crates/cuda-driver/src/qsa_native_batch/native_projections.rs @@ -1,5 +1,6 @@ -//! Methods of `QsaNativeBatchWorkspace`: `project`, `project_io`, `launch_project`, `reset_status` and 10 more. -//! Methods of `ProjectionShape`: `new`, `inputs`. Implements `Drop for QsaNativeBatchWorkspace`. +//! The projection stage of the QSA native batch workspace: packs activations, scans inputs and weights for non-finite +//! values, dequantizes quantized weights to F16 and runs the vendor GEMMs for the five input projections and the gated +//! Out projection, then settles the status words, with its close and Drop. use super::{ A, DeviceBuffer, Error, KernelArguments, KernelModule, NativeBatchWorkspace, QsaGatedAttention, QsaInputWeights, diff --git a/crates/cuda-driver/src/qsa_native_batch/qsa_native_kind.rs b/crates/cuda-driver/src/qsa_native_batch/qsa_native_kind.rs index 5ef24352..31fbad64 100644 --- a/crates/cuda-driver/src/qsa_native_batch/qsa_native_kind.rs +++ b/crates/cuda-driver/src/qsa_native_batch/qsa_native_kind.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaNativeKind`: `entry`, `block`. -//! Methods of `Context`: `qsa_native_batch_workspace`, `qsa_native_batch_workspace_for_prompt`. +//! Construction and buffer handling of the QSA native batch workspace: weight format table (Q4_K, Q5_K, Q6_K, +//! IQ4_XS), capacity and budget admission, module loading, span checks, host upload and readback, Context hooks. use super::{ Context, DEQUANT_PTX, DeviceBuffer, Error, KernelModule, NativeBatchWorkspace, PTX, QsaNativeBatchWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs index 9270213a..565f926b 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs @@ -1,5 +1,5 @@ -//! Methods of `KernelPlan`: `entry`. Defines `KernelPlan`, `KernelEntry`, `AttnPasses` and 1 more. -//! Split out of `qsa_prompt_attention` to keep its files under the line limit. +//! Plain types that describe one QSA prompt attention launch: the kernel plan (module, entries, shared bytes), the +//! launch target, the device addresses the three passes use, and the Runner signature; the logic lives in submodules. use super::{ Arg, Arguments, Context, DeviceBuffer, DeviceCaps, Error, LaunchGeometry, Module, NativeBatchWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs index ce58130e..ef144870 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/attention_passes.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptAttention`: `attend_kernel`, `ensure_plan`, `validate_stage`, `output_address` and 10 more. -//! Methods of `KernelPlan`: `of`. +//! The launch sequence of QSA prompt attention: chooses the kernel plan, admits the Q/IDs/steps inputs (exact sizes, no +//! aliasing with the stage, workspace or own buffers), then runs guard scan, attention and output scan; also closes it. use super::{ Arg, Arguments, AttnPasses, DeviceBuffer, Error, KernelPlan, LaunchGeometry, Module, NativeBatchWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs index 689506f3..92e8a927 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/prompt_attention_owner.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptAttention`: `new`, `new_capacity`, `with_module`, `allocate_buffers` and 13 more. -//! Split out of `attention_kernel_plan_and_passes` to keep its files under the line limit. +//! The QsaPromptAttention owner: allocation of its output bank and status word under the memory budget, module loading, +//! state accessors and the public attend entries that select the attention kernel for the device. use super::{ Arguments, Context, DeviceBuffer, DeviceCaps, Error, KernelEntry, LaunchGeometry, Module, NativeBatchWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs index ab6e1b71..1ea6e113 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes/reject_mutual_alias.rs @@ -1,5 +1,5 @@ -//! Functions: `reject_mutual_alias`, `admit_budget`. -//! Split out of `attention_kernel_plan_and_passes` to keep its files under the line limit. +//! Admission checks of QSA prompt attention: no two input buffers may overlap, and the output bank plus status word +//! and a 128 MiB reserve must fit the context budget and the free device memory. use super::{Context, DeviceBuffer, Error, Result}; diff --git a/crates/cuda-driver/src/qsa_prompt_attention/qsa_attention_inputs.rs b/crates/cuda-driver/src/qsa_prompt_attention/qsa_attention_inputs.rs index 7d7c60f4..a6eedcfd 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/qsa_attention_inputs.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/qsa_attention_inputs.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaAttentionInputs`: `new`. -//! Methods of `Context`: `qsa_prompt_attention`, `qsa_prompt_attention_for_capacity`. +//! Validated inputs of QSA prompt attention (Q, selected IDs and steps buffers with exact sizes for t rows) and the +//! Context constructors of QsaPromptAttention. use super::{Context, DeviceBuffer, Error, QsaAttentionInputs, QsaPromptAttention, Result, checked}; diff --git a/crates/cuda-driver/src/qsa_prompt_attention/qsa_prompt_attention_drop.rs b/crates/cuda-driver/src/qsa_prompt_attention/qsa_prompt_attention_drop.rs index 15db6b8a..755436a0 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/qsa_prompt_attention_drop.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/qsa_prompt_attention_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptAttentionCompletion`: `rows`, `with_output`, `into_values`. -//! Implements `Drop for QsaPromptAttention`. Functions: `guard_grid`. +//! Result side of QSA prompt attention: the completion view of the output bank (rows, borrowed output, host copy +//! of the values), the Drop of the owner and the launch grid of the guard kernels. use super::{DeviceBuffer, Error, QsaPromptAttention, QsaPromptAttentionCompletion, Result}; diff --git a/crates/cuda-driver/src/qsa_prompt_index/append_select.rs b/crates/cuda-driver/src/qsa_prompt_index/append_select.rs index 458eefc5..596e9360 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/append_select.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/append_select.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `append_select_inner`, `check_select_inputs`, `select_bounds_ok`, `admit_ou... -//! Functions: `release_outputs`, `select_lengths_ok`. Defines `Outputs`. +//! Append-and-select entry of the QSA prompt index workspace: validates the prior image and row inputs, allocates and +//! alias-checks the five per-call output buffers, runs the index program and reads back the selection state. use super::{ CAP, DeviceBuffer, Error, IndexProgramSpans, NativeBatchWorkspace, QsaPromptIndexWorkspace, QsaPromptSelection, diff --git a/crates/cuda-driver/src/qsa_prompt_index/index_run.rs b/crates/cuda-driver/src/qsa_prompt_index/index_run.rs index 75b21c95..22163aa3 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/index_run.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/index_run.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `run`, `execute_run`. -//! Split out of `qsa_prompt_index` to keep its files under the line limit. +//! Non-resident run of the QSA prompt index program: uploads the prior image and rows, stages the commands and +//! executes them under the context guard, then checks the status words and the selected IDs. use super::run_phases::{HostStaging, RunPlan}; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/max_blocks.rs b/crates/cuda-driver/src/qsa_prompt_index/max_blocks.rs index b009dce6..52a69af9 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/max_blocks.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/max_blocks.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `qsa_prompt_index_workspace`, `qsa_prompt_index_workspace_for_capacity`. -//! Functions: `max_blocks`, `sizes`, `encode`. +//! Size constants of the QSA prompt index workspace derived from the serving context (score row stride, the eleven +//! buffer sizes), the f32 little-endian encoder for uploads and the Context constructors. use super::{Context, Error, QsaPromptIndexWorkspace, Result}; diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs index 2232faf6..c4bc5cbf 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `original_qsa_prompt_device`. -//! Functions: `native_block`, `native_entry`, `arena_span`, `common`. +//! Context entry point of the Original QSA prompt device, plus lookup of native weight block sizes and entries per +//! quantization kind and of the arena and common spans a chunk read exposes. use super::{ Context, OriginalDeviceGrRead, OriginalQsaPromptDevice, PrefillPhase, QsaNativeKind, QsaNativePacking, Result, S, diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs index fa131b98..f19a6140 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaPromptDevice`: `project`, `prepare`, `close`. -//! Split out of `prompt_device` to keep its files under the line limit. +//! Prepare step of the Original QSA prompt device: projects the chunk rows with native weights, runs the prompt index +//! program after the prior image, and returns the pending selection that complete() later finishes. use super::project_phases::{ProjectArgs, Projection}; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs index c2c08673..1eb1120c 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaPromptDevice`: `device_bytes`, `new`, `is_failed`, `allocated_bytes` and 2 more. -//! Split out of `prompt_device` to keep its files under the line limit. +//! Construction and admission of the Original QSA prompt device: device byte budget for a capacity, resource +//! allocation, ownership checks of weight buffers, and the admission that all spans are disjoint. use super::device_phases::{check_assets, index_for}; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs index 1bb8e191..922f3179 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs @@ -1,5 +1,5 @@ -//! Methods of `ResidentJob`: `run_index`. -//! Methods of `OriginalQsaPromptDevice`: `prepare_resident`, `resident_bounds`, `check_resident_idle`, `admit_budget... +//! Resident-mode prepare of the Original QSA prompt device: admits a chunk, projects it, runs the index program in the +//! private resident image and rolls it back to the checkpoint on failure; also the resident selection accessors. use super::{ ArenaRows, CAP, Context, DeviceBuffer, Error, IndexProgramSpans, NativeBatchWorkspace, OriginalDeviceGrRead, diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs index b0db41c3..75fdebe0 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaPromptDevice`: `new_resident`, `unloaded`, `init_resident`, `allocate_resident` and 2 more. -//! Functions: `check_sealed`, `resident_sizes`. +//! Bring-up of the resident Original QSA prompt device: checks the sealed kernels, sizes the placeholder index image, +//! checks the budget, allocates the buffers and loads the kernel modules. use super::{ Context, DECODE_POSTOPS, Error, GATE_PTX, GATE_SHA, INDEX, KernelModule, Module, OriginalQsaPromptDevice, diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs index 8280411d..b41e243b 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaResidentSelection`: `abort`, `complete`, `complete_inner`, `reject_weight_overlap` and 3 m... -//! Methods of `Context`: `original_qsa_resident_prompt_device`. +//! Public face of the resident Original QSA prompt device: the pending resident selection (abort, complete with KV +//! append, attention, Qf gate and native Out projection), the Out weight overlap check, and device byte accounting. use super::original_qsa_prompt_device::lap; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs index 5a44c48f..bbe78064 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaPromptDevice`: `close_inner`. -//! Methods of `OriginalQsaDeviceSelection`: `rows`, `first_position`, `final_index`, `validate` and 3 more. +//! The pending selection of the Original QSA prompt device and its completion (INT8 KV append, attention, gate and +//! native Out projection), plus the Drop of the device. use super::{ CAP, CompletedQsaKvAppend, Context, Error, NativeBatchWorkspace, OriginalDeviceBlock, OriginalQsaDeviceSelection, diff --git a/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs b/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs index 5d1c6d7f..cbb9bedf 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_read_and_close.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `read`, `final_state`, `final_state_with`, `read_finite` and 3 more. -//! Methods of `QsaPromptIndexPrefix`: `end_position`, `pooled`, `tail`, `dead`. +//! Result side of the QSA prompt index workspace: device-to-host readback of the final index state (pooled, tail, +//! dead rows, finite-checked), the accessors of states, prefixes and selections, and the close/Drop paths. use super::{ Context, DeviceBuffer, Error, QsaPromptIndexPrefix, QsaPromptIndexState, QsaPromptIndexWorkspace, diff --git a/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_workspace.rs b/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_workspace.rs index 63954029..5ad47d57 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_workspace.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/qsa_prompt_index_workspace.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `new`, `new_capacity`, `init_resources`, `prompt_device_bytes` and 11 more. -//! Functions: `capacity_sizes`, `check_assets_sealed`, `check_peak_budget`. +//! The QSA prompt index workspace owner: sizes, budget and sealed-asset admission, buffer allocation, weight and +//! overlap checks, input upload, and the public append_select entries for prompt rows and a single decode row. use super::{ CAP, Context, DECODE_POSTOPS, DeviceBuffer, Error, INDEX, Module, NativeBatchWorkspace, POSTOPS, QsaChunkRows, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs index f41b5adc..288a94e0 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaIndexCheckpoint`: `next_position`, `device_bytes`, `validate_retained`. -//! Methods of `Context`: `original_qsa_resident_index`. Implements `Drop for Saved`. Functions: `image_bytes`. +//! Checkpoint side of the resident QSA index: the byte size of an index image, the pooled checkpoint buffer that +//! returns to its pool on drop, checkpoint accessors and validation, and the Context constructor of the index. use super::{ CHECKPOINT_BYTES, Context, DeviceBuffer, Error, OriginalQsaIndexCheckpoint, OriginalQsaResidentIndex, POOLED, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs index afb3d7a5..bf117029 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaIndexBatch`: `first_position`, `rows`, `commit_prefix`, `publish` and 2 more. -//! Implements `Drop for OriginalQsaIndexBatch`. +//! One in-flight batch of the resident QSA index: after a verification run, commit_prefix publishes the accepted rows +//! (restoring the start checkpoint and replaying the prefix when only some are accepted) or aborts the batch. use super::{ Error, NativeBatchWorkspace, OriginalQsaIndexBatch, OriginalQsaIndexCheckpoint, QsaPromptIndexWorkspace, Result, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs index 5276a421..5b60cb1e 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaResidentIndex`: `device_bytes`, `new`, `empty`, `init_image` and 19 more. -//! Functions: `poison_unless_host_allocation`. +//! The OriginalQsaResidentIndex owner: allocates and zero-fills its device image, validates context and checkpoints, +//! takes checkpoints (also several fenced at once) from a pooled buffer, and restores one. use super::{ CHECKPOINT_BYTES, Cell, Context, Coverage, DeviceBuffer, Error, NativeBatchWorkspace, Origin, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs index 9377a905..53039661 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaResidentIndex`: `restore_private`, `checkpoint_ranges`, `placed`, `reset` and 16 more. -//! Implements `Drop for Placement`, `Drop for OriginalQsaResidentIndex`. Defines `Placement`. +//! Restore, reset and close of the resident QSA index, the window-state read/write used to undo a verifier window, +//! and the prefix-cache export/import of pooled key rows plus a checkpoint tail (Placement swaps in the image). use super::original_qsa_resident_index::poison_unless_host_allocation; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs index 486a90ce..6d8de783 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyQsaJournal`: `new`, `validate_context`, `identity`, `with_image` and 10 more. -//! Functions: `check_armed_window`, `image_addresses`, `image_clear`, `check_gamma` and 2 more. Defines `Indices`. +//! The OriginalVerifyQsaJournal owner: twelve per-layer resident QSA indices plus their mapped K/V journals for the +//! verifier window; validates that images, norm weights and RoPE tables are disjoint and idle, and begins a window. use super::verify_qsa_journal_loan::print_of; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs index cfbf4ed1..1106b3a9 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyRope`: `validate`, `validate_scalars`. Functions: `validate_angles`, `whole`, `overlaps`. -//! Split out of `verification_commit` to keep its files under the line limit. +//! Validation of the retained RoPE constants and tables of the verifier: scalars finite and in range, the angle +//! tables and position buffer whole and sized for the capacity, and the buffer overlap tests. use super::{Context, DeviceBuffer, DeviceRef, Error, OriginalVerifyRope, Result}; diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs index 58fe22fe..0acfb90d 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyQsaJournal`: `capture_commit_layer`, `capture_commit_fused`, `fused_layers`, `fused_wor... -//! Functions: `fused_io`. Defines `AppendPlan`, `LayerRows`, `AppendAddresses`. +//! Capture of the QSA index appends of a verifier window (row by row, or fused over the twelve layers for the commit) +//! and the host-side publish of mapped K/V prefixes from the append receipts. use super::original_verify_qsa_journal::{check_armed_window, image_addresses}; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs index 1f85ed17..9f3723fc 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalVerifyQsaJournal`: `complete_commit`, `check_all_in_flight`, `publish_window_indices`, `publi... -//! Split out of `verification_commit` to keep its files under the line limit. +//! End of a verifier window for the QSA journal: complete_commit publishes the K/V and index halves together, +//! discard_window undoes a refused window from the begin snapshots (index images, PLE history), and ownership return. use super::original_verify_qsa_journal::check_armed_window; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs index 301ef25b..d91ed4c2 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `replay_resident_prefix`, `replay_handles`, `upload_steps`, `check_replay` ... -//! Functions: `replay_steps`, `replay_commands`, `replay_append`, `launch_label` and 1 more. +//! Accepted-prefix replay of the resident QSA index: after a verifier window keeps only some rows, re-appends them +//! from the raw keys to the resident image with the decode-append kernel and finite scans, and labels the launches. use super::{ A, Arguments, CAP, DeviceBuffer, Error, Launch, NativeBatchWorkspace, QsaPromptIndexWorkspace, Result, combine, ffi, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs index 46a62e85..ed7b87c2 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptIndexWorkspace`: `run_resident_arena`, `run_arena`, `submit_arena`, `arena_steps` and 7 more. -//! Functions: `late_label`. +//! Resident-arena run of the QSA prompt index program: uploads step words and positions, submits the recorded plan +//! (with the late kernels when due) on the batch stream, and checks the status words. use super::{ ArenaCall, ArenaIo, ArenaPlan, ArenaRows, CAP, CurrentGuard, Error, IndexProgramSpans, LateQueue, diff --git a/crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs index bf474157..507c860d 100644 --- a/crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs @@ -1,5 +1,5 @@ -//! Methods of `Transfer`: `new`, `can_overlap`, `is_pending`, `begin` and 8 more. Implements `Drop for Transfer`. -//! Functions: `driver_code`, `poison_failed`, `check_ranges`, `load_side`. +//! Device-to-device copy engine of the resident QSA index (libcuda via dlopen): synchronous and fenced copies of +//! checkpoint ranges, and an optional side stream that overlaps the prior-KV prefix copy with the layer compute. use super::{Context, Error, NativeBatchWorkspace, Result, combine}; use std::ffi::c_void; diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs index 79d9a4db..d1c14349 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaMappedJournal`: `append_resident_decode`, `completed_kv_handles`, `admit_append`, `reject_... -//! Defines `AppendPlan`. +//! Resident append of the Original QSA mapped K/V journal for decode: admits new cells, guards, quantizes and writes +//! them to the resident pools and host copy; also the prefix-cache export/import of whole host pages. use super::{ Arg, Arguments, Cell, Context, Coverage, Error, LaunchGeometry, NativeBatchWorkspace, OriginalQsaMappedAppend, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs index a0564a20..69c31d14 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `qsa_mapped_journal_append_and_resolve`, `qsa_mapped_journal_prefix_and_prefetch`. -//! Split out of `mapped_journal` to keep its files under the line limit. +//! Module root of the mapped K/V journal pieces that deal with arena appends and with prefix tracking; it only +//! imports the shared names and declares the two submodules. use super::{ Cell, Context, Coverage, DeviceBuffer, Error, NativeBatchWorkspace, OriginalDeviceGrRead, OriginalQsaMappedAppend, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs index 97d17853..89f85f54 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaMappedJournal`: `append_resident_arena`, `arena_plan`, `stage_arena`, `stage_prefix_from_h... -//! Split out of `original_qsa_mapped_prefix` to keep its files under the line limit. +//! Arena-chunk side of the mapped K/V journal: prompt append with the host-to-stage prefix copy, the streamed-KV +//! resolver (reset, resolve, window addresses) and alias checks. use super::super::original_qsa_mapped_journal::AppendPlan; use super::{ diff --git a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs index 75d572a0..9041c681 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalQsaMappedPrefix`: `next_position`, `owner_id`, `validate_retained`. -//! Methods of `OriginalQsaMappedAppend`: `rows`, `first_position`, `prefix_after`, `final_prefix`. +//! Prefix lineage of the mapped K/V journal: prefix and append receipts, rollback, accept, reset, window publication, +//! conversion from QsaPromptKv, close, and the side-stream prefetch of the layer prefix copy. use super::{ Cell, Context, Coverage, Error, NativeBatchWorkspace, OriginalDeviceGrRead, OriginalQsaMappedAppend, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/offsets.rs b/crates/cuda-driver/src/qsa_prompt_kv/offsets.rs index 22c0b2f4..3f594c39 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/offsets.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/offsets.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaKvInputs`: `new`. Methods of `QsaKvOwnerId`: `same_owner`. -//! Functions: `offsets`, `stage_runs`, `resident_runs`, `page_payload_eq` and 3 more. +//! Layout and identity helpers of QSA prompt K/V: run offsets and sizes of the mapped pools, the validated K/V inputs, +//! snapshot and owner-id accessors, the device Pools owner, size admission and the Context constructors. use super::{ CompletedQsaKvAppend, Context, DeviceBuffer, Error, Origin, Page, Pools, QSA_PROMPT_HOST_PAGE_BYTES, QsaKvInputs, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/qsa_prompt_kv_drop.rs b/crates/cuda-driver/src/qsa_prompt_kv/qsa_prompt_kv_drop.rs index e9bd652b..1b78aa19 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/qsa_prompt_kv_drop.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/qsa_prompt_kv_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptStage`: `new`, `allocate_all`, `allocated_bytes`, `is_failed` and 11 more. -//! Implements `Drop for QsaPromptKv`, `Drop for QsaPromptStage`. Functions: `read_range`. +//! The QsaPromptStage owner: pools, status word and page table of the staging area, snapshot restore, kernel runs on +//! the workspace stream and close; also the Drop of the QSA K/V owner and its range readback. use super::{ Arguments, Context, DeviceBuffer, Error, LaunchGeometry, NativeBatchWorkspace, PAGE, Pools, QsaKvSnapshot, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/staged_append.rs b/crates/cuda-driver/src/qsa_prompt_kv/staged_append.rs index a9e7b739..b592f85f 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/staged_append.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/staged_append.rs @@ -1,5 +1,5 @@ -//! Defines `StagedAppend`. -//! Split out of `qsa_prompt_kv` to keep its files under the line limit. +//! Small carrier type of an append: the stage one bounded K/V append runs on and the prior snapshot it extends; +//! the append logic is in the submodules. use super::{ Arg, Arguments, CompletedQsaKvAppend, Context, DeviceBuffer, Error, LaunchGeometry, MappedAllocation, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_append_bounded_close.rs b/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_append_bounded_close.rs index 6e500c56..0e72c0da 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_append_bounded_close.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_append_bounded_close.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptKv`: `append_bounded`, `close`, `close_inner`, `close_mapped` and 1 more. -//! Split out of `staged_append` to keep its files under the line limit. +//! Bounded append of QSA K/V through a stage, and the close of the owner including the pinned host mapping, which is +//! retained instead of freed when a poisoned context cannot prove DMA completion. use super::{ CompletedQsaKvAppend, Error, MappedAllocation, NativeBatchWorkspace, QsaKvInputs, QsaPromptKv, Result, diff --git a/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_bring_up.rs b/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_bring_up.rs index 2f84694f..dfb3cece 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_bring_up.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/staged_append/qsa_prompt_kv_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaPromptKv`: `new`, `init_resources`, `map_host`, `empty_snapshot` and 16 more. -//! Functions: `check_host_memory`. +//! Bring-up of the QsaPromptKv owner: host memory check, pinned mapped host area, snapshot validation and restore, +//! selection admission and the append entries. use super::{ CompletedQsaKvAppend, Context, DeviceBuffer, Error, MappedAllocation, NativeBatchWorkspace, Origin, PAGE, diff --git a/crates/cuda-driver/src/qsa_selected_kv/asset.rs b/crates/cuda-driver/src/qsa_selected_kv/asset.rs index 70ad36a6..fdd94dd6 100644 --- a/crates/cuda-driver/src/qsa_selected_kv/asset.rs +++ b/crates/cuda-driver/src/qsa_selected_kv/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `qsa_selected_kv_workspace`. Functions: `asset`. -//! Split out of `qsa_selected_kv` to keep its files under the line limit. +//! Sealed PTX asset check of the QSA selected-K/V workspace (pinned length, digest, NUL-terminated ASCII) and the +//! Context constructor of the workspace. use super::{Context, Error, PTX, PTX_BYTES, PTX_SHA, QsaSelectedKvWorkspace, Result, qwen_ffi}; diff --git a/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_attend_io.rs b/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_attend_io.rs index b3223efd..df496f9d 100644 --- a/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_attend_io.rs +++ b/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_attend_io.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaSelectedKvProducts`: `width`, `generation`, `attend`. -//! Methods of `QsaSelectedKvWorkspace`: `attend_io`, `check_attend_buffers`, `launch_attend`. +//! Attend side of the QSA selected-K/V workspace: the products handle that attends one query over the gathered +//! selected cells, the alias and size checks of its query/output buffers, the launch, and the workspace Drop. use super::{ CELL, DeviceBuffer, Error, Operation, PACKED, QsaSelectedKvProducts, QsaSelectedKvWorkspace, Result, SIZES, diff --git a/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_workspace.rs b/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_workspace.rs index b70987e8..5fbdac48 100644 --- a/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_workspace.rs +++ b/crates/cuda-driver/src/qsa_selected_kv/qsa_selected_kv_workspace.rs @@ -1,5 +1,5 @@ -//! Methods of `QsaSelectedKvWorkspace`: `new`, `admit_new`, `load`, `load_modules` and 12 more. -//! Functions: `check_shapes`, `check_finite`, `release_buffer`, `unload_module`. Defines `SelectedLaunch`. +//! The QsaSelectedKvWorkspace owner: sealed asset admission, buffers and modules, validation of miss and selection +//! slots, the prepare step that scatters missed rows into cells and gathers the selection, and close. use super::{ CELL, CELLS, Cell, Context, DeviceBuffer, Error, LAYERS, MAP, Operation, PACKED, QsaKvMisses, diff --git a/crates/cuda-driver/src/qwen_dispatch/admission.rs b/crates/cuda-driver/src/qwen_dispatch/admission.rs index 8b99b939..76e8f432 100644 --- a/crates/cuda-driver/src/qwen_dispatch/admission.rs +++ b/crates/cuda-driver/src/qwen_dispatch/admission.rs @@ -1,5 +1,5 @@ -//! Functions: `admission`, `check_owned`, `admitted_layout`, `buffer_handles` and 1 more. -//! Split out of `qwen_dispatch` to keep its files under the line limit. +//! Request admission of the Qwen closed-kernel dispatch: checks that every operand belongs to the context and is live, +//! validates operand count, epsilon and layout against the sealed asset, and allocates the owned MTP scratch buffers. use super::{ Admission, Asset, Backend, Context, DeviceBuffer, Error, Operation, Result, combine, ffi, qwen_ffi, ranges_layout, diff --git a/crates/cuda-driver/src/qwen_dispatch/cache.rs b/crates/cuda-driver/src/qwen_dispatch/cache.rs index a1efdfc5..74c26727 100644 --- a/crates/cuda-driver/src/qwen_dispatch/cache.rs +++ b/crates/cuda-driver/src/qwen_dispatch/cache.rs @@ -1,5 +1,5 @@ -//! Methods of `Cache`: `new`. Implements `Backend for Context`. -//! Functions: `restore`, `registered`, `execute`, `prepare_pair` and 3 more. +//! The kernel cache of the Qwen dispatch and its Backend implementation for Context: lazy load and resolve of fixed +//! kernels, single and paired registration with unload on failure, and execution under the context guard. use super::{Arguments, Asset, Backend, Cache, Cell, Context, Error, FixedKernel, Operation, Rc, Result, combine, ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/context.rs b/crates/cuda-driver/src/qwen_dispatch/context.rs index bd155605..1c56787b 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `context_gr_gate_mean_inject`, `gdn_ple_fixed_kernels`, `gdn_step_kernels` and 4 more. -//! Split out of `qwen_dispatch` to keep its files under the line limit. +//! The Context side of qwen_dispatch: groups the fixed-kernel call families (GDN/PLE, GDN step, GR read chain, +//! MTP dense attention, MTP fixed kernels, QSA kernels) and re-uses the dispatch types of the parent. use super::{ Admission, Arguments, Asset, Backend, Context, DeviceBuffer, Error, FixedKernel, Operation, Result, admission, diff --git a/crates/cuda-driver/src/qwen_dispatch/context/context_gr_gate_mean_inject.rs b/crates/cuda-driver/src/qwen_dispatch/context/context_gr_gate_mean_inject.rs index 96568806..9f8ddc6c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/context_gr_gate_mean_inject.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/context_gr_gate_mean_inject.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `gr_gate_mean_layer_fused_f32`, `gr_gate_mean_final_unfused_f32`, `gr_inject_residual_f32`,... -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the GR gate-mean (layer fused, final unfused) and residual-inject Qwen kernels; each +//! validates its F32 operands and dispatches through qwen_call. use super::{Context, DeviceBuffer, Operation, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/context/gdn_ple_fixed_kernels.rs b/crates/cuda-driver/src/qwen_dispatch/context/gdn_ple_fixed_kernels.rs index 92381e23..382b8ace 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/gdn_ple_fixed_kernels.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/gdn_ple_fixed_kernels.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `qsa_block_topk`, `qsa_attend`, `qsa_gate_f32`, `moe_swiglu_f32` and 15 more. -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the fixed Qwen kernels of QSA (block top-k, attend, gate), MoE (SwiGLU, shared scalar, +//! combine), PLE and GDN steps; thin typed wrappers that hand their buffers to qwen_call. use super::fixed_operands::{GdnConvResult, GdnGates, GdnQkv, GdnStepResult, PleConvResult, QsaPackedKv}; use super::{Context, DeviceBuffer, Operation, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/context/gdn_step_kernels.rs b/crates/cuda-driver/src/qwen_dispatch/context/gdn_step_kernels.rs index cf11276b..fd716833 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/gdn_step_kernels.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/gdn_step_kernels.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `gdn_step_from_products_f32`, `admit_gdn_step`, `gdn_out_norm_f32`, `qwen_route_top10` and ... -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the fixed GDN step, GDN output norm, top-10 expert router and BF16 projection kernels. +//! Also holds the shared qwen_call admission-and-launch helper and the unload of the Qwen kernel set. use super::fixed_operands::{GdnGates, GdnOutNormInput, GdnStepProducts, GdnStepResult}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs b/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs index b15705cc..ebc85799 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs @@ -1,5 +1,5 @@ -//! Methods of `GrChain`: `new`. -//! Methods of `Context`: `gr_read_chain_queued`, `admit_gr_read`, `gr_stage`, `gr_run_chain` and 8 more. +//! The GR read chain: five fixed stages (norm, down, down-silu, up, layer gate) plus a finite guard, run on one stream +//! with a single completion fence; cross-stage alias checks live here. Also the single-stage GR projection/norm calls. use super::fixed_operands::{GrReadInputs, GrReadOutputs}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/context/mtp_dense_attention.rs b/crates/cuda-driver/src/qwen_dispatch/context/mtp_dense_attention.rs index 9dd77502..c670e124 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/mtp_dense_attention.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/mtp_dense_attention.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mtp_dense_attend_f16`, `mtp_dense_attend_ring_f16`, `dense_plan`, `check_dense_buffer` and... -//! Functions: `dense_admission`, `dense_clear`, `ring_active`. Defines `DensePlan`. +//! Closed causal dense attention of the MTP head over FP16 K/V (plain or ring window): input sizing and alias checks, +//! accumulator/max/sum scratch, and the chunk-then-merge launch pair. use super::fixed_operands::{MtpDenseKv, MtpRingWindow}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs b/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs index 33e1e330..3618fa22 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `mtp_gr_attention_down`, `mtp_gr_attention_up`, `mtp_gr_mlp_down`, `mtp_gr_mlp_up` and 11 m... -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the fixed MTP kernels: GR attention/MLP down and up passes, scaled quantization, +//! S2 expert tiles and full banks, SwiGLU, embedding and hidden norms, broadcast. No caller geometry is exposed. use super::fixed_operands::{ MtpGrMlpOutputs, MtpGrMlpResidual, MtpGrProducts, MtpGrWeights, MtpQuantizedInput, MtpS2SelectedExpert, diff --git a/crates/cuda-driver/src/qwen_dispatch/context/qsa_fixed_kernels.rs b/crates/cuda-driver/src/qwen_dispatch/context/qsa_fixed_kernels.rs index c6eee457..64b2eb65 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/qsa_fixed_kernels.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/qsa_fixed_kernels.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `kar_ple_call`, `kar_ple_scatter`, `kar_ple_decode`, `qsa_call` and 11 more. -//! Split out of `context` to keep its files under the line limit. +//! Context entry points for the closed QSA attention kernels (q gate split, norms, ropes, index append, kv pack, +//! block scores) and the experimental PLE row-cache scatter and decode; unqualified assets refuse before mutation. use super::fixed_operands::{QsaIndexAppendSource, QsaPooledImage}; use super::{Admission, Arguments, Context, DeviceBuffer, Error, Operation, Result, admission, execute, qwen_ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs index 98d5d939..39547bc1 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnQueueStage`: `words`, `slot`. Methods of `Step`: `next`. -//! Functions: `decode_statuses`, `column_row_offset`. +//! Vocabulary and lifecycle of the GDN row queue: finite-scan stage sizes, program step order, status-word decoding, +//! batched QKV row offsets, the completion result, and opening the queue (status buffer, six kernels). use super::{ Context, Error, GdnQueueStage, GdnRowCompletion, GdnRowPrefix, GdnRowQueue, Kernels, MAX_COLUMN_ROWS, OPS, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs index 9c1210b6..b3a4669f 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `convolution_stages`, `gdn_row_prefix_fenced_drain`, `recurrence_stages`. -//! Split out of `gdn_closed_queue` to keep its files under the line limit. +//! The GDN row prefix: an owned, ordered program of kernel launches and finite scans for one GDN row, built from +//! convolution/recurrence stages and executed by the fenced drain; the submodules split it by program phase. use super::{ Admission, Arguments, BETA, CONV, Command, DeviceBuffer, Drained, Error, GATE, GdnConvBuffers, GdnOutNormBuffers, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs index 23604733..378bcf15 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnRowPrefix`: `ready`, `latch`, `handle_of`, `same` and 11 more. -//! Split out of `gdn_row_prefix` to keep its files under the line limit. +//! First stages of the GDN row program: step-order and operand-identity checks, the push_stage/push_scan helpers, +//! the QKV, alpha and raw-beta scans, and the convolution plus SiLU (own QKV row or a row of a retained columns owner). use super::{ Admission, Arguments, CONV, Command, DeviceBuffer, Error, GdnConvBuffers, GdnQueueStage, GdnRowPrefix, OPS, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs index fae50168..aaded3f8 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnRowPrefix`: `drain`, `drain_buffers`, `decoded_refusal`, `fenced` and 2 more. -//! Functions: `fetched_history`, `history_words`. Defines `Fenced`. +//! Final drain of a GDN row program: reset the status words, launch every queued command, read statuses and optional +//! next history back and synchronize in one fence; failures latch the queue and poison the context. use super::{ Drained, Error, GdnQueueStage, GdnRowPrefix, HISTORY_BYTES, Result, SLOTS, STATUS_BYTES, combine, decode_statuses, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs index f14deb43..0f91ff6a 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnRowPrefix`: `qk_l2`, `beta_sigmoid`, `gate_softplus`, `recurrence` and 7 more. -//! Split out of `gdn_row_prefix` to keep its files under the line limit. +//! Later stages of the GDN row program: Q/K L2, beta sigmoid, gate softplus, the recurrence over fixed Q/K/V ranges, +//! the Z scan, output norm, selecting the history to fetch, and finish, which drains the whole prefix once. use super::{ Admission, Arguments, BETA, Command, DeviceBuffer, Error, GATE, GdnOutNormBuffers, GdnQueueStage, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs index 39c2249f..32deaef8 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnRowQueue`: `close_inner`, `release_status`, `release_module`. Methods of `Command`: `launch`. -//! Implements `Drop for GdnRowQueue`. Functions: `staging`. +//! Teardown and plumbing of the GDN row queue: closing it releases the status buffer and helper module (poisoning the +//! context on failure), Drop closes it, plus host staging allocation and the launch of one queued command. use super::{Command, Context, DeviceBuffer, Error, GdnRowQueue, Result, combine, ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs index 0f1bace4..a7b0241c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs @@ -1,5 +1,5 @@ -//! Methods of `Row`: `conv_buffers`, `recurrence_buffers`, `out_norm_buffers`, `new` and 7 more. -//! Functions: `bytes`, `upload`, `blank`, `read` and 6 more. +//! GPU test fixtures of the GDN row queue: a Row of whole device owners with deterministic (optionally NaN-tailed) +//! inputs, the scalar reference sequence, the queued programs (own or retained QKV row) and upload/readback helpers. use super::{ CHANNELS, Context, DeviceBuffer, EPSILON, GdnConvBuffers, GdnOutNormBuffers, GdnRecurrenceBuffers, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs index 482c1fb9..e45d1f41 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs @@ -1,5 +1,5 @@ -//! Functions: `columns_pair`, `poisoned_image`, `compare_columns`, `note_qkv_refusal` and 4 more. -//! Defines `ColumnsCase`, `ColumnsPoison`, `RetainedColumns`. +//! GPU test cases of the GDN row queue: queued results must match the scalar sequence bit for bit, including retained +//! batched QKV rows (non-finite words in other rows are ignored, in the used row they refuse at the first stage). use super::{ CHANNELS, Context, DeviceBuffer, Error, GdnQueueStage, GdnRowCompletion, GdnRowQueue, Poison, Report, Result, Row, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs index dfb723a8..0ca867b6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `fused_stage_binding`, `gdn_fused_prefix_step_norm_drain`. -//! Split out of `gdn_fused_t1` to keep its files under the line limit. +//! The fused GDN T1 prefix: one owned program of fused kernels and finite scans for a single token step; the +//! submodules split it into the binding/early stages and the step-norm stage with its fenced drain. use super::{ C, Command, DeviceBuffer, Drained, Error, F16, F32, FusedKernel, GDN_FUSED_T1_STATE_BYTES, GdnAbBuffers, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs index a4160750..d6ada148 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnFusedPrefix`: `ready`, `latch`, `bind`, `push` and 10 more. -//! Split out of `gdn_fused_prefix` to keep its files under the line limit. +//! First half of the fused GDN T1 program: step order, role-bound buffer admission, ordered finite scans, and the +//! input scan, state seeding, conv+L2 and gate/beta (ab) kernels. The step norm and the drain are in the sibling file. use super::{ C, Command, DeviceBuffer, Error, F16, F32, FusedKernel, GDN_FUSED_T1_STATE_BYTES, GdnAbBuffers, GdnFusedPrefix, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs index f21921aa..69e10d1c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnFusedPrefix`: `step_norm`, `step_norm_handles`, `push_step_norm`, `fetch_candidate` and 8 more. -//! Functions: `fetched_candidate`, `candidate_words`. Defines `DrainBuffers`, `Fenced`. +//! Second half of the fused GDN T1 program: the step-norm kernel, the request for the candidate state/history, and +//! finish, which drains the whole prefix in one fence (statuses and candidate read back, failures poison the context). use super::{ DeviceBuffer, Drained, Error, F32, FusedKernel, GDN_FUSED_T1_STATE_BYTES, GdnFusedCompletion, GdnFusedPrefix, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs index bc4c530f..51fa1f86 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs @@ -1,5 +1,5 @@ -//! Methods of `FusedKernel`: `entry`, `index`. Methods of `GdnFusedStage`: `slot`, `elements`, `bytes`. -//! Functions: `pinned`, `fused_asset`, `linear`, `decode_statuses`. +//! Pinned sealed PTX of the fused GDN T1 kernels (digest-checked), kernel entry names and indices, the finite-scan +//! stage table (slot, element count, bytes), status decoding in source order, launch geometry and the role bindings. use super::{ Bindings, C, Context, Error, F32, FUSED_PTX_LEN, FUSED_PTX_SHA256, FusedKernel, GdnFusedStage, GdnFusedT1, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs index a9bf6b17..04fb5340 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnFusedT1`: `close_inner`, `release_status`, `release_module`, `replay_state_from_products`. -//! Methods of `GdnFusedPrefix`: `bind_replay`, `finish_device`. Implements `Drop for GdnFusedT1`. +//! Teardown of the fused GDN T1 owner (status buffer and module release, Drop), host word/staging conversion, and the +//! device-only replay of the state update from completed journal products. use super::{ C, DeviceBuffer, Error, F32, FusedKernel, GdnFusedPrefix, GdnFusedStage, GdnFusedT1, GdnReplayBuffers, HV, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs index 608901b1..8039008a 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `gdn_prefill_batch`, `gdn_prefill_batch_for_prompt`. -//! Methods of `GdnPrefillBatch`: `new`, `new_capacity`, `open`, `load_functions` and 6 more. Functions: `reserved`. +//! Opening and running the batched native GDN prefill: Context constructors, the GdnPrefillBatch owner (status buffer, +//! prefill and dequantization kernels), starting a prefix on a GEMM adapter, launching commands, the completion result. use super::{ Bindings, Command, Context, Error, Functions, GDN_BATCH_MAX_TOKENS, GdnBatchCompletion, GdnBatchPrefix, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs index 7ad89e31..a629a0fa 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `native_projection`, `qkv_and_z_projections`, `recurrence_and_output`. -//! Split out of `gdn_native_batch` to keep its files under the line limit. +//! The batched GDN prefill prefix: an owned program of kernels, GEMMs and finite scans over a token chunk; the +//! submodules split it into the shared base/projection, the early stages, and the recurrence with its drain. use super::{ C, CONV_TILE, Command, DeviceBuffer, Drained, Error, F16, F32, GDN_BATCH_EPSILON, GdnBatchCompletion, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs index 518f6484..9a26d70b 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnBatchPrefix`: `tokens`, `ready`, `latch`, `function` and 12 more. Functions: `size_admitted`. -//! Defines `NativeProjection`, `ProjectionOperands`. +//! Shared base of the batched GDN prefill program: step order, role-bound buffer admission, ordered finite scans, +//! the mixed-activation image packing, and the native quantized projection (dequantize to FP16, then GEMM). use super::{ Command, DeviceBuffer, Error, F16, F32, GdnBatchPrefix, GdnBatchStage, GdnNativeFormat, GemmShape, Kernel, N, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs index 16f37947..7ea97ee6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnBatchPrefix`: `project_qkv`, `project_z`, `project_alpha_beta`, `push_ab_gemm` and 7 more. -//! Split out of `gdn_batch_prefix` to keep its files under the line limit. +//! Early stages of the batched GDN prefill program: the QKV, Z and alpha/beta projections, the gates kernel, +//! the causal convolution plus SiLU (serial or tiled by chunk length) and the Q/K L2 normalization. use super::native_projection::{NativeProjection, ProjectionOperands}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs index d9e48a8c..82632db8 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnBatchPrefix`: `recurrence`, `recurrence_arguments`, `out_norm`, `project_out` and 7 more. -//! Functions: `fetched_history`, `history_words`. Defines `Fenced`. +//! Late stages of the batched GDN prefill program: the whole-chunk recurrence, output norm and output projection, +//! then finish, which drains the program in one fence (status words and history read back; failures poison it). use super::native_projection::{NativeProjection, ProjectionOperands}; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs index 30368f75..cb766c6c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs @@ -1,5 +1,5 @@ -//! Functions: `bytes_of`, `words_of`, `halves_of`, `f16_bits` and 15 more. Defines `Projections`. -//! Split out of `gpu` to keep its files under the line limit. +//! Host-side numerics of the GDN prefill GPU smoke test: byte/word/half conversions, FP16/BF16 rounding, Q8_0 blocks, +//! deterministic input patterns, and the host reference of every original kernel (gates, conv, L2, recurrence, norm). use super::{C, EPS, HISTORY_WORDS, HV, HostInputs, Q8_0_BLOCK, Reference, S, ZV}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs index 95d6d0ba..8b9942c4 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs @@ -1,5 +1,5 @@ -//! Methods of `HostGemm`: `run`, `poison_output`, `capture`. Methods of `Fixture`: `new`, `release`. -//! Implements `GdnGemm for HostGemm`. Functions: `host_gemm`, `upload`, `read`, `mismatch`. +//! Host stand-in for the closed cuBLAS GEMM adapter in the GDN prefill GPU smoke test (it records every call and can +//! poison an output word), plus the Fixture of uploaded inputs and blank outputs and the buffer upload/read helpers. use super::{ C, Context, DeviceBuffer, Error, Fixture, FixtureInputs, FixtureOutputs, GdnGemm, GdnStream, GemmShape, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs index 8b765471..6432fafe 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs @@ -1,5 +1,5 @@ -//! Functions: `run_case`, `check_case`, `push_program`, `inputs_untouched` and 8 more. -//! Split out of `gpu` to keep its files under the line limit. +//! Runs one complete GDN prefill program over the fixture and checks the completion, untouched inputs, the GEMM call +//! sequence, exact dequantization, image packing and every device output against the host reference. use super::{ C, Captured, Cell, Context, Error, Fixture, GdnBatchPrefix, GdnBatchStage, GdnNativeFormat, GdnPrefillBatch, HV, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs index a95ae75c..b384cad3 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs @@ -1,5 +1,5 @@ -//! Methods of `Kernel`: `entry`, `is_dequant`, `index`. -//! Methods of `GdnNativeFormat`: `ggml_type`, `block`, `kernel`, `matrix_bytes`. +//! Pinned sealed PTX of the batched GDN prefill and dequantization kernels (digest-checked), kernel entry names, the +//! GGUF weight formats, the stage table (slot, elements, bytes), status decoding, step order and role bindings. use super::{ Bindings, C, DEQUANT_PTX_LEN, DEQUANT_PTX_SHA256, Error, F16, F32, Functions, GdnBatchStage, GdnNativeFormat, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs index 7bc47b29..424937a0 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs @@ -1,5 +1,4 @@ -//! Methods of `Context`: `original_gdn_prompt_device`, `original_gdn_prompt_device_with`. -//! Split out of `prompt_device` to keep its files under the line limit. +//! Context constructors of the original GDN prompt device: default options or operator-supplied GdnPromptOptions. use super::{Context, GdnPromptOptions, OriginalGdnPromptDevice, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs index 36ce7ad0..f6d9e415 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `gdn_prompt_run_buffer_binder`, `original_gdn_prompt_device_admit_open`, `original_gdn_prom... -//! Split out of `prompt_device` to keep its files under the line limit. +//! The original GDN prompt device: a device-resident program of the GDN layer over a prompt block, split into +//! construction, close, buffer binding, command-list building, tensor-core scan, drain and the produce entry point. use super::{ A, Bindings, C, Context, DeviceBuffer, DeviceCommand, Error, Functions, GDN_BATCH_EPSILON, GdnBatchStage, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs index 3407b25b..e46cc840 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGdnPromptDevice`: `device_bytes`, `new`, `admit_budget`, `open` and 2 more. -//! Split out of `original_gdn_prompt_device` to keep its files under the line limit. +//! Construction of the original GDN prompt device: device-byte sizing, budget and free-memory admission, and opening +//! the batch owner, scratch and the two history buffers. use super::{ Context, DeviceBuffer, Error, GdnPrefillBatch, GdnPromptOptions, HISTORY, OriginalGdnPromptDevice, RESERVE, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs index 1c943728..c09733d8 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGdnPromptDevice`: `close`, `close_inner`, `release_stage`, `release_batch`. -//! Functions: `release_buffer`. +//! Teardown of the original GDN prompt device: releases history, scratch, stage module, tensor-core state and batch +//! owner; on a poisoned context buffers are leaked instead of freed, and a failed close poisons the context. use super::{Context, DeviceBuffer, Error, GdnPrefillBatch, KernelModule, OriginalGdnPromptDevice, Result, combine}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs index f766b5a3..ce161678 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalGdnPromptDevice`: `produce`, `admit`, `admit_handles`, `admit_state` and 4 more. -//! `produce` admits the buffers, records the command list (`prompt_command_list.rs`) and drains it (`original_gdn_pr... +//! Entry point of the prompt GDN block: produce admits the GR read, workspace, weights and prior state (owners, +//! aliases, shapes, finite history), builds the command list and drains it, returning the completed block and history. use super::{ Binder, Bindings, C, Carve, Carved, DeviceBuffer, Error, HISTORY, HISTORY_WORDS, HV, Handles, N, diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs index 58acda75..3f6d8415 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for OriginalGdnPromptDevice`. -//! Split out of `prompt_device` to keep its files under the line limit. +//! Drop of the original GDN prompt device: closes it and ignores the result. use super::OriginalGdnPromptDevice; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs index c1943853..4eb78d95 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs @@ -1,5 +1,4 @@ -//! Defines `Rng`, `Old`. -//! ENABLE, Rng, Old. +//! Shared test types of the stage GPU proofs: the environment switch, a xorshift Rng and the Old launcher context. use super::{Context, Functions}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs index 81c9bcab..05bc467c 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs @@ -1,5 +1,5 @@ -//! Methods of `Rng`: `next`, `f`, `f16`. Methods of `Old`: `run`. -//! Functions: `f32_bytes`, `upload`, `hd`, `download` and 2 more. +//! Helpers of the stage GPU proofs: a deterministic xorshift generator (finite f32/f16 values), buffer upload/download +//! helpers, and Old, which launches the existing GDN kernels on a stream as the reference side. use super::{A, Context, DeviceBuffer, GdnStream, Kernel, KernelArguments, KernelModule, Old, Rng, ffi}; use crate::ple_batch_ffi::LinearLaunch; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs index 95eb88a9..8252cad5 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs @@ -1,5 +1,5 @@ -//! Methods of `GdnPrefillBatch`: `close_inner`, `release_status`, `release_module`. -//! Implements `Drop for GdnPrefillBatch`. Functions: `staging`. +//! Teardown of the batched GDN prefill owner: releasing the status buffer and kernel modules (poisoning the context +//! on failure), Drop, and the host staging buffer allocation. use super::{DeviceBuffer, Error, GdnPrefillBatch, Result, combine, ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gdn_products_installed.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_products_installed.rs index a83147b6..4b5e867f 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gdn_products_installed.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_products_installed.rs @@ -1,5 +1,5 @@ -//! Methods of `Host`: `pattern`. Methods of `Rig`: `allocate`, `old_expected`, `products_step`, `candidate` and 8 more. -//! Functions: `encode`, `read_pair`, `count_difference`, `allocate_all` and 4 more. Defines `Host`, `Rig`. +//! Root-only GPU test of the whole-product GDN step boundary: the candidate step over whole Q/K/H/gate/beta +//! owners must equal the old marshalled step bit for bit, keep unused tails intact and refuse bad shapes and aliases. use super::*; use crate::{Device, Driver, GdnGates, GdnQkv, GdnStepProducts, GdnStepResult}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs index eccf3342..6ee11b92 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs @@ -1,5 +1,4 @@ -//! Methods of `Context`: `gr_microbatch_read`. Functions: `checked_row`, `encode`. -//! Split out of `gr_batch_read` to keep its files under the line limit. +//! Context constructor of the GR micro-batch read, with the row-range check and the f32 byte encoding it uses. use super::{Context, Error, GrMicrobatchRead, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs index 06529b7d..c169c2b6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `gr_microbatch_read_inject`, `gr_microbatch_read_open`, `micro_stage_launch`. -//! Split out of `gr_batch_read` to keep its files under the line limit. +//! The GR micro-batch read: retained row banks and a program of GR kernels with finite scans; the submodules split +//! it into opening, the per-row read launch and the residual inject. use super::{ Arguments, Context, DeviceBuffer, Error, FixedKernel, GrMicroValues, GrMicrobatchRead, OPS, Operation, RESERVE, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs index ad94c917..c1885db9 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs @@ -1,5 +1,5 @@ -//! Methods of `GrMicrobatchRead`: `inject`, `inject_handles`, `inject_admit`, `inject_arguments` and 11 more. -//! Split out of `gr_microbatch_read` to keep its files under the line limit. +//! Residual inject of the GR micro-batch read: uploads the blocks, runs the inject kernel and finite scan per row, +//! publishes the candidate as the next input bank, and closes the owner (buffers and helper module). use super::{ Arguments, Error, FixedKernel, GrMicrobatchRead, Operation, Result, combine, decode, encode, ffi, qwen_ffi, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs index b00dce61..faa6aa82 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs @@ -1,5 +1,5 @@ -//! Methods of `GrMicrobatchRead`: `new`, `admit_inputs`, `open`, `load_finite` and 10 more. -//! Split out of `gr_microbatch_read` to keep its files under the line limit. +//! Opening the GR micro-batch read: input and budget admission, bank allocation, finite-scan helper loading, +//! accessors, alias checks against the weights, and the per-row kernel argument assembly. use super::{ Arguments, Context, DeviceBuffer, Error, GrMicrobatchRead, OPS, Operation, RESERVE, Result, SIZES, checked_row, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs index 80b09420..9aeff621 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs @@ -1,5 +1,5 @@ -//! Methods of `GrMicrobatchRead`: `read`, `micro_kernels_guarded`, `micro_enqueue`, `micro_complete` and 6 more. -//! Defines `MicroKernels`. +//! The read of the GR micro-batch: per row the six GR kernels each followed by a finite scan, enqueued, fenced and +//! settled so an earlier numerical refusal wins over a later enqueue failure; products are decoded on success. use super::{ Arguments, DeviceBuffer, Error, FixedKernel, GrMicroValues, GrMicrobatchRead, OPS, Result, SIZES, STAGES, combine, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs index 6ee6d183..c1050240 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for GrMicrobatchRead`. Functions: `decode`. -//! Split out of `gr_batch_read` to keep its files under the line limit. +//! Drop of the GR micro-batch read (closes it) and the decoding of a device buffer to finite canonical f32 values. use super::{DeviceBuffer, Error, GrMicrobatchRead, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs index a4245dcd..daa5ae8b 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `gr_native_batch`, `gr_native_prompt_batch`. Functions: `encode`, `decode`. -//! Split out of `gr_native_batch` to keep its files under the line limit. +//! Context constructors of the native GR batch (decode and prompt-sized variants) and the f32 byte encode and +//! finite-checked decode helpers. use super::{Context, DeviceBuffer, Error, GrNativeBatch, GrNativeProfile, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs index f76b3277..c5920c72 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs @@ -1,5 +1,4 @@ -//! Implements `Drop for GrNativeBatch`. -//! Split out of `gr_native_batch` to keep its files under the line limit. +//! Drop of the native GR batch: closes it and ignores the result. use super::GrNativeBatch; diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs index c0993ded..f3035ab6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs @@ -1,5 +1,5 @@ -//! Methods of `GrNativeBatch`: `finish`, `native_status`, `native_settle`, `native_fail` and 13 more. -//! Defines `NativeDrain`. +//! Native GR read: builds the kernel arguments and command list in the literal Original order, drains the vendor +//! stream, reads the finite status words back and settles them (a failed drain or pop poisons the context). use super::native_gemm_launch::GemmRoles; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs index 4b4d1274..9f42f75b 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs @@ -1,5 +1,5 @@ -//! Methods of `GrNativeBatch`: `prompt_device_bytes`, `new`, `new_bounded`, `check_new_inputs` and 15 more. -//! Defines `GemmRoles`. +//! Construction and plumbing of the native GR batch: sizing, admission, buffer and module setup, alias checks, +//! kernel argument helpers, and the Original GEMM over the high (and low) image. use super::{ A, BYTES, Blas, Context, DeviceBuffer, ENTRIES, Error, GrNativeBatch, GrNativeProfile, KernelArguments, diff --git a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs index 908906e8..6c551e67 100644 --- a/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs @@ -1,5 +1,5 @@ -//! Methods of `GrNativeBatch`: `inject`, `check_inject`, `stage_blocks`, `inject_args` and 6 more. -//! Defines `StatusReset`. +//! Residual inject of the native GR batch: stages the blocks, enqueues the inject kernel and scans, and takes the +//! injected result; also closing the batch (module and buffer retirement). use super::native_command_drain::NativeDrain; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs index d232f7d4..5f5ff615 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs @@ -1,5 +1,5 @@ -//! Methods of `HostGemm`: `run`, `poison_output`. Implements `GdnGemm for HostGemm`. -//! Functions: `bytes_of`, `words_of`, `halves_of`, `f16_bits` and 13 more. +//! Host-side helpers of the MoE prefill GPU smoke test: FP16/BF16 conversions, Q8_0 blocks, deterministic patterns, +//! and HostGemm, the host stand-in for the closed cuBLAS GEMM adapter (it records calls and can poison an output word). use super::{ Context, DeviceBuffer, EXPERTS, Error, GdnGemm, GdnStream, GemmShape, HostGemm, Q8_0_BLOCK, Result, combine, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs index d17a28ee..491e3885 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs @@ -1,5 +1,5 @@ -//! Functions: `check_clean`, `check_down_reads_h`, `check_dequantized_scratch`, `check_mixed_images` and 5 more. -//! Split out of `gpu` to keep its files under the line limit. +//! Checks of a clean MoE prefill window in the GPU smoke test: GEMM call sequence, dequantization, image packing, +//! route against a host softmax/top-10, shared SwiGLU and the combine, all against host references. use super::{ Captured, EXPERTS, Error, FF, Fixture, HostGemm, MoeRouteBatch, N, Result, SELECTED, Window, bf_bits, bf_value, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs index 09a00613..e67d0424 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs @@ -1,5 +1,5 @@ -//! Methods of `Fixture`: `new`, `release`. Methods of `Images`: `new`. -//! Functions: `blank`, `bf16_matrix`, `run_case`, `run_window` and 1 more. Defines `Window`. +//! Fixture of the MoE prefill GPU smoke test: uploaded inputs and blank outputs (images, routing, experts, +//! products), the Window describing one program run, and run_case/run_window which enqueue the full program. use super::{ Captured, Cell, Context, DeviceBuffer, EXPERTS, Error, Experts, FF, Fixture, GdnNativeFormat, HostGemm, Images, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs index ca07b439..4daf2a9a 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `combine_stage`, `moe_batch_prefix_router_pack`, `shared_expert_projections`. -//! Split out of `moe_prefill_batch` to keep its files under the line limit. +//! The MoE batch prefix: an owned program of router, shared-expert and optional combine stages over a token window; +//! the submodules split it into router/binding base, shared-expert projections, and the combine plus drain. use super::{ Command, Context, DeviceBuffer, Drained, EXPERTS, Error, F16, F32, FF, GdnNativeFormat, GemmShape, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs index e27f5118..d425a928 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeBatchPrefix`: `combine_from`, `combine_body`, `combine_inputs`, `upload_slot_map` and 8 more. -//! Methods of `DrainStaging`: `new`. Defines `DrainStaging`. +//! Tail of the MoE batch prefix: the combine-only program and combine body (row-map upload), finish, and the fenced +//! drain that reads the status words and optional route back after one completion fence (failures poison the context). use super::{ Context, DeviceBuffer, Drained, EXPERTS, Error, F32, MoeBatchCompletion, MoeBatchPrefix, MoeBatchStage, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs index f5927882..bac7ceb5 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeBatchPrefix`: `tokens`, `ready`, `latch`, `moe_function` and 13 more. -//! Functions: `bind_size_admitted`. +//! Base and router head of the MoE batch prefix: step order, role-bound buffer admission, kernel pushes, ordered finite +//! scans, packing of the mixed activation images, and the BF16 router with its top-10 route kernel. use super::{ Command, DeviceBuffer, EXPERTS, Error, F16, F32, GemmShape, MoeBatchPrefix, MoeBatchStage, MoeKernel, N, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs index 4926988d..3b75ff50 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeBatchPrefix`: `project_native`, `push_dequant`, `shared_gate`, `shared_up` and 4 more. -//! Defines `NativeProjection`, `ProjectionOperands`. +//! Shared-expert stages of the MoE batch prefix: native dequantize-then-GEMM projections (gate, up, down), the SwiGLU +//! pair, the shared scalar gate, and the optional combine kernel, each followed by its finite scan. use super::{ Command, DeviceBuffer, Error, F16, F32, FF, GdnNativeFormat, GemmShape, MoeBatchPrefix, MoeBatchStage, MoeKernel, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs index b53833f2..b0c73640 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs @@ -1,5 +1,5 @@ -//! Methods of `MoeKernel`: `entry`, `index`. Methods of `MoeBatchStage`: `slot`, `elements`, `is_half`, `bytes`. -//! Functions: `pinned`, `prefill_asset`, `format_index`, `linear` and 1 more. +//! Pinned sealed PTX of the MoE prefill kernels (digest-checked), kernel entry names, weight format indices, the stage +//! table (slot, elements, bytes), status decoding, step order, role bindings and the Context constructor. use super::{ Bindings, Context, EXPERTS, Error, F16, F32, FF, GdnNativeFormat, MOE_PTX_LEN, MOE_PTX_SHA256, MoeBatchStage, diff --git a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs index ebeb807d..bb324af2 100644 --- a/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs @@ -1,5 +1,5 @@ -//! Methods of `MoePrefillBatch`: `close_inner`, `retire_buffer`, `retire_module`. -//! Implements `Drop for MoePrefillBatch`. Functions: `words`, `check_slot_map`, `staging`. +//! Teardown of the MoE prefill batch owner (buffer and module retirement, Drop), host word and staging helpers, +//! and the check that the routed-row map is a permutation of all routed rows. use super::{DeviceBuffer, Error, MOE_BATCH_MAX_TOKENS, MoePrefillBatch, Result, SELECTED, combine, ffi}; diff --git a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs index f89112d9..ab453fbf 100644 --- a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs @@ -1,5 +1,5 @@ -//! Functions: `bytes`, `upload`, `read`, `full_finite` and 13 more. Defines `Step`. -//! Split out of `gpu` to keep its files under the line limit. +//! Fixtures and the original reference of the MTP input GPU test: byte helpers, inputs, comparison and refusal +//! checks, the independent scalar sequence of norms, projections and broadcast, and the queued candidate readback. use super::{ Context, DenseFormat, DeviceBuffer, Error, MtpInputCompletion, MtpInputRefusal, MtpInputWorkspace, Numeric, diff --git a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs index fc6fdb12..066345a9 100644 --- a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs @@ -1,5 +1,5 @@ -//! Functions: `numeric_case`, `run`, `run_cases`, `upload_corpus` and 5 more. -//! Split out of `gpu` to keep its files under the line limit. +//! Numeric and refusal cases of the MTP input GPU test: non-finite inputs must refuse at the same stage as the +//! original sequence, malformed sources and weights are refused, and the prefix stays drainable. use super::{ Context, DeviceBuffer, Error, MtpInputRefusal, MtpInputWorkspace, Numeric, Report, Result, STAGES, TOTAL, bytes, diff --git a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs index d688b093..e910b685 100644 --- a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpInputCompletion`: `numerical_refusal`, `refusal_stage`, `into_streams`. -//! Methods of `Context`: `mtp_input_workspace`. Functions: `qwen_functions`, `stage_inputs`. +//! The MTP input workspace owner and its completion: Context constructor, admission, bring-up (kernels and nine +//! private owners), begin, close, and the completion that reports a numerical refusal or hands out the streams. use super::{ Context, DenseFormat, DeviceBuffer, Error, Kernels, MtpInputCompletion, MtpInputPrefix, MtpInputRefusal, diff --git a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs index de912931..19e2b9c3 100644 --- a/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs @@ -1,5 +1,5 @@ -//! Methods of `MtpInputPrefix`: `weight`, `ready`, `latch`, `status` and 14 more. Methods of `DrainStaging`: `new`. -//! Functions: `first_refusal`, `queue_qwen`, `square_shape`. Defines `DrainStaging`. +//! Builder of the MTP input prefix: queues the embedding norm, projections and broadcast one admitted phase at a time. +//! Its drain uploads inputs, runs the queue, reads the status words and turns the first nonzero one into a refusal. use super::{ Admission, Arguments, Command, Context, DenseFormat, DeviceBuffer, Drained, Error, MtpInputCompletion, diff --git a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs index c3cbd70b..6bf5f1f6 100644 --- a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs +++ b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs @@ -1,5 +1,5 @@ -//! Methods of `Command`: `launch`. Functions: `float_owner`. -//! Split out of `ple_closed_queue` to keep its files under the line limit. +//! Host f32 allocation helper and the launch of one queued PLE command (a Qwen operator or a finite-guard kernel). +//! Kept apart so the queue files share one place that turns a command into a driver launch. use super::{Command, Context, Error, Result}; diff --git a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs index bc830ba6..16ff6b06 100644 --- a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs +++ b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs @@ -1,5 +1,5 @@ -//! Methods of `PleClosedCompletion`: `numerical_refusal`, `into_parts`. Methods of `Context`: `ple_closed_queue`. -//! Functions: `check_charge`. +//! Result of a completed closed PLE queue (numeric refusal or the final streams) and construction of the queue. +//! Construction validates the operator assets and checks the charge plus reserve against budget and free memory. use super::{ Admission, Arguments, CHARGE, Command, Context, DeviceBuffer, Error, OPS, OUTPUTS, Operation, PleClosedCompletion, diff --git a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs index a0a33a38..419a2d37 100644 --- a/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs +++ b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs @@ -1,5 +1,5 @@ -//! Methods of `PleClosedQueue`: `compose`, `close`, `close_inner`. Implements `Drop for PleClosedQueue`. -//! Functions: `staging`, `float_staging`, `release_buffer`. +//! Runs one closed PLE composition: checks inputs, drains the queued kernels, reads results back under the guard. +//! Also owns closing the queue: frees the buffers and unloads the kernel module, or leaks them on a poisoned context. use super::compose_phases::ComposeHost; use super::{ diff --git a/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs b/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs index 0f40cb46..bf103350 100644 --- a/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs +++ b/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs @@ -1,5 +1,6 @@ -//! Functions: `prepare_gr_read_set`, `load_gr_missing`, `load_gr_entry`, `unload_gr_pending` and 12 more. -//! Split out of `qwen_dispatch` to keep its files under the line limit. +//! Kernel-set preparation and operand checks of the GR read path. +//! Loads the six fixed GR read kernels all-or-nothing (published only after every entry resolves), unloads the cache, +//! and validates operand ranges, launch geometry and output aliasing of a Qwen operation. use super::{Backend, Cache, Error, OPERATIONS, Operation, Result, combine, ffi, qwen_ffi, restore}; // used only with some cargo features or targets of this crate diff --git a/crates/cuda-driver/src/qwen_dispatch/queued_gr_installed.rs b/crates/cuda-driver/src/qwen_dispatch/queued_gr_installed.rs index ce910b5a..48d83da9 100644 --- a/crates/cuda-driver/src/qwen_dispatch/queued_gr_installed.rs +++ b/crates/cuda-driver/src/qwen_dispatch/queued_gr_installed.rs @@ -1,5 +1,5 @@ -//! Functions: `execute_read`, `read_outputs`, `residual_bytes`, `allocate_all` and 10 more. -//! Split out of `qwen_dispatch` to keep its files under the line limit. +//! GPU-only ignored test: runs the original GR read chain and the queued single-completion chain on the same inputs. +//! It requires identical output words, the injected-guard refusals and a clean status reset, with all buffers freed. use super::*; use crate::{Driver, GrReadInputs, GrReadOutputs}; diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs index 78a443bf..69aa082e 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs @@ -1,5 +1,5 @@ -//! Groups the submodules `shared_expert_workspace_append_close`, `shared_expert_workspace_bring_up`, `shared_expert_... -//! Split out of `qwen_shared_tail` to keep its files under the line limit. +//! Shared-expert workspace: groups bring-up, composition, and append/teardown, which share the workspace struct. +//! Each part keeps one lifecycle responsibility. use super::{ Admission, Arguments, Command, Context, DenseFormat, DeviceBuffer, Error, Kernels, OPERATIONS, Operation, Pair, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs index 2174fc99..885f2906 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedExpertWorkspace`: `append_qwen`, `close`, `close_inner`, `unload_module`. -//! Functions: `release_buffer`. +//! Shared-expert workspace: validated queuing of one Qwen operator, and teardown. +//! Teardown frees every buffer and unloads the kernel module under the guard, or leaks them on a poisoned context. use super::{ Admission, Arguments, Command, Context, DeviceBuffer, Error, Operation, Result, SharedExpertWorkspace, admission, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs index d79c4ec2..2fc3d49f 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedExpertWorkspace`: `new`, `init_resources`, `load_kernels`, `allocated_bytes` and 6 more. -//! Functions: `check_new`, `common_pair`, `projection_pairs`. +//! Bring-up of the shared-expert workspace: asset and budget checks, buffer allocation, kernel loading, accessors. +//! Also the admission of caller inputs: right size, same context, and no overlap with the workspace-owned buffers. use super::{ Context, DenseFormat, DeviceBuffer, Error, Kernels, OPERATIONS, Pair, ProjectionKind, ProjectionStyle, RESERVE, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs index 197723bc..2826a316 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedExpertWorkspace`: `compose`. -//! Split out of `shared_expert_workspace` to keep its files under the line limit. +//! Entry point of one shared-expert tail run: admits the inputs, drains the queue under the context guard. +//! Numeric flags are arbitrated after the final drain, so the workspace stays a bounded queue, not an operator API. use super::shared_phases::SharedStaging; use super::{DeviceBuffer, Error, Result, SharedExpertWeights, SharedExpertWorkspace, SharedTailCompletion}; diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs index eb503d59..15e2fc33 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `Command`: `launch`. Implements `Drop for SharedExpertWorkspace`. -//! Functions: `staging`, `status_spans`, `first_refusal`, `append_finite` and 3 more. +//! Drop of the shared-expert workspace plus the helpers that queue its work: status-word spans, finite guards, +//! quantize-and-project commands and the stage arbitration that maps a status word to a refusal. use super::{ Command, Context, Error, Pair, ProjectionSpec, ProjectionStyle, Result, STAGES, SharedExpertWorkspace, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs index 8da85b14..48e04ad4 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedGuKind`: `index`, `weight_bytes`. Methods of `SharedDownKind`: `index`, `weight_bytes`. -//! Split out of `qwen_shared_tail` to keep its files under the line limit. +//! Per-kind constants of the shared-expert weights (index and byte size of each gate/up and down format), +//! the accessors of a finished shared-tail run, and the context method that creates the workspace. use super::{ Context, Result, SharedDownKind, SharedExpertWorkspace, SharedGuKind, SharedTailCompletion, SharedTailRefusal, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs index 5ea71dc0..0bc983a7 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs @@ -1,5 +1,5 @@ -//! Functions: `refused`, `probe_inputs`, `probe_weights`, `probe_alias` and 12 more. -//! Split out of `shared_tail_gpu` to keep its files under the line limit. +//! Shared-tail GPU test: per-kind compose cases, fault injection and the admission-guard probes. +//! Compares the workspace with the old per-role path and checks that short, foreign or aliasing operands are refused. use super::{ ComposeCase, Context, DOWN, DeviceBuffer, Error, GU, Oracle, ProjectionKinds, Report, RestoreHandle, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs index ad4f16a5..ed03249e 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs @@ -1,5 +1,5 @@ -//! Methods of `OldPath`: `stage`, `product`, `gate`, `up` and 6 more. Methods of `RestoreHandle`: `new`. -//! Implements `Drop for RestoreHandle`. Functions: `refused`, `chain`, `original`, `compare` and 1 more. +//! Shared-tail GPU test oracle: replays the old multi-call path stage by stage for the expected products and refusal. +//! It then composes the same case on the workspace and compares every product, status and refusal word by word. use super::{ Context, DenseFormat, DeviceBuffer, Error, Oracle, ProjectionKind, ProjectionSpec, Report, RestoreHandle, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs index 96db614f..dc1a2a57 100644 --- a/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs @@ -1,5 +1,5 @@ -//! Functions: `read`, `f32_bytes`, `finite`, `input` and 7 more. -//! Split out of `shared_tail_gpu` to keep its files under the line limit. +//! Shared-tail GPU test fixtures: deterministic activations, routed packet, scalar weights and packed payloads +//! with finite scales, plus device read-back and the old-path projection call used as the oracle. use super::{ Context, DenseFormat, DeviceBuffer, ProjectionKind, ProjectionSpec, Q5KProjectionShape, Q6KProjectionShape, Result, diff --git a/crates/cuda-driver/src/qwen_dispatch/tests.rs b/crates/cuda-driver/src/qwen_dispatch/tests.rs index 21f92af4..0f2db625 100644 --- a/crates/cuda-driver/src/qwen_dispatch/tests.rs +++ b/crates/cuda-driver/src/qwen_dispatch/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `qwen_dispatch`. +//! Host-only tests of the Qwen dispatch layer on a mock backend that records driver calls and injects faults. +//! Submodules pin the cache and slot publication, poison handling, atomic registration and that a launch always syncs. use super::*; use std::cell::RefCell; diff --git a/crates/cuda-driver/src/qwen_ffi/asset.rs b/crates/cuda-driver/src/qwen_ffi/asset.rs index da68ecf2..73feaa2b 100644 --- a/crates/cuda-driver/src/qwen_ffi/asset.rs +++ b/crates/cuda-driver/src/qwen_ffi/asset.rs @@ -1,5 +1,5 @@ -//! Methods of `Arguments`: `new`, `with_layout`, `layout`, `operation` and 2 more. Implements `Drop for Arguments`. -//! Functions: `asset`, `asset_group_0`, `asset_group_1`, `asset_group_2` and 10 more. +//! Sealed PTX asset lookup per Qwen operation, the launch-argument block handed to the driver, and a SHA-256. +//! Arguments owns heap storage whose parameter array points at its own fields; the digest pins the PTX in receipts. use super::{ Arguments, Asset, BF16_ASSETS, GDN_ASSETS, GR_ASSETS, KAR_PLE_ASSETS, Layout, MOE_ASSETS, MTP_DENSE_ASSETS, diff --git a/crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs b/crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs index 9521794e..261951ac 100644 --- a/crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs +++ b/crates/cuda-driver/src/qwen_ffi/asset_validation_and_bf16_layout.rs @@ -1,5 +1,5 @@ -//! Methods of `Operation`: `has_epsilon`. -//! Methods of `Asset`: `validate`, `identity_admitted`, `receipt_complete`, `validate_with_memo`. +//! Admission checks of a PTX asset (identity, pin equals receipt, complete provenance, memoized content digest) +//! and the launch layouts of the KAR PLE and BF16 projection kernels, plus the constructors of pinned assets. use super::{ Asset, Error, GDN_RECEIPT, GR_RECEIPT, H, HC, Layout, MOE_RECEIPT, N, OnceLock, Operation, PLE_RECEIPT, PTX_PROOFS, diff --git a/crates/cuda-driver/src/qwen_ffi/bf16_receipt_types.rs b/crates/cuda-driver/src/qwen_ffi/bf16_receipt_types.rs index 336e4fe2..454cb4cd 100644 --- a/crates/cuda-driver/src/qwen_ffi/bf16_receipt_types.rs +++ b/crates/cuda-driver/src/qwen_ffi/bf16_receipt_types.rs @@ -1,5 +1,5 @@ -//! Items of the parent module. -//! BF16_RECEIPT, BF16_ASSETS, PLE_RECEIPT, PLE_ASSETS, PLE_VALUE_FULL_RECEIPT, PLE_VALUE_FULL_ASSET .... +//! Frozen producer receipts and sealed assets for the BF16 projection, PLE, GR, GDN, MoE and QSA native/select kernels. +//! Constant tables only: each receipt pins the source, PTX and oracle hashes and records how the kernel was qualified. use super::{Asset, H, HC, N, Operation, Receipt, gdn_asset, gr_asset, moe_asset, ple_asset}; diff --git a/crates/cuda-driver/src/qwen_ffi/mock_asset.rs b/crates/cuda-driver/src/qwen_ffi/mock_asset.rs index 2412819a..53626da6 100644 --- a/crates/cuda-driver/src/qwen_ffi/mock_asset.rs +++ b/crates/cuda-driver/src/qwen_ffi/mock_asset.rs @@ -1,5 +1,5 @@ -//! Functions: `mock_asset`, `q6_batch_preview_ptx`, `gr_batch_preview_ptx`. -//! Split out of `qwen_ffi` to keep its files under the line limit. +//! Test-only mock asset for CPU-side dispatch tests (never reaches CUDA) and the pinned PTX of the Q6/GR previews. +//! The preview entry points check the PTX digest and are kept out of the production asset map. use super::{Error, Result, inspect_ptx}; #[cfg(test)] diff --git a/crates/cuda-driver/src/qwen_ffi/mtp_extended_assets_types.rs b/crates/cuda-driver/src/qwen_ffi/mtp_extended_assets_types.rs index 1040f3ae..1b30c50c 100644 --- a/crates/cuda-driver/src/qwen_ffi/mtp_extended_assets_types.rs +++ b/crates/cuda-driver/src/qwen_ffi/mtp_extended_assets_types.rs @@ -1,5 +1,5 @@ -//! Defines `Storage`, `Arguments`. -//! MTP_EXTENDED_ASSETS, MTP_S2_FULL_RECEIPT, MTP_S2_FULL_ASSETS, Storage, Arguments. +//! Receipt-pinned assets of the extended MTP kernels and of the full S2 expert kernels. +//! Also the launch-argument records: Storage is the raw parameter block and Arguments is its owning handle. use super::{Asset, Layout, MTP_GR_RECEIPT, MTP_S2_RECEIPT, NonNull, Operation, Receipt, c_void}; diff --git a/crates/cuda-driver/src/qwen_ffi/mtp_s2_full_layout.rs b/crates/cuda-driver/src/qwen_ffi/mtp_s2_full_layout.rs index 8557b485..f2391a80 100644 --- a/crates/cuda-driver/src/qwen_ffi/mtp_s2_full_layout.rs +++ b/crates/cuda-driver/src/qwen_ffi/mtp_s2_full_layout.rs @@ -1,5 +1,5 @@ -//! Methods of `Layout`: `flat`. -//! Functions: `mtp_s2_full_layout`, `mtp_extended_layout`, `mtp_gr_geometry`, `mtp_tile_geometry` and 2 more. +//! Fixed launch layouts of the MTP kernels: full S2 expert gate/up and down, extended GR and tile ops, input, dense. +//! Geometry comes only from constants, the expert index or the position, never from caller extents; also Layout::flat. use super::{Error, Layout, Operation, Result}; diff --git a/crates/cuda-driver/src/qwen_ffi/n_types.rs b/crates/cuda-driver/src/qwen_ffi/n_types.rs index 59056ad3..d191827e 100644 --- a/crates/cuda-driver/src/qwen_ffi/n_types.rs +++ b/crates/cuda-driver/src/qwen_ffi/n_types.rs @@ -1,5 +1,5 @@ -//! Defines `Operation`, `Layout`, `Receipt` and 2 more. -//! N, HC, H, Operation, OPERATIONS, QSA_OPERATIONS .... +//! Core types of the Qwen FFI layer: model dimensions N, HC and H, the Operation enum with its lists, +//! the launch Layout, the producer Receipt, the PTX Asset and PTX proof memo, and the router receipt and asset. use super::OnceLock; diff --git a/crates/cuda-driver/src/qwen_ffi/operation.rs b/crates/cuda-driver/src/qwen_ffi/operation.rs index e4aafc87..0b810b76 100644 --- a/crates/cuda-driver/src/qwen_ffi/operation.rs +++ b/crates/cuda-driver/src/qwen_ffi/operation.rs @@ -1,5 +1,5 @@ -//! Methods of `Operation`: `entry`, `entry_group_0`, `entry_group_1`, `entry_group_2` and 10 more. -//! Functions: `router_layout`. +//! Per-operation data of the Qwen kernels: the entry point name and the launch Layout of each Operation. +//! Layout selection delegates to the MTP, dense, KAR, QSA, MoE, PLE, GDN, router and elementwise families. use super::{ CStr, H, HC, Layout, N, Operation, QSA_OPERATIONS, bf16_layout, gdn_layout, kar_ple_layout, moe_layout, diff --git a/crates/cuda-driver/src/qwen_ffi/qsa_attention_receipt_types.rs b/crates/cuda-driver/src/qwen_ffi/qsa_attention_receipt_types.rs index 24fa6f56..d47a582c 100644 --- a/crates/cuda-driver/src/qwen_ffi/qsa_attention_receipt_types.rs +++ b/crates/cuda-driver/src/qwen_ffi/qsa_attention_receipt_types.rs @@ -1,5 +1,5 @@ -//! Items of the parent module. -//! QSA_ATTENTION_RECEIPT, QSA_GATE_RECEIPT, QSA_ASSETS, KAR_PLE_RECEIPT, KAR_PLE_ASSETS, MTP_INPUT_RECEIPT .... +//! Frozen receipts and sealed assets for the QSA attention and gate kernels, KAR PLE, and the MTP kernels. +//! Constant tables only: each receipt pins source, PTX and oracle hashes and records how the kernel was qualified. use super::{Asset, H, HC, N, Operation, Receipt, qsa_asset}; diff --git a/crates/cuda-driver/src/qwen_ffi/qsa_layout.rs b/crates/cuda-driver/src/qwen_ffi/qsa_layout.rs index 27e5f5f8..af62cdc6 100644 --- a/crates/cuda-driver/src/qwen_ffi/qsa_layout.rs +++ b/crates/cuda-driver/src/qwen_ffi/qsa_layout.rs @@ -1,5 +1,5 @@ -//! Functions: `qsa_layout`, `check_qsa_value`, `qsa_geometry`, `qsa_plain_geometry` and 5 more. Defines `QsaGeometry`. -//! Split out of `qwen_ffi` to keep its files under the line limit. +//! Fixed launch layouts of the QSA kernels (extents set by position or selected width) and of the PLE, MoE, GDN ones. +//! Every size and grid is a closed constant or a bounded function of one scalar, never a caller-supplied geometry. use super::{Error, Layout, Operation, QSA_OPERATIONS, Result}; diff --git a/crates/cuda-driver/src/qwen_ffi/tests.rs b/crates/cuda-driver/src/qwen_ffi/tests.rs index ea6aed40..d07c9506 100644 --- a/crates/cuda-driver/src/qwen_ffi/tests.rs +++ b/crates/cuda-driver/src/qwen_ffi/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `qwen_ffi`. +//! Host tests of the Qwen FFI layer: layouts, ABI sizes, pointer order, receipts and the qualified assets. +//! Submodules are grouped by operation family (full S2, MoE, MTP, QSA). use super::*; diff --git a/crates/cuda-driver/src/routed_group_workspace/context.rs b/crates/cuda-driver/src/routed_group_workspace/context.rs index ec197dd6..be9f6a42 100644 --- a/crates/cuda-driver/src/routed_group_workspace/context.rs +++ b/crates/cuda-driver/src/routed_group_workspace/context.rs @@ -1,5 +1,5 @@ -//! Methods of `Context`: `routed_group_workspace`. -//! Methods of `RoutedGroupWorkspace`: `allocated_bytes`, `is_failed`, `validate`, `disjoint` and 12 more. +//! Routed grouped-projection workspace: creation under the context budget, ownership and validation of its table, +//! Q8 and status buffers, the gate/up and down column projections with their admission checks, and release. use super::{ ALLOCATED_BYTES, Context, DeviceBuffer, Error, FixedKernel, FixedOperation, NativeWeights, ProjectionKind, diff --git a/crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs b/crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs index 4dc5bb0d..5c00626c 100644 --- a/crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs +++ b/crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs @@ -1,5 +1,5 @@ -//! Methods of `CaseRig`: `allocate`, `run`, `pair_over_inputs`, `refusal_pass` and 3 more. -//! Functions: `with_columns`, `block_width`, `case`, `refusal_step` and 2 more. +//! GPU proof cases of the routed resident queue: for each gate/up and down format and column count, it runs the +//! original path first, then the queue, and pins identical products, bad-count and foreign-weight refusals. use super::{ Context, DeviceBuffer, Error, Report, Result, RoutedFormat, RoutedGateUpQ8, RoutedResidentOutputs, diff --git a/crates/cuda-driver/src/routed_resident_queue/gpu/run.rs b/crates/cuda-driver/src/routed_resident_queue/gpu/run.rs index 8fa12fd1..ff7d4390 100644 --- a/crates/cuda-driver/src/routed_resident_queue/gpu/run.rs +++ b/crates/cuda-driver/src/routed_resident_queue/gpu/run.rs @@ -1,5 +1,5 @@ -//! Functions: `run`. -//! Split out of `gpu` to keep its files under the line limit. +//! Driver of the routed resident queue GPU proof: runs every gate/up and down format pair at 1 and 64 columns +//! plus one fault case on a single queue, then checks the allocation charge and closes the queue. use super::{CHARGE, CaseSpec, Context, Error, Report, Result, RoutedFormat, RoutedResidentQueue, case, combine}; diff --git a/crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs b/crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs index 9c2a4176..f2bd5cf5 100644 --- a/crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs +++ b/crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs @@ -1,5 +1,5 @@ -//! Functions: `upload`, `read`, `weights`, `activation` and 9 more. Defines `Refusal`. -//! Split out of `gpu` to keep its files under the line limit. +//! Fixtures and the original-path oracle of the routed resident queue GPU proof: uploads, deterministic weights and +//! activations, the original per-stage products with their refusal, and the comparison of the queue's completion. use super::{ Context, DeviceBuffer, DownColumns, Error, QueueProof, Report, Result, RoutedFormat, RoutedGateUpQ8, diff --git a/crates/cuda-driver/src/routed_resident_queue/routed_resident_completion.rs b/crates/cuda-driver/src/routed_resident_queue/routed_resident_completion.rs index da16ad00..b7dd8bb6 100644 --- a/crates/cuda-driver/src/routed_resident_queue/routed_resident_completion.rs +++ b/crates/cuda-driver/src/routed_resident_queue/routed_resident_completion.rs @@ -1,5 +1,5 @@ -//! Methods of `RoutedResidentCompletion`: `numerical_refusal`, `completed_hidden`, `completed_down`. -//! Methods of `Context`: `routed_resident_queue`. +//! Completion view of a routed resident queue run (which stage refused, the usable hidden and down products) +//! and bring-up of the queue: budget check, buffer allocation and warming of the grouped and finite kernels. use super::{ CHARGE, Context, DeviceBuffer, Error, FixedOperation, Q8, RESERVE, Result, RoutedResidentCompletion, diff --git a/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_drop.rs b/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_drop.rs index 95057b5f..00d1920b 100644 --- a/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_drop.rs +++ b/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_drop.rs @@ -1,5 +1,5 @@ -//! Methods of `Command`: `launch`. Implements `Drop for RoutedResidentQueue`. Functions: `gu_operation`, `scan`. -//! Split out of `routed_resident_queue` to keep its files under the line limit. +//! Drop of the routed resident queue, the mapping of a gate/up format to its grouped kernel, the finite scan command, +//! and the launch of each queued command kind through the driver. use super::{Command, Context, Error, FixedOperation, Result, RoutedFormat, RoutedResidentQueue, ffi}; diff --git a/crates/cuda-driver/src/tests.rs b/crates/cuda-driver/src/tests.rs index fd82d1f7..c9ed593e 100644 --- a/crates/cuda-driver/src/tests.rs +++ b/crates/cuda-driver/src/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `crate`. +//! Tests of the CUDA driver crate root: GPU-only owned read-back (original first, raw words kept), checked subspans, +//! size and error composition, vector and matvec shape boundaries, and refusals that need no CUDA. #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] fn readback_source(size: usize, round: u32) -> Vec { diff --git a/crates/cuda-model/src/original_mtp_loader/loader_error.rs b/crates/cuda-model/src/original_mtp_loader/loader_error.rs index 7ea27db1..d59e71e2 100644 --- a/crates/cuda-model/src/original_mtp_loader/loader_error.rs +++ b/crates/cuda-model/src/original_mtp_loader/loader_error.rs @@ -1,5 +1,5 @@ -//! Methods of `LoaderError`: `message`. Methods of `WeightBankPlan`: `new`, `expert_reads`. -//! Implements `Iterator for ExpertReads`. Functions: `add`, `mul`, `ceil`, `aligned` and 10 more. Defines `Placement`. +//! Sizing arithmetic of the original MTP draft loader: loader error messages, overflow-checked helpers, +//! weight-bank expert read ranges, the draft K/V placement and byte plan, the coupled-sampler plan, the bind reserve. use super::{ BindInputs, COUPLED_HISTORY, CoupledPlan, EXPERT_BLOB_BYTES, EXPERT_READ_BYTES, ExpertReads, KvFormat, KvInputs, diff --git a/crates/cuda-model/src/original_mtp_loader/original_mtp_load_plan.rs b/crates/cuda-model/src/original_mtp_loader/original_mtp_load_plan.rs index 89134258..e8fa45d3 100644 --- a/crates/cuda-model/src/original_mtp_loader/original_mtp_load_plan.rs +++ b/crates/cuda-model/src/original_mtp_loader/original_mtp_load_plan.rs @@ -1,5 +1,5 @@ -//! Methods of `OriginalMtpLoadPlan`: `new`, `kv_inputs`, `check_profile`, `check_session` and 9 more. -//! Split out of `original_mtp_loader` to keep its files under the line limit. +//! The whole load plan of the original MTP draft: validates a startup capture against the one closed profile, +//! then derives the weight bank, K/V plan, mapped staging, bind reserve and coupled layout from it. use super::{ CLOSED_MAX_CELLS, CLOSED_WINDOW, CoupledPlan, KvInputs, KvMode, KvPlan, LoaderError, OriginalMtpCapture, diff --git a/crates/cuda-model/src/original_mtp_loader/tests.rs b/crates/cuda-model/src/original_mtp_loader/tests.rs index 73d047e5..4601297a 100644 --- a/crates/cuda-model/src/original_mtp_loader/tests.rs +++ b/crates/cuda-model/src/original_mtp_loader/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the MTP load plan: the shipped profile gives the retained ring layout byte for byte, +//! profiles outside the closed set are refused with a reason, and bank, reserve, coupled plan, staging match. use super::*; diff --git a/crates/cuda-model/src/original_prefill_schedule/planner.rs b/crates/cuda-model/src/original_prefill_schedule/planner.rs index d78213e2..bbe42a1c 100644 --- a/crates/cuda-model/src/original_prefill_schedule/planner.rs +++ b/crates/cuda-model/src/original_prefill_schedule/planner.rs @@ -1,5 +1,5 @@ -//! Methods of `Planner`: `new`, `push`, `issue_until`, `plan_chunk` and 5 more. -//! Functions: `is_stream_all`, `check_config`, `chunk_sequence`, `staging_jobs` and 5 more. +//! Planner of the original prefill expert streaming: builds the per-chunk schedule of copies, waits and computes +//! for the stream_all and staged walks, and a ring/event checker that rejects unsafe slot reuse in a planned trace. use super::{ ChunkStreaming, CopySource, IssueState, JobKind, PlanError, Planner, RING_MAX, STAGE, SchedOp, Slot, SourceView, diff --git a/crates/cuda-model/src/original_prefill_schedule/tests.rs b/crates/cuda-model/src/original_prefill_schedule/tests.rs index 84ef1771..6d7e461b 100644 --- a/crates/cuda-model/src/original_prefill_schedule/tests.rs +++ b/crates/cuda-model/src/original_prefill_schedule/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the prefill schedule: the traces, PLE read-ahead and fuse rule match golden values from the original; +//! ring slot sizing and chunk hand-off follow its rules, and the checker rejects unsafe or malformed schedules. use super::*; use serde_json::Value; diff --git a/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs b/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs index 1bc5a2ce..162760a7 100644 --- a/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs +++ b/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs @@ -1,5 +1,5 @@ -//! Methods of `PoolPresence`: `int8`, `fp16`, `hybrid_k8v4`, `q4`. `impl Shapes`. -//! Functions: `align_up`, `smem_bytes`, `smem2_bytes`, `pools_admitted` and 9 more. +//! Kernel selection of the QSA prompt attention: which K/V pools are present, admission of pools and shapes, +//! the port of the original decision tree for CUDA, shared-memory sizes, launch slicing and an FP64 reference. use super::{ CH, CH2, CStr, DEFAULT_SHARED_LIMIT, DeviceCaps, ENTRY_FP16, ENTRY_K8V4, ENTRY_V1_INT8, ENTRY_V2_INT8, G, HD, diff --git a/crates/cuda-model/src/qsa_prompt_attention_select/q_prescale.rs b/crates/cuda-model/src/qsa_prompt_attention_select/q_prescale.rs index 0ac6025c..dd08ddf5 100644 --- a/crates/cuda-model/src/qsa_prompt_attention_select/q_prescale.rs +++ b/crates/cuda-model/src/qsa_prompt_attention_select/q_prescale.rs @@ -1,5 +1,5 @@ -//! Functions: `q_prescale`, `pow2f`, `f16_hi_lo`, `f16_round` and 4 more. -//! Split out of `qsa_prompt_attention_select` to keep its files under the line limit. +//! Host model of the q pre-scale and FP16 hi/lo split the prompt attention kernels apply, with exact +//! binary16 rounding and conversion helpers (round to nearest even), so tests can reproduce the kernel numerics. /// The q pre-scale the kernels apply before the hi/lo FP16 split (exact, power of two): returns `(qe, qup, diff --git a/crates/cuda-model/src/qsa_prompt_attention_select/tests.rs b/crates/cuda-model/src/qsa_prompt_attention_select/tests.rs index 46020b0e..626ae88d 100644 --- a/crates/cuda-model/src/qsa_prompt_attention_select/tests.rs +++ b/crates/cuda-model/src/qsa_prompt_attention_select/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the prompt attention selection: smem sizes match the compiled structs, the decision tree per +//! architecture, pool and geometry, env switches, launch slicing, page-table rows, the entry table and FP16 rounding. use super::*; diff --git a/crates/cuda-model/src/s_gemv_legacy/tests.rs b/crates/cuda-model/src/s_gemv_legacy/tests.rs index 146a3015..e51b5e8f 100644 --- a/crates/cuda-model/src/s_gemv_legacy/tests.rs +++ b/crates/cuda-model/src/s_gemv_legacy/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests that pin the legacy S-GEMV model: golden cases match the shim-executed kernels bit for bit, +//! pack/unpack and FP16 round-trips, kernel entry names against the CUDA source, and launch plans with refusals. use super::*; use serde_json::Value; diff --git a/crates/experimental-ref/src/cache/tests.rs b/crates/experimental-ref/src/cache/tests.rs index 47ab8fae..22e6a047 100644 --- a/crates/experimental-ref/src/cache/tests.rs +++ b/crates/experimental-ref/src/cache/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the KV cache CPU twin: Q4 round trip within half a step in the rotated domain, the streaming write rule +//! (host always, VRAM only when resident), K8V4 composition, and refusal of fp16 and bad geometry. use super::*; use crate::fwht; diff --git a/crates/experimental-ref/src/cvec/load_control_vectors.rs b/crates/experimental-ref/src/cvec/load_control_vectors.rs index 28808825..bcfdfef4 100644 --- a/crates/experimental-ref/src/cvec/load_control_vectors.rs +++ b/crates/experimental-ref/src/cvec/load_control_vectors.rs @@ -1,5 +1,5 @@ -//! Functions: `direction_layer`, `add_scaled`, `add_file`, `steer_row` and 13 more. Defines `CvecRows`. -//! Split out of `cvec` to keep its files under the line limit. +//! Control-vector loading and application: sums the scaled per-layer directions of GGUF files into project/add tables, +//! and a literal twin of the cvec_apply kernel on the residual rows (warp butterfly sums, pending FFN write, steering). use super::{CvecError, CvecMode, CvecOptions, CvecTables, MAXK, THREADS, parse_gguf}; diff --git a/crates/experimental-ref/src/cvec/tests.rs b/crates/experimental-ref/src/cvec/tests.rs index 08d81e76..29e6edae 100644 --- a/crates/experimental-ref/src/cvec/tests.rs +++ b/crates/experimental-ref/src/cvec/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of control vectors: GGUF parsing (layer 0 and layers past the model ignored), project and add modes, single- +//! layer sources, rejections, steering of the residual streams, the pending FFN write and the warp reduction tree. use super::*; diff --git a/crates/experimental-ref/src/keyless/tests.rs b/crates/experimental-ref/src/keyless/tests.rs index 6a41c414..6af337c7 100644 --- a/crates/experimental-ref/src/keyless/tests.rs +++ b/crates/experimental-ref/src/keyless/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of keyless V-only QSA: query routing, output-major routing matrix, position handling, key reconstruction +//! of the first 64 dims, the routing artifact round trip with each admission failure, and block geometry. use super::*; diff --git a/crates/experimental-ref/src/kv_stream/map_bytes.rs b/crates/experimental-ref/src/kv_stream/map_bytes.rs index 1ea1d51f..77cf5a67 100644 --- a/crates/experimental-ref/src/kv_stream/map_bytes.rs +++ b/crates/experimental-ref/src/kv_stream/map_bytes.rs @@ -1,5 +1,5 @@ -//! Functions: `map_bytes`, `kv_plan`, `align16`, `qsa_state_bytes` and 2 more. Defines `StateCells`. -//! Split out of `kv_stream` to keep its files under the line limit. +//! KV streaming planner arithmetic: size of the residency map, the kv_plan mode choice (resident, ring, streamed), +//! QSA state and host-copy byte sizes, and the guards of a resolve call. use super::{ CTL_INTS, KV_RESIDENT_MIN, KvFormat, KvPlan, PlanSwitches, QsaShapes, RT, STEP_BYTES, StreamError, StreamFormat, diff --git a/crates/experimental-ref/src/kv_stream/residency_map.rs b/crates/experimental-ref/src/kv_stream/residency_map.rs index a6109cdb..47990a13 100644 --- a/crates/experimental-ref/src/kv_stream/residency_map.rs +++ b/crates/experimental-ref/src/kv_stream/residency_map.rs @@ -1,5 +1,5 @@ -//! Methods of `StreamMap`: `new`, `n_slots`, `reset`, `counters` and 11 more. -//! Functions: `ring_table`, `ring_restore`, `stage_from_host`, `observed_order` and 2 more. +//! The KV residency map (StreamMap): CPU model of the CLOCK resolver that claims slots for missed blocks, plus the +//! ring table, the ring restore and the staging copy from the host pool. use super::{ CTL_INTS, Counters, MissOrder, PoolSet, QsaShapes, RT, ResolveBatch, ResolveReport, RingSpan, StreamError, diff --git a/crates/experimental-ref/src/kv_stream/tests.rs b/crates/experimental-ref/src/kv_stream/tests.rs index 6b9ddab3..50293756 100644 --- a/crates/experimental-ref/src/kv_stream/tests.rs +++ b/crates/experimental-ref/src/kv_stream/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of KV streaming: plan modes, resolve guards, map consistency and counters after eviction, slots used by +//! the call never being victims, miss-order effects, refusal of too many blocks, ring table and state size. use super::*; diff --git a/crates/experimental-ref/src/layout/tests.rs b/crates/experimental-ref/src/layout/tests.rs index d6b29640..739c9741 100644 --- a/crates/experimental-ref/src/layout/tests.rs +++ b/crates/experimental-ref/src/layout/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of KV layouts: per-cell byte figures per format, pool arrays summing to them, 16-byte alignment, array +//! order, block bytes, uint4 copy run lengths, and the format selection rules of the Original. use super::*; diff --git a/crates/experimental-ref/src/remote_experts/tests.rs b/crates/experimental-ref/src/remote_experts/tests.rs index a34e8fe9..47258de5 100644 --- a/crates/experimental-ref/src/remote_experts/tests.rs +++ b/crates/experimental-ref/src/remote_experts/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the second-GPU expert tier: device meta layout, expert selection and open failures, slot rounding, +//! dispatch grouping and validation, the meta image with scatter, and the device buffer budget. use super::*; diff --git a/crates/gptoss/src/ops/tests.rs b/crates/gptoss/src/ops/tests.rs index dcebff7b..7b5b22f5 100644 --- a/crates/gptoss/src/ops/tests.rs +++ b/crates/gptoss/src/ops/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the gpt-oss CPU ops against f64 references: RMS norm, YaRN RoPE (range, rotation, norm), attention with +//! sinks and head groups across kernel levels, expert routing softmax, and the clamped SwiGLU. use super::*; diff --git a/crates/harmony/src/parse/tests.rs b/crates/harmony/src/parse/tests.rs index e0e97300..71851fb1 100644 --- a/crates/harmony/src/parse/tests.rs +++ b/crates/harmony/src/parse/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the Harmony stream parser: analysis, final and return turns, tool calls with the recipient in the channel +//! or the start header, several calls in one generation, dropped unknown channels, and a cut-off call closed at finish. use super::*; use Piece::{Special as S, Text as T}; diff --git a/crates/harmony/src/render/render_namespace.rs b/crates/harmony/src/render/render_namespace.rs index c644e664..f4f51735 100644 --- a/crates/harmony/src/render/render_namespace.rs +++ b/crates/harmony/src/render/render_namespace.rs @@ -1,5 +1,5 @@ -//! Methods of `Out`: `new`, `lit`, `text`. -//! Functions: `render_namespace`, `render_tool_definition`, `render_tool_parameter`, `render_parameter_default` and ... +//! Harmony prompt renderer: assembles system, developer, user, assistant and tool messages into the gpt-oss prompt, +//! and renders the tool namespace (TypeScript-like definitions of tools and their parameters) with an output buffer. use super::{ HarmonyError, Message, Out, RenderOptions, Role, SENTINELS, Tool, ToolCall, Value, as_concat_str, err, render_type, diff --git a/crates/harmony/src/render/render_options.rs b/crates/harmony/src/render/render_options.rs index 8723dced..e7cf5705 100644 --- a/crates/harmony/src/render/render_options.rs +++ b/crates/harmony/src/render/render_options.rs @@ -1,5 +1,5 @@ -//! Methods of `RenderOptions`: `new`. Functions: `err`, `truthy`, `to_json`, `write_json_string` and 13 more. -//! Split out of `render` to keep its files under the line limit. +//! Render options and Jinja-compatible helpers of the Harmony chat template: truthiness, tojson output, string +//! concatenation, and rendering of JSON-schema types and required names as TypeScript-like text. use super::{HarmonyError, Map, NESTED_INDENT, ONE_OF_DEFAULT_INDENT, RenderOptions, Value}; diff --git a/crates/igpu/src/shaders/gemm.rs b/crates/igpu/src/shaders/gemm.rs index 71482f7f..1059b6e7 100644 --- a/crates/igpu/src/shaders/gemm.rs +++ b/crates/igpu/src/shaders/gemm.rs @@ -1,5 +1,5 @@ -//! Methods of `Unrolled`: `new`, `cell`, `operands_and_scales`, `holes`. -//! Functions: `gemm`, `store_cell`, `weight_holes`, `row_source_holes` and 3 more. Defines `Unrolled`. +//! WGSL source generator for the tiled Q8_0 / MXFP4 integer GEMM (plain and mixture-of-experts row source): fills the +//! shared template with tile sizes, unrolled accumulators, weight-format and row-source parts. use super::{F16_ROUND, WeightKind}; use super::gemm_template::TEMPLATE; diff --git a/crates/leleka-memory/src/governor/governor_config.rs b/crates/leleka-memory/src/governor/governor_config.rs index 942eac5c..f873d5b2 100644 --- a/crates/leleka-memory/src/governor/governor_config.rs +++ b/crates/leleka-memory/src/governor/governor_config.rs @@ -1,5 +1,5 @@ -//! Methods of `Policy`: `apply_env_floors`, `apply_env_psi`. -//! Methods of `GovernorConfig`: `new`, `apply_env_runtime`, `from_env`. Implements `EnvLookup for F`. +//! Governor configuration: GovernorConfig defaults, the LELEKA_MEMORY_* environment overrides (validated, a typo is an +//! error rather than a silent default) and the Policy floors/PSI overrides; also the published report and lock helpers. use super::{GIB, GovernorConfig, LockMode, MIB, Mutex, MutexGuard, PUBLISHED, Policy}; diff --git a/crates/leleka-memory/src/governor/tests.rs b/crates/leleka-memory/src/governor/tests.rs index dbbc80cb..b0906615 100644 --- a/crates/leleka-memory/src/governor/tests.rs +++ b/crates/leleka-memory/src/governor/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the governor over a fake host: admission, shedding order, hard-floor refusal and recovery, counters and +//! report JSON, validated env overrides, a dead sampler not leaving the gate closed, and the sampler thread. use super::*; use crate::host::FakeProc; diff --git a/crates/leleka-memory/src/lock/lock_mode.rs b/crates/leleka-memory/src/lock/lock_mode.rs index ef6af070..974db8d0 100644 --- a/crates/leleka-memory/src/lock/lock_mode.rs +++ b/crates/leleka-memory/src/lock/lock_mode.rs @@ -1,5 +1,5 @@ -//! Methods of `LockMode`: `parse`. Methods of `LockOutcome`: `locked_bytes`. -//! Functions: `memlock_advice`, `plan_lock`, `residency_from_smaps`, `spans_bytes` and 2 more. +//! Memory-lock policy for the model archive: parsing of the lock mode, the pure decision whether RLIMIT_MEMLOCK and +//! capabilities allow locking, with operator advice, and span helpers (checks, compact space walk, smaps residency). use super::{CAP_IPC_LOCK_BIT, LockDecision, LockMode, LockOutcome, PAGE, ProcStatus, Residency, Span, procfs}; diff --git a/crates/leleka-memory/src/lock/tests.rs b/crates/leleka-memory/src/lock/tests.rs index f0446d5c..2f289f8a 100644 --- a/crates/leleka-memory/src/lock/tests.rs +++ b/crates/leleka-memory/src/lock/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the lock decision and span helpers: limit and capability cases with operator advice, off mode, pages +//! already locked, span validation and compact-space walking, and residency read from the smaps mapping. use super::*; diff --git a/crates/leleka-memory/src/plan/auto_prefix_budget.rs b/crates/leleka-memory/src/plan/auto_prefix_budget.rs index ba50df29..1e4d9ceb 100644 --- a/crates/leleka-memory/src/plan/auto_prefix_budget.rs +++ b/crates/leleka-memory/src/plan/auto_prefix_budget.rs @@ -1,5 +1,5 @@ -//! Functions: `auto_prefix_budget`, `explicit_prefix_budget`. -//! Split out of `plan` to keep its files under the line limit. +//! Prefix-cache budget at stack open, recomputed from the memory then available: the auto rule (share of the elastic +//! memory, capped) and the explicit one (the wish clamped to the host, never above the wish). use super::{MIB, Policy}; diff --git a/crates/leleka-memory/src/plan/policy.rs b/crates/leleka-memory/src/plan/policy.rs index 02393ec9..c44ea8f5 100644 --- a/crates/leleka-memory/src/plan/policy.rs +++ b/crates/leleka-memory/src/plan/policy.rs @@ -1,5 +1,5 @@ -//! Methods of `Policy`: `admit_floor`, `for_host`. Methods of `FixedItem`: `new`. -//! Implements `Display for Refusal`, `Error for Refusal`. +//! Plan policy defaults and errors: host-scaled floors, reserve and cache shares (Policy::for_host), the admit +//! floor, FixedItem constructor, the Refusal error type and its text, and the memory plan itself (plan, VRAM check). use super::{ CacheWish, FixedItem, GIB, KarForm, MIB, Plan, PlanInput, Policy, Refusal, Space, VramFacts, VramPlan, wsl_advice, diff --git a/crates/leleka-memory/src/plan/tests.rs b/crates/leleka-memory/src/plan/tests.rs index 845029bf..31895fcb 100644 --- a/crates/leleka-memory/src/plan/tests.rs +++ b/crates/leleka-memory/src/plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the memory plan: auto and explicit cache sizing, refusals with numbers and advice (also WSL), blind +//! hosts without telemetry, VRAM fit, enforcement off, and caps that never grow while auto budgets do. use super::*; use crate::host::FakeProc; diff --git a/crates/leleka-memory/src/pressure/tests.rs b/crates/leleka-memory/src/pressure/tests.rs index 898ef059..ca930795 100644 --- a/crates/leleka-memory/src/pressure/tests.rs +++ b/crates/leleka-memory/src/pressure/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `pressure`. +//! Tests of the pressure monitor: escalation at once below the floors, stepping down only after calm samples +//! and the hysteresis margin, unknown memory holding shed, PSI stalls, cgroup OOM events and swap-out storms. use super::*; use crate::plan::GIB; diff --git a/crates/leleka-memory/src/procfs/tests.rs b/crates/leleka-memory/src/procfs/tests.rs index 138df8b3..9248411b 100644 --- a/crates/leleka-memory/src/procfs/tests.rs +++ b/crates/leleka-memory/src/procfs/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the procfs parsers: meminfo, status (pinned, locked, swap), memlock limit, PSI, cgroup files and smaps, +//! including refusal of malformed, duplicated or trailing-field input. use super::*; diff --git a/crates/leleka-memory/src/telemetry/lock.rs b/crates/leleka-memory/src/telemetry/lock.rs index a8ee46b1..9729dcb9 100644 --- a/crates/leleka-memory/src/telemetry/lock.rs +++ b/crates/leleka-memory/src/telemetry/lock.rs @@ -1,5 +1,5 @@ -//! Methods of `State`: `fold_prefill`, `fold_decode`. -//! Functions: `lock`, `with_state`, `published_telemetry`, `set_settings` and 20 more. +//! Recording side of telemetry: the global state and published document behind locks, entry points the engine calls +//! as a request starts, delivers tokens, finishes or hits the NaN guard, and the /proc CPU readers and rate helpers. use super::{ Clock, CpuReading, Duration, EMA_ALPHA, Instant, LastRequest, Mutex, MutexGuard, PUBLISHED, Phase, ProcSource, diff --git a/crates/leleka-memory/src/telemetry/render.rs b/crates/leleka-memory/src/telemetry/render.rs index 30d745f7..dbb02047 100644 --- a/crates/leleka-memory/src/telemetry/render.rs +++ b/crates/leleka-memory/src/telemetry/render.rs @@ -1,5 +1,5 @@ -//! Methods of `Sampler`: `stop`. Implements `Drop for Sampler`. -//! Functions: `ram_of`, `live_rate_of`, `live_request_of`, `rates_of` and 12 more. +//! Rendering and sampling side of telemetry: turns the recorded state and one measurement into the JSON document +//! and runs the Sampler thread that measures the host once a period and publishes it; stops on drop. use super::{ Arc, AtomicBool, Cache, Clock, Context, Cpu, CpuReading, Document, Duration, GpuProbe, Instant, LiveRequest, diff --git a/crates/leleka-memory/src/telemetry/tests.rs b/crates/leleka-memory/src/telemetry/tests.rs index efac2ea4..7b54ee2b 100644 --- a/crates/leleka-memory/src/telemetry/tests.rs +++ b/crates/leleka-memory/src/telemetry/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of telemetry: /proc parsing, the NaN guard counters, the per-request engine line, tier shares, folding +//! of requests into rates, cache and context, in-flight progress, and nulls for unmeasured rates. use super::*; diff --git a/crates/libc-shim/src/cuda_trace/tests.rs b/crates/libc-shim/src/cuda_trace/tests.rs index 501530b5..f330af28 100644 --- a/crates/libc-shim/src/cuda_trace/tests.rs +++ b/crates/libc-shim/src/cuda_trace/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the CUDA Driver trace: untouched symbols and foreign handles pass through, a batched copy is described +//! by its count and stream, and the ring names a kernel. use super::*; diff --git a/crates/model-format/src/bulk_read/for_each_chunk.rs b/crates/model-format/src/bulk_read/for_each_chunk.rs index 56ec82ee..9975b944 100644 --- a/crates/model-format/src/bulk_read/for_each_chunk.rs +++ b/crates/model-format/src/bulk_read/for_each_chunk.rs @@ -1,5 +1,5 @@ -//! Methods of `Shared`: `new`, `begin`. -//! Functions: `for_each_chunk`, `span_file_len`, `run_readers`, `open_strategy` and 2 more. +//! Public entry points of the cold bulk read: for_each_chunk (reader threads over aligned blocks, first error stops +//! all, sink gets each block) and read_into (fills a buffer); also strategy opening and the shared reader state. use super::{ ALIGN, Aligned, AtomicU64, File, Instant, Mutex, Plan, Report, Shared, Strategy, evict, io, open_direct, read_full, diff --git a/crates/model-format/src/bulk_read/strategy.rs b/crates/model-format/src/bulk_read/strategy.rs index cf5f0f47..dbf34eec 100644 --- a/crates/model-format/src/bulk_read/strategy.rs +++ b/crates/model-format/src/bulk_read/strategy.rs @@ -1,5 +1,5 @@ -//! Methods of `Strategy`: `as_str`. Methods of `Plan`: `from_env`, `with_overrides`. Implements `Default for Plan`. -//! Functions: `open_direct`, `open_direct`, `read_at`, `read_at` and 3 more. +//! Read configuration and low-level IO of the bulk reader: Strategy and Plan (defaults plus LELEKA_LOAD_* env +//! overrides), aligned bounce buffers, O_DIRECT reopen, pread, fadvise and eviction, and the per-block worker loop. use super::{ALIGN, Aligned, File, Ordering, Plan, Report, Shared, Strategy, io}; diff --git a/crates/model-format/src/bulk_read/tests.rs b/crates/model-format/src/bulk_read/tests.rs index 8d3a6bd8..4fddd876 100644 --- a/crates/model-format/src/bulk_read/tests.rs +++ b/crates/model-format/src/bulk_read/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the bulk reader: every strategy returns identical bytes for aligned and ragged spans, blocks cover the span +//! exactly once, bad spans and sink errors fail, a short file is UnexpectedEof, and env overrides apply. use super::*; use std::io::Write; diff --git a/crates/model-format/src/gguf/cursor.rs b/crates/model-format/src/gguf/cursor.rs index d17cb0e8..cd2085c5 100644 --- a/crates/model-format/src/gguf/cursor.rs +++ b/crates/model-format/src/gguf/cursor.rs @@ -1,5 +1,5 @@ -//! Methods of `Cursor`: `new`, `with_test_capacity`, `position`, `skip` and 23 more. -//! Split out of `gguf` to keep its files under the line limit. +//! Cursor: the bounded, buffered GGUF header reader. Reads little-endian scalars, strings, arrays and metadata values +//! with truncation, overflow and duplicate-key checks, and skips values without reading them. use super::{ BufRead, BufReader, Cursor, HashSet, MetadataValue, Read, Result, STREAM_BUFFER_BYTES, Seek, SeekFrom, value_width, diff --git a/crates/model-format/src/gguf/parse_artifact_digest.rs b/crates/model-format/src/gguf/parse_artifact_digest.rs index e6700b83..765ad095 100644 --- a/crates/model-format/src/gguf/parse_artifact_digest.rs +++ b/crates/model-format/src/gguf/parse_artifact_digest.rs @@ -1,5 +1,5 @@ -//! Functions: `parse_artifact_digest`, `sha256_pipelined`, `stream_file_span`, `read_file_span_owned` and 8 more. -//! Split out of `gguf` to keep its files under the line limit. +//! GGUF file-level reads: parsing the sha256 artifact digest, pipelined whole-file hashing, span streaming into a +//! sink or owned buffer, the flash-next profile admission, and metadata_entries / tokenizer_metadata / snapshots. use super::{ BTreeMap, Cursor, Digest, FLASH_NEXT_PROFILE_KEYS, File, HashSet, MetadataSnapshot, MetadataValue, Path, Read, diff --git a/crates/model-format/src/gguf/read_index_file.rs b/crates/model-format/src/gguf/read_index_file.rs index fe2be0b6..e0dcbfef 100644 --- a/crates/model-format/src/gguf/read_index_file.rs +++ b/crates/model-format/src/gguf/read_index_file.rs @@ -1,5 +1,5 @@ -//! Functions: `read_index_file`, `block_geometry`. -//! Split out of `gguf` to keep its files under the line limit. +//! Strict tensor-index read of a GGUF file (count limits, no wide alignment) and the table of values-per-block and +//! bytes-per-block of each tensor kind (block_geometry), kept in step with the pinned Strata reader. use super::{Cursor, File, IndexRules, Result, Seek, SeekFrom, TensorIndex, parse_index}; diff --git a/crates/model-format/src/gguf/read_metadata_snapshot_with_architecture.rs b/crates/model-format/src/gguf/read_metadata_snapshot_with_architecture.rs index 31acac62..043f829f 100644 --- a/crates/model-format/src/gguf/read_metadata_snapshot_with_architecture.rs +++ b/crates/model-format/src/gguf/read_metadata_snapshot_with_architecture.rs @@ -1,5 +1,5 @@ -//! Methods of `SnapshotBuilder`: `read_entry`, `try_architecture`, `try_split`, `try_tokenizer` and 4 more. -//! Functions: `read_metadata_snapshot_with_architecture`, `validate_tokenizer_metadata`, `check_tokenizer_shape`, `c... +//! Metadata snapshot reader: walks the GGUF key/value entries and keeps only the wanted groups (architecture, split, +//! profile, tokenizer), validates tokenizer shape and merges; also inspect, tensor_index and tensor_sha256. use super::{ BTreeMap, Cursor, Digest, File, HashSet, MetadataSnapshot, MetadataValue, Path, Read, Result, Seek, SeekFrom, diff --git a/crates/model-format/src/gguf/resident/next_source_id.rs b/crates/model-format/src/gguf/resident/next_source_id.rs index 92182381..19df18c5 100644 --- a/crates/model-format/src/gguf/resident/next_source_id.rs +++ b/crates/model-format/src/gguf/resident/next_source_id.rs @@ -1,5 +1,5 @@ -//! Methods of `ResidentTensor`: `charged_bytes`, `len`, `file_mapped`, `backing`. -//! Methods of `ResidentStorage`: `backing`, `as_slice`, `len`. +//! Backing storage of a resident tensor (owned heap, mapped file span, huge pages): the unique source-id counter, +//! ResidentTensor accessors, and FileSpan, the read-only file mapping that unmaps itself on drop. use super::{FileSpan, NEXT_SOURCE_ID, Ordering, ResidentStorage, ResidentTensor, Result}; diff --git a/crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs b/crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs index 4f443847..7d80fe3b 100644 --- a/crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs +++ b/crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs @@ -1,5 +1,5 @@ -//! Methods of `VerifiedGgufFile`: `capture_source_identity`, `admit_captured_tensor`, `validate_capture_identity`, `... -//! Methods of `ResidentTensor`: `into_retained`, `retained_bytes`, `retention_metadata_bytes`. +//! Source identity and admission of captured tensors: VerifiedGgufFile hands out a resident source id, checks that +//! captured or retained bytes match the indexed tensor, and ResidentTensor is retained (Rc) with its metadata size. use super::{ResidentStorage, ResidentTensor, Result, VerifiedGgufFile, next_source_id}; diff --git a/crates/model-format/src/gguf/resident/verified_gguf_file.rs b/crates/model-format/src/gguf/resident/verified_gguf_file.rs index 7f241af7..c5073725 100644 --- a/crates/model-format/src/gguf/resident/verified_gguf_file.rs +++ b/crates/model-format/src/gguf/resident/verified_gguf_file.rs @@ -1,5 +1,5 @@ -//! Methods of `VerifiedGgufFile`: `load_resident_tensor`, `resident_extent`, `load_huge`, `load_heap` and 7 more. -//! Methods of `GgufSourceFence`: `copy_resident_tensor`. Functions: `mapping_granularity`, `mapping_granularity`. +//! Resident tensor loading from the verified GGUF file: heap or huge-page copies, read-only file mappings (Linux and +//! Windows), and copy-out of a resident span, all under the indexed bounds and same-descriptor size checks. use super::{ FileSpan, GgufSourceFence, ResidentLoadError, ResidentStorage, ResidentTensor, Result, VerifiedGgufFile, diff --git a/crates/model-format/src/gguf/stream_buffer_bytes.rs b/crates/model-format/src/gguf/stream_buffer_bytes.rs index 37844bc7..89d4de41 100644 --- a/crates/model-format/src/gguf/stream_buffer_bytes.rs +++ b/crates/model-format/src/gguf/stream_buffer_bytes.rs @@ -1,5 +1,5 @@ -//! Functions: `stream_buffer_bytes`, `stream_buffer_bytes`, `with_test_stream_buffer`. -//! Split out of `gguf` to keep its files under the line limit. +//! The stream buffer size for tensor span reads: fixed in production, with a thread-local test override +//! (with_test_stream_buffer) so small fixtures can exercise multi-chunk streaming. use super::STREAM_BUFFER_BYTES; #[cfg(test)] diff --git a/crates/model-format/src/gguf/tests.rs b/crates/model-format/src/gguf/tests.rs index 31c5d997..a3dd3c11 100644 --- a/crates/model-format/src/gguf/tests.rs +++ b/crates/model-format/src/gguf/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `gguf`. +//! Shared fixture of the gguf tests: OwnedFixture writes a tiny two-tensor GGUF in a temp directory (with its +//! sha256 digest and field offsets) and removes it on drop; the test cases live in the tests/ submodules. use super::*; diff --git a/crates/model-format/src/gguf/value_width.rs b/crates/model-format/src/gguf/value_width.rs index 63e9b350..af705c08 100644 --- a/crates/model-format/src/gguf/value_width.rs +++ b/crates/model-format/src/gguf/value_width.rs @@ -1,5 +1,5 @@ -//! Methods of `GgufSourceFence`: `validate_tensor`, `stream_tensor`, `read_tensor_owned`, `finish`. -//! Methods of `VerifiedGgufFile`: `validate_empty_tensor_source`, `validate_empty_tensor_span`, `begin_source_fence`. +//! Element width of GGUF array types, and the source fence: a guard over one verified file that validates empty-tensor +//! spans, streams or reads tensors with the original size checks, and finishes with a last size check. use super::{GgufSourceFence, Result, VerifiedGgufFile}; diff --git a/crates/model-format/src/gguf/verified_gguf_file.rs b/crates/model-format/src/gguf/verified_gguf_file.rs index fecfb3a8..aff38499 100644 --- a/crates/model-format/src/gguf/verified_gguf_file.rs +++ b/crates/model-format/src/gguf/verified_gguf_file.rs @@ -1,5 +1,5 @@ -//! Methods of `VerifiedGgufFile`: `open`, `index`, `duplicate_descriptor`, `artifact_sha256` and 10 more. -//! Functions: `verify_digest`, `record_stamp`. +//! VerifiedGgufFile: opens a GGUF against its expected sha256 (with a verification stamp shortcut), keeps the +//! descriptor and strict index, and serves metadata snapshots, bounded tensor streams, owned reads and tensor hashes. use super::{ Digest, File, MetadataSnapshot, Path, QWEN4EXP_BINDING_KEYS, Result, Sha256, TensorIndex, TokenizerMetadata, diff --git a/crates/model-format/src/kar/decode_record_range.rs b/crates/model-format/src/kar/decode_record_range.rs index d3c3c3c6..39c97728 100644 --- a/crates/model-format/src/kar/decode_record_range.rs +++ b/crates/model-format/src/kar/decode_record_range.rs @@ -1,5 +1,5 @@ -//! Functions: `decode_record_range`, `decode_raw`, `decode_window`, `decode_nested` and 3 more. Defines `Window`. -//! Split out of `kar` to keep its files under the line limit. +//! CPU quality-oracle decoder of a KAR tensor record: decodes a bounded element range of a RAW F32 tensor or of a +//! nested multi-level tensor, reading only the group scales, level book and bit planes that cover the range. use super::{DecodeSource, ElementRange, File, RECORD_BYTES, ScalarDecoder, read_region, u16_at, u32_at, u64_at}; diff --git a/crates/model-format/src/kar/extents/extent.rs b/crates/model-format/src/kar/extents/extent.rs index cedf1b41..b70b2f5d 100644 --- a/crates/model-format/src/kar/extents/extent.rs +++ b/crates/model-format/src/kar/extents/extent.rs @@ -1,5 +1,5 @@ -//! Methods of `Extent`: `new`, `end`. Methods of `VerifiedPart`: `reads`. -//! Functions: `extents_bytes`, `normalize_extents`, `extents_cover`, `extents_overlap` and 5 more. +//! Extent arithmetic of the serve read set: page-align and merge, cover and overlap tests, the pinned sparse-copy +//! SHA-256 over an extent list, and the exact byte ranges the serve path reads per PLE partition. use super::{ DOMAIN, Digest, EXTENT_ALIGN, Extent, HASH_CHUNK, KarError, KarNestedRecord, PLE_ROW_PLANE_BYTES, diff --git a/crates/model-format/src/kar/extents/kar_inspection.rs b/crates/model-format/src/kar/extents/kar_inspection.rs index 4cbde859..ae6b4c2c 100644 --- a/crates/model-format/src/kar/extents/kar_inspection.rs +++ b/crates/model-format/src/kar/extents/kar_inspection.rs @@ -1,5 +1,5 @@ -//! Methods of `KarInspection`: `payload_offset`, `serve_reads`, `census`. Methods of `RecordClass`: `label`. -//! Functions: `census_record`, `gib`, `pct`. +//! Read-only reports on a KAR archive directory: what the serve path reads (serve_reads), and the census that +//! classifies every record, totals the read and unread bytes and renders the text report. use std::fmt::Write as _; use super::{ diff --git a/crates/model-format/src/kar/independent_handles.rs b/crates/model-format/src/kar/independent_handles.rs index 01f429c3..25686001 100644 --- a/crates/model-format/src/kar/independent_handles.rs +++ b/crates/model-format/src/kar/independent_handles.rs @@ -1,5 +1,5 @@ -//! Methods of `KarPleRowReader`: `read_rows`. -//! Functions: `independent_handles`, `reopen_independent`, `reopen_independent`, `read_rows_parallel` and 11 more. +//! Parallel positional reads of PLE rows: independent file handles, fan-out over threads with a warm-cache probe, +//! the per-read guard that refuses an archive changed since verification, and the three reads of one row. use super::{ COLD_SKIP, COLD_SKIP_CALLS, File, KarError, KarPleRowPacket, KarPleRowReader, PLE_ROWS, VerifiedPart, WARM_ROW_NS, diff --git a/crates/model-format/src/kar/inspect_file.rs b/crates/model-format/src/kar/inspect_file.rs index 31007bfe..17bee5af 100644 --- a/crates/model-format/src/kar/inspect_file.rs +++ b/crates/model-format/src/kar/inspect_file.rs @@ -1,5 +1,5 @@ -//! Functions: `inspect_file`, `read_tables`, `check_directory_digest`. -//! Split out of `kar` to keep its files under the line limit. +//! Metadata inspection of a KAR file: parses the header, reads the name table and directory, checks their digest +//! against the header, and scans every record into the sections, sources and summary of a Parsed archive. use super::{ Digest, File, HEADER_BYTES, HashSet, KarSummary, KarTensorSource, MAX_NAMES, MAX_TENSORS, Parsed, RECORD_BYTES, diff --git a/crates/model-format/src/kar/kar_ple_profile.rs b/crates/model-format/src/kar/kar_ple_profile.rs index 31dc1562..adc6a355 100644 --- a/crates/model-format/src/kar/kar_ple_profile.rs +++ b/crates/model-format/src/kar/kar_ple_profile.rs @@ -1,5 +1,5 @@ -//! Methods of `KarPleProfile`: `new`, `with_total_rows`, `native_shard_sha256`. -//! Methods of `KarPleRowPacket`: `payload`, `partition`. +//! KarPleProfile construction and validation (unique contiguous partitions with row counts and source digests), +//! plus small accessors: row packet payload, trust labels, startup-read total, and the unlinked-file check. use super::{ File, HashSet, KarError, KarPlePartProvenance, KarPleProfile, KarPleProfileSpec, KarPleRowPacket, KarStartupRead, diff --git a/crates/model-format/src/kar/read_region.rs b/crates/model-format/src/kar/read_region.rs index 60a8ed6e..f7d8e317 100644 --- a/crates/model-format/src/kar/read_region.rs +++ b/crates/model-format/src/kar/read_region.rs @@ -1,5 +1,5 @@ -//! Methods of `SectionCrc`: `new`, `feed`. Functions: `read_region`, `u16_at`, `u32_at`, `u64_at` and 9 more. -//! Defines `SectionCrc`, `ChunkReceiver`. +//! Low-level KAR reads and integrity: bounded region reads, little-endian field readers, CRC-32, the per-section +//! SectionCrc, and the pipelined and reference SHA-256 plus CRC verification of a whole archive. use super::{CRC32_SLICES, CRC32_TABLE, Digest, File, KarError, Read, Section, Seek, SeekFrom, Sha256}; diff --git a/crates/model-format/src/kar/verified_kar_ple_artifact.rs b/crates/model-format/src/kar/verified_kar_ple_artifact.rs index 73ebfba0..faf4b0ff 100644 --- a/crates/model-format/src/kar/verified_kar_ple_artifact.rs +++ b/crates/model-format/src/kar/verified_kar_ple_artifact.rs @@ -1,5 +1,5 @@ -//! Methods of `VerifiedKarPleArtifact`: `verify`, `verify_sparse`, `verify_with`, `serve_extents` and 14 more. -//! Split out of `kar` to keep its files under the line limit. +//! VerifiedKarPleArtifact: an archive verified against its pins (full pass or sparse extents) that serves PLE row +//! reads (16-row, batched or via an owned reader) and exposes digests, extents and startup-read accounting. use super::{ ArchiveView, Extent, FanOut, File, KarError, KarImmutableSource, KarInspection, KarPlePartProvenance, diff --git a/crates/model-format/src/kar_kernel_model/decode_params_valid.rs b/crates/model-format/src/kar_kernel_model/decode_params_valid.rs index 5e166154..65de60f6 100644 --- a/crates/model-format/src/kar_kernel_model/decode_params_valid.rs +++ b/crates/model-format/src/kar_kernel_model/decode_params_valid.rs @@ -1,5 +1,5 @@ -//! Methods of `MultiplyDims`: `new`. -//! Functions: `decode_params_valid`, `level_and_count_ok`, `group_ok`, `layout_ok` and 12 more. Defines `MultiplyDims`. +//! Host model of the KAR CUDA kernels: the decode argument guard, bit-literal models of the decode, multiply and +//! SwiGLU kernels (MultiplyDims is the multiply launch shape), and the reference stager that fills a packet. use super::{ BLOCK_THREADS, BOOK_REGION_BYTES, DecodeParams, MAX_COLUMNS, MAX_LEVEL, MAX_RANGE_ELEMENTS, MAX_SWIGLU_VALUES, diff --git a/crates/model-format/src/kar_levels/expert_scratch.rs b/crates/model-format/src/kar_levels/expert_scratch.rs index 179d00c3..9be4eb84 100644 --- a/crates/model-format/src/kar_levels/expert_scratch.rs +++ b/crates/model-format/src/kar_levels/expert_scratch.rs @@ -1,5 +1,5 @@ -//! Functions: `expert_scratch`, `cpu_reference_mlp`. -//! Split out of `kar_levels` to keep its files under the line limit. +//! Device scratch size of one expert FFN (three packets, one F32 matrix and intermediates) and the CPU reference +//! of the same gate/up/SwiGLU/down pipeline that GPU smokes compare against. use super::{GpuRows, KarLevelsError, Result, STATUS_BYTES, ScratchBytes, model}; diff --git a/crates/model-format/src/kar_levels/selection.rs b/crates/model-format/src/kar_levels/selection.rs index 126a3f8c..d227c537 100644 --- a/crates/model-format/src/kar_levels/selection.rs +++ b/crates/model-format/src/kar_levels/selection.rs @@ -1,5 +1,5 @@ -//! Methods of `Selection`: `window_error`, `resident_prefix_bytes`, `window`, `rows` and 1 more. -//! Methods of `GpuWindow`: `new`, `staged_source_bytes`, `scratch`. +//! Selection methods and GPU plan sizes of KAR level selection: resident prefix bytes, element windows, row and +//! expert matrices, per-plan scratch bytes, the ScratchBudget, and the routed-expert tensor name. use super::{ ArchiveSlot, EXPERT_ROLES, GpuRows, GpuWindow, KarError, KarInspection, KarLevelSelector, KarLevelsError, diff --git a/crates/model-format/src/native_dense_plan/tests.rs b/crates/model-format/src/native_dense_plan/tests.rs index 6bf37700..f3baddc8 100644 --- a/crates/model-format/src/native_dense_plan/tests.rs +++ b/crates/model-format/src/native_dense_plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the native dense plan: weight bytes follow the Original tables, tensor eligibility by name and type, the +//! two-shard upload plan, the Original's refusal messages, and that an unquantized PLE key is skipped, not refused. use super::*; diff --git a/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs b/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs index 664a2783..cf00c50a 100644 --- a/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs +++ b/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs @@ -1,5 +1,5 @@ -//! Methods of `LoadShared`: `fill`. -//! Functions: `load_experts`, `load_experts_ranges`, `load_failure`, `carve_windows` and 4 more. +//! Parallel expert load into a destination buffer: disjoint per-layer windows carved from the caller's ranges, +//! worker threads reading chunks by positional reads, and a per-layer FNV-1a checksum; a short read is an error. use super::{ExpertLayout, FNV_SEED, LoadStats, ReadPlan, fnv1a64}; diff --git a/crates/model-format/src/pinned_arena_plan/fnv1a64.rs b/crates/model-format/src/pinned_arena_plan/fnv1a64.rs index b53e1c59..dd1b8a2a 100644 --- a/crates/model-format/src/pinned_arena_plan/fnv1a64.rs +++ b/crates/model-format/src/pinned_arena_plan/fnv1a64.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedArenaHeader`: `new`, `describes`, `encode`, `decode`. -//! Methods of `LoadStats`: `gib_per_second`, `read_gib_per_second`. +//! FNV-1a hash, the shared arena file header and its create-or-reuse admission, the pin-registration plan (env +//! cap, uniform slices, sliced registration notes, lock switch) and LoadStats throughput accessors. use std::fmt::Write as _; use super::{ diff --git a/crates/model-format/src/pinned_arena_plan/tests.rs b/crates/model-format/src/pinned_arena_plan/tests.rs index 1968e899..0784d1ad 100644 --- a/crates/model-format/src/pinned_arena_plan/tests.rs +++ b/crates/model-format/src/pinned_arena_plan/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Pins the pinned-arena plan: FNV recurrence, shared header layout and file admission, pin cap and sliced +//! registration decisions with their notes, and that the parallel load equals a serial read with layer checksums. use super::*; diff --git a/crates/model-format/src/ple_reader/file_page_source.rs b/crates/model-format/src/ple_reader/file_page_source.rs index 75edaf71..defe389f 100644 --- a/crates/model-format/src/ple_reader/file_page_source.rs +++ b/crates/model-format/src/ple_reader/file_page_source.rs @@ -1,5 +1,5 @@ -//! Methods of `PleReaderConfig`: `new`. Methods of `ReaderStats`: `percentile`. -//! Implements `PageSource for File`, `Display for PleError` and 1 more. +//! Plumbing of the PLE row reader: the File page source, error display, config and statistics helpers, the row +//! cache, read planning (cache hits and out-of-range rows resolved, the rest grouped by page), aligned buffers. use super::{ AlignedBuf, EMPTY, File, HashMap, Mutex, MutexGuard, PAGE, PageSource, PlannedRead, PleError, PleReaderConfig, diff --git a/crates/model-format/src/ple_reader/ple_reader_debug_drop.rs b/crates/model-format/src/ple_reader/ple_reader_debug_drop.rs index 50143204..c6b1982a 100644 --- a/crates/model-format/src/ple_reader/ple_reader_debug_drop.rs +++ b/crates/model-format/src/ple_reader/ple_reader_debug_drop.rs @@ -1,5 +1,5 @@ -//! Implements `Debug for PleReader`, `Drop for PleReader`. -//! Split out of `ple_reader` to keep its files under the line limit. +//! Debug output and shutdown of PleReader: Debug shows rows and worker count, and Drop closes the reader +//! (stops its workers). use super::{PleReader, fmt}; diff --git a/crates/model-format/src/qwen4exp/expected_inventory.rs b/crates/model-format/src/qwen4exp/expected_inventory.rs index bc7e0fd6..f6bdcc23 100644 --- a/crates/model-format/src/qwen4exp/expected_inventory.rs +++ b/crates/model-format/src/qwen4exp/expected_inventory.rs @@ -1,5 +1,5 @@ -//! Functions: `expert_roles`, `expected_tensor`, `expected_inventory`, `push_layer`. Defines `LayerEntry`. -//! Split out of `qwen4exp` to keep its files under the line limit. +//! The closed inventory of tensors a Qwen4Exp artifact must hold: per-layer common, full-attention, linear-attention +//! and layer-1 PLE tensors with their names, dimensions and pinned GGUF kinds, plus the routed-expert roles. use super::{ExpectedTensor, GlobalRole, LayerRole, TensorRole}; diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs index 64c84e8f..dd5b5122 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs @@ -1,5 +1,5 @@ -//! Functions: `capture_admit`, `expert_tensor_name`, `provisional_descriptor`. -//! Split out of `digest_capture` to keep its files under the line limit. +//! Admission and naming for provisional expert capture: the memory check against the source cap and headroom, +//! the GGUF name of a routed-expert tensor per role, and the checked bank descriptor built from the tensor index. use super::{ BankDescriptor, FUTURE_HEADROOM, LayerRole, ResidentExpertSourceError, ResolvedTensor, SOURCE_CAP, TensorIndex, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs index c9019177..9c43db05 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs @@ -1,5 +1,5 @@ -//! Methods of `ProvisionalExpertSource`: `empty`, `fail`, `geometry_failure`, `prepare` and 12 more. -//! Functions: `check_retained_kar`. +//! ProvisionalExpertSource: a non-readable capture of the routed-expert tensors while shard 0 is digested. Plans +//! cells under memory admission, copies observed chunks in file order, binds the verified file, checks retained KAR. use super::{ BANKS, Bank, BankDescriptor, BindingError, CapturedTensor, FUTURE_OWNERS, File, PINNED_IDENTITIES, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs index 12d524bb..eb0f116f 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs @@ -1,5 +1,5 @@ -//! Methods of `ProvisionalExpertSource`: `prepare_incremental`, `prepare_incremental_inner`, `reserve_incremental_ce... -//! Methods of `Qwen4ExpArtifact`: `open_shard0_with_expert_capture_incremental`. +//! Incremental variant of the provisional expert capture: reserves cells and tables up front and lets them grow +//! as chunks arrive; also Qwen4ExpArtifact::open_shard0_with_expert_capture_incremental. use super::{ BANKS, Bank, BankDescriptor, CapturedTensor, FUTURE_OWNERS, File, IncrementalCapture, IncrementalTensor, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs index ca6cf52f..3a05d293 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs @@ -1,5 +1,5 @@ -//! Methods of `ProvisionalExpertSource`: `test_incremental_cells`, `test_remaining_commitment`, `test_observe_inner`... -//! Split out of `digest_capture` to keep its files under the line limit. +//! Test-only constructors and probes of ProvisionalExpertSource for the incremental capture (cell setup, remaining +//! commitment, observe), so the capture tests can drive it without a full model. #[cfg(test)] use super::{ diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs index 7a80b74e..449c88d6 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `open_shard0_with_expert_capture`, `adopt_resident_expert_capture`, `check_capture... -//! Methods of `ProvisionalExpertSource`: `test_cells`, `test_bytes`, `test_discarded`, `test_memory` and 1 more. +//! Artifact-side capture: open shard 0 with expert capture, revalidate every descriptor and adopt the capture as +//! retained resident banks at the bank boundary; also IncrementalCapture chunk appends and test-only helpers. use super::{ BANKS, Bank, BindingError, CapturedTensor, Cell, FUTURE_HEADROOM, FUTURE_OWNERS, File, IncrementalCapture, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs b/crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs index 79286493..a2eaf8dc 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `load_resident_expert_source`, `check_expert_layout`, `plan_banks`, `load_banks` a... -//! Methods of `ResidentExpertBankLease`: `bank_count`, `source_bytes`, `charged_source_bytes`, `file_mapped` and 1 m... +//! Loading the resident expert source onto Qwen4ExpArtifact: layout check, bank plan, memory-admitted reads of all +//! 144 expert banks, report and publish, plus the low-RAM variant mapping banks read-only from shard 0. use super::{ BANKS, Bank, BankDescriptor, BindingError, Cell, FUTURE_HEADROOM, Qwen4ExpArtifact, Rc, ResidentExpertBank, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs b/crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs index ba3428cc..4d2f4447 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `resident_expert_bank_lease`, `resident_expert_bank_member`. -//! Methods of `ResidentExpertBankSpan`: `bytes`, `offset`, `expert`, `role` and 3 more. Functions: `bank_directory_ok`. +//! Read-only lease on the resident expert banks: Qwen4ExpArtifact hands out a ResidentExpertBankLease or member +//! after rechecking the catalog and source, and ResidentExpertBankSpan exposes one expert's bytes and role. use super::{ BANKS, BindingError, LayerRole, Qwen4ExpArtifact, Rc, ResidentExpertBank, ResidentExpertBankLease, diff --git a/crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs b/crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs index f473c1e2..14aa9090 100644 --- a/crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs @@ -1,5 +1,5 @@ -//! Methods of `ResidentExpertBank`: `note_copy`, `report`, `tensor`. -//! Implements `Display for ResidentExpertSourceError`, `Error for ResidentExpertSourceError`. +//! Support for resident expert banks: retention metadata size, error Display, checked bank descriptors and expert +//! shape/stride checks, the MemAvailable reading and admission, and the ResidentExpertBank report and tensor access. use super::{ BANKS, Bank, BankDescriptor, BindingError, Error, FUTURE_HEADROOM, File, LayerRole, Read, ResidentExpertBank, diff --git a/crates/model-format/src/qwen4exp/plan_stream_rows.rs b/crates/model-format/src/qwen4exp/plan_stream_rows.rs index aa4eb501..8a3a63f3 100644 --- a/crates/model-format/src/qwen4exp/plan_stream_rows.rs +++ b/crates/model-format/src/qwen4exp/plan_stream_rows.rs @@ -1,5 +1,5 @@ -//! Methods of `RoutedMoeSourceScope`: `retarget`, `role`, `tensor`, `validate_descriptor` and 4 more. -//! Functions: `matrix_shape`, `layer_matrix_shape`, `global_matrix_shape`, `plan_stream_rows` and 1 more. +//! Whole-matrix streaming plan: a span of more than 64 rows is admitted only as one complete, known matrix +//! shape (table of role shapes), plus the byte-span arithmetic; also the scoped routed-MoE source loan for one expert. use super::{ BindingError, GlobalRole, LayerRole, ResidentExpertBankSpan, ResolvedTensor, RoutedMoeSourceScope, TensorRole, io, diff --git a/crates/model-format/src/qwen4exp/qwen4_exp_artifact.rs b/crates/model-format/src/qwen4exp/qwen4_exp_artifact.rs index 0be42dc2..3e98a2ba 100644 --- a/crates/model-format/src/qwen4exp/qwen4_exp_artifact.rs +++ b/crates/model-format/src/qwen4exp/qwen4_exp_artifact.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `bind`, `bind_after_identity`, `topology`, `tokenizer` and 9 more. -//! Functions: `check_owner_split`, `read_profile_snapshots`. +//! Binding of the two pinned GGUF shards into a Qwen4ExpArtifact (identity, split and metadata checks), and its +//! read API: tensor lookup and streaming of rows, expert rows, whole matrices and the token embedding table. use super::{ BindingError, GlobalRole, LogicalShardView, MetadataSnapshot, PINNED_IDENTITIES, Qwen4ExpArtifact, diff --git a/crates/model-format/src/qwen4exp/routed_moe_source_opening.rs b/crates/model-format/src/qwen4exp/routed_moe_source_opening.rs index 25fa6119..ad3d9d29 100644 --- a/crates/model-format/src/qwen4exp/routed_moe_source_opening.rs +++ b/crates/model-format/src/qwen4exp/routed_moe_source_opening.rs @@ -1,5 +1,5 @@ -//! Methods of `Qwen4ExpArtifact`: `begin_routed_moe_source`. -//! Split out of `qwen4exp` to keep its files under the line limit. +//! Opens a scoped source loan (RoutedMoeSourceScope) for one routed expert of one layer, taken from shard 0 +//! with its source fence, so the expert matrices can be read under a single fence. use super::{BindingError, LayerRole, Qwen4ExpArtifact, RoutedMoeSourceScope, TensorRole}; diff --git a/crates/model-format/src/qwen4exp/validate_logical_views.rs b/crates/model-format/src/qwen4exp/validate_logical_views.rs index ee835ec5..21335667 100644 --- a/crates/model-format/src/qwen4exp/validate_logical_views.rs +++ b/crates/model-format/src/qwen4exp/validate_logical_views.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_logical_views`, `check_split_numbers`, `check_tensor_counts`. -//! Split out of `qwen4exp` to keep its files under the line limit. +//! Cross-shard validation of the two logical shard views: split numbers and tensor counts, architecture, +//! topology, tokenizer and the tensor role inventory; yields the validated binding view. use super::{ BindingError, LogicalShardView, ValidatedBindingView, gguf, topology, validate_role_inventory, validate_tokenizer, diff --git a/crates/model-format/src/qwen4exp/validate_owner_index_split.rs b/crates/model-format/src/qwen4exp/validate_owner_index_split.rs index b3ee8267..33007200 100644 --- a/crates/model-format/src/qwen4exp/validate_owner_index_split.rs +++ b/crates/model-format/src/qwen4exp/validate_owner_index_split.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_owner_index_split`, `validate_owner_metadata_split`, `required_uint`, `required_u32` and 11 ... -//! Split out of `qwen4exp` to keep its files under the line limit. +//! Pinned-profile metadata checks for the two shards: split numbers in index and metadata, required key readers, +//! the model topology read from metadata, and the special token ids of the tokenizer. use super::{BindingError, MetadataSnapshot, MetadataValue, Qwen4ExpTopology, TokenizerMetadata, VerifiedGgufFile}; diff --git a/crates/model-format/src/qwen4exp/validate_role_inventory.rs b/crates/model-format/src/qwen4exp/validate_role_inventory.rs index 612a5d52..36fa0033 100644 --- a/crates/model-format/src/qwen4exp/validate_role_inventory.rs +++ b/crates/model-format/src/qwen4exp/validate_role_inventory.rs @@ -1,5 +1,5 @@ -//! Functions: `validate_role_inventory`, `index_actual`, `resolve_tensor`, `check_tensor_geometry` and 8 more. -//! Defines `IndexedTensors`. +//! Matches the indexed tensors of both shards to the expected role inventory (shape, kind, byte size, file range, +//! no overlap) and plans exact single-row and row-tile byte spans inside a resolved tensor. use super::{ BTreeMap, BTreeSet, BindingError, ExpectedTensor, LogicalShardView, ResolvedTensor, TensorRole, expected_inventory, diff --git a/crates/model-format/src/qwen4exp/whole_dense_matrix_transport_tests.rs b/crates/model-format/src/qwen4exp/whole_dense_matrix_transport_tests.rs index cf9e58ec..c4def33f 100644 --- a/crates/model-format/src/qwen4exp/whole_dense_matrix_transport_tests.rs +++ b/crates/model-format/src/qwen4exp/whole_dense_matrix_transport_tests.rs @@ -1,5 +1,5 @@ -//! Functions: `two_byte_tensor`, `assert_partial_matrices_are_refused`, `assert_edited_tensor_is_refused`, `assert_p... -//! Split out of `qwen4exp` to keep its files under the line limit. +//! Tests that plan_stream_rows admits closed dense matrices (PLE tiles, whole matrices) with exact offsets and +//! refuses partial, expert-addressed or edited tensors. use super::*; diff --git a/crates/model-format/src/qwen4exp/whole_moe_matrix_sdet.rs b/crates/model-format/src/qwen4exp/whole_moe_matrix_sdet.rs index 85abc3f6..8a3597ad 100644 --- a/crates/model-format/src/qwen4exp/whole_moe_matrix_sdet.rs +++ b/crates/model-format/src/qwen4exp/whole_moe_matrix_sdet.rs @@ -1,5 +1,5 @@ -//! Functions: `complete_moe_spans_match_literal_legacy_tiles_and_refuse_boundary_crossing`, `check_layout`, `check_e... -//! Defines `Expected`. +//! Tests that complete MoE matrix spans equal the literal legacy 64-row tiles for every quantization layout +//! (routed and shared, gate/up and down), and that spans crossing a matrix boundary are refused. use super::*; diff --git a/crates/native-cpu-expert/src/cpu_pool.rs b/crates/native-cpu-expert/src/cpu_pool.rs index 806387cc..b647cdba 100644 --- a/crates/native-cpu-expert/src/cpu_pool.rs +++ b/crates/native-cpu-expert/src/cpu_pool.rs @@ -1,5 +1,5 @@ -//! Methods of `CpuPool`: `new`, `workers`, `charged_bytes`, `admit` and 1 more. Methods of `PendingBatch`: `join`. -//! Implements `Drop for PendingBatch`, `Drop for CpuPool`. Functions: `actor_main`, `serve`. +//! CpuPool: a single actor thread that owns the native expert pool and serves one batch of prepared jobs at a time +//! over channels; PendingBatch joins the result, and either type's drop drains or stops the native workers safely. use super::{ CompletedJob, CpuPool, Error, MAX_BATCH_BYTES, MAX_JOBS, PendingBatch, PhantomData, PreparedJob, Result, ffi, mpsc, diff --git a/crates/native-cpu-expert/src/gate_up_format.rs b/crates/native-cpu-expert/src/gate_up_format.rs index 9dcd172e..3334fd62 100644 --- a/crates/native-cpu-expert/src/gate_up_format.rs +++ b/crates/native-cpu-expert/src/gate_up_format.rs @@ -1,5 +1,5 @@ -//! Methods of `GateUpFormat`: `kind`, `matrix_bytes`, `block`. -//! Methods of `DownFormat`: `kind`, `matrix_bytes`, `block`. Implements `Drop for DirectCpuPool`. +//! Expert job data for the CPU pool: gate/up and down format codes with block sizes, input and header checks, the +//! concatenated G|U|D blob in PreparedJob, and DirectCpuPool, which computes or prefetches a group of experts directly. use super::{ BorrowedExpert, BorrowedGroup, CompletedJob, DirectCpuPool, DownFormat, Error, ExpertBytes, ExpertFormats, FF, diff --git a/crates/native-cpu-expert/src/rust_bench_frontend/cpu_blob.rs b/crates/native-cpu-expert/src/rust_bench_frontend/cpu_blob.rs index e468135c..51a5b705 100644 --- a/crates/native-cpu-expert/src/rust_bench_frontend/cpu_blob.rs +++ b/crates/native-cpu-expert/src/rust_bench_frontend/cpu_blob.rs @@ -1,5 +1,5 @@ -//! Methods of `Case`: `new`, `gate_up`, `down`. -//! Functions: `quantize_acts`, `cpu_blob`, `iq_gate_up`, `time_ggml_gu` and 15 more. Defines `Fail`, `Case`, `KqCase`. +//! CPU side of the expert benchmark on one blob: quantizes the activations, runs gate/up and down, and checks the +//! native kernels against the ggml reference for width invariance and K-quant/IQ routes, timing both for the report. use super::{ FF, H, Instant, Kind, NT, NativeActivation, NativeFormat, bench, bits, c_int, cpu, dot, elapsed, ggml_rows, diff --git a/crates/native-cpu-expert/src/rust_bench_frontend/float_reference.rs b/crates/native-cpu-expert/src/rust_bench_frontend/float_reference.rs index fdd44937..10df2ae8 100644 --- a/crates/native-cpu-expert/src/rust_bench_frontend/float_reference.rs +++ b/crates/native-cpu-expert/src/rust_bench_frontend/float_reference.rs @@ -1,5 +1,5 @@ -//! Functions: `float_reference`, `reference_shapes_ok`, `swiglu_hidden`, `project_down` and 21 more. Defines `Fail`. -//! Split out of `rust_bench_frontend` to keep its files under the line limit. +//! Reference and parity checks of the expert benchmark: an f64 float reference of one expert, the CPU-vs-GPU checks +//! of a blob (dequantizers, old kernels, embedding rows), plus the Q5_1 stored-sum case and the BF16 gather case. use super::{ CString, Error, FF, H, Kind, NT, NativeFormat, ParityGpu, Q81Owner, Result, bench, bits, cpu, cpu_blob, name, diff --git a/crates/native-cpu-expert/src/rust_bench_frontend/numerical.rs b/crates/native-cpu-expert/src/rust_bench_frontend/numerical.rs index c4a04d1c..87b6d5f0 100644 --- a/crates/native-cpu-expert/src/rust_bench_frontend/numerical.rs +++ b/crates/native-cpu-expert/src/rust_bench_frontend/numerical.rs @@ -1,5 +1,5 @@ -//! Functions: `numerical`, `zeros`, `refs`, `outputs` and 11 more. -//! Split out of `rust_bench_frontend` to keep its files under the line limit. +//! Small shared helpers of the expert benchmark: error mapping, zeroed allocations, relative and bit-level +//! comparisons, format and kernel-name lookup, the ggml and IQ4_NL row dots, and elapsed-time per iteration. use super::{CString, Error, FF, H, Instant, Kind, NAMES, NT, NativeActivation, NativeFormat, Result, bench, cpu}; diff --git a/crates/native-cpu-expert/src/rust_dequant/iq.rs b/crates/native-cpu-expert/src/rust_dequant/iq.rs index 33e98548..5d373fbe 100644 --- a/crates/native-cpu-expert/src/rust_dequant/iq.rs +++ b/crates/native-cpu-expert/src/rust_dequant/iq.rs @@ -1,5 +1,5 @@ -//! Methods of `Iq2Group`: `lane`. Methods of `Iq3Group`: `sign`, `grid`. -//! Functions: `block`, `iq2_group`, `iq2`, `iq3_group` and 6 more. Defines `Iq2Group`, `Iq3Group`. +//! Scalar block dequantizers of the IQ family (IQ1, IQ2, IQ3, IQ4_NL, IQ4_XS), used as the exact float oracle +//! of the benchmark; each follows the pinned GGML to_float code, separate from the quantized dot accumulation. use super::{h, u16at, u32at}; use crate::rust_codebooks::*; use crate::rust_ggml::Kind; diff --git a/crates/native-cpu-expert/src/rust_dequant/kquant.rs b/crates/native-cpu-expert/src/rust_dequant/kquant.rs index bd28ba9b..924f130e 100644 --- a/crates/native-cpu-expert/src/rust_dequant/kquant.rs +++ b/crates/native-cpu-expert/src/rust_dequant/kquant.rs @@ -1,5 +1,5 @@ -//! Functions: `block`, `q2k`, `q3k`, `q45k` and 4 more. -//! the K-quant and ternary block formats. +//! Scalar block dequantizers of the K-quant (Q2_K to Q6_K) and ternary (TQ1, TQ2) formats, used as the exact +//! float oracle of the benchmark; each follows the pinned GGML to_float code, apart from quantized dot accumulation. use super::{h, k4, six}; use crate::rust_ggml::Kind; pub(super) fn block(kind: Kind, x: &[u8], y: &mut [f32]) { diff --git a/crates/native-cpu-expert/src/rust_dequant/plain.rs b/crates/native-cpu-expert/src/rust_dequant/plain.rs index 40f811bb..f05eeb17 100644 --- a/crates/native-cpu-expert/src/rust_dequant/plain.rs +++ b/crates/native-cpu-expert/src/rust_dequant/plain.rs @@ -1,5 +1,5 @@ -//! Functions: `block`, `q1_zero`, `q2_zero`, `q458` and 3 more. -//! the legacy, 4/5/8-bit and FP4 block formats. +//! Scalar block dequantizers of the plain formats (F32, F16, BF16, the 1/2/4/5/8-bit legacy blocks and MXFP4/NVFP4), +//! used as the exact float oracle of the benchmark; each follows the pinned GGML to_float code. use super::{FP4, e8_half, h, u16at, u32at, ue4}; use crate::rust_ggml::Kind; pub(super) fn block(kind: Kind, x: &[u8], y: &mut [f32]) { diff --git a/crates/native-cpu-expert/src/rust_general_pool/expert_pool.rs b/crates/native-cpu-expert/src/rust_general_pool/expert_pool.rs index 02e1d39f..e12e2b4f 100644 --- a/crates/native-cpu-expert/src/rust_general_pool/expert_pool.rs +++ b/crates/native-cpu-expert/src/rust_general_pool/expert_pool.rs @@ -1,5 +1,5 @@ -//! Methods of `ExpertPool`: `new`, `assemble`, `worker_count`, `new_shared` and 14 more. -//! Split out of `rust_general_pool` to keep its files under the line limit. +//! Construction and bookkeeping of the general expert pool: CPU topology and worker count, shared state, worker threads +//! with optional core pinning, byte and timing diagnostics, the phase barrier, and whole-expert and planar run entries. use super::{ Arc, AtomicBool, AtomicI32, AtomicI64, AtomicU32, AtomicU64, Batch, Condvar, CpuTopology, Diagnostic, Duration, diff --git a/crates/native-cpu-expert/src/rust_general_pool/expert_pool_split_multi_run.rs b/crates/native-cpu-expert/src/rust_general_pool/expert_pool_split_multi_run.rs index e34b585b..34f0a040 100644 --- a/crates/native-cpu-expert/src/rust_general_pool/expert_pool_split_multi_run.rs +++ b/crates/native-cpu-expert/src/rust_general_pool/expert_pool_split_multi_run.rs @@ -1,5 +1,5 @@ -//! Methods of `ExpertPool`: `split_headers`, `split_run`, `quantize_single`, `planar_multi_header` and 8 more. -//! Implements `Drop for ExpertPool`. +//! Two-phase split runs of the general expert pool: gate/up, requantize, then down, for single- and multi-token +//! planar and native-format experts, built from validated job headers; also stops and joins the workers on drop. use super::{Error, ExpertPool, FF, H, Instant, Job, NativeFormat, NativeJobMulti, Ordering, PlanarJobMulti, Result}; diff --git a/crates/native-cpu-expert/src/rust_general_pool/job_default.rs b/crates/native-cpu-expert/src/rust_general_pool/job_default.rs index 9634293e..afa731eb 100644 --- a/crates/native-cpu-expert/src/rust_general_pool/job_default.rs +++ b/crates/native-cpu-expert/src/rust_general_pool/job_default.rs @@ -1,5 +1,5 @@ -//! Implements `Default for Job`, `Default for Split` and 3 more. -//! Functions: `alloc_with`, `cells`, `install_release_gpu_waits`, `now_ms`. +//! Defaults of the pool's raw job and scratch types, the Send/Sync claim for Shared with its safety argument, +//! and small helpers: fallible zeroed allocation, the GPU-wait release hook and a process-relative millisecond clock. use super::{ Error, FF, Instant, Job, OnceLock, PlanarActivation, RELEASE_GPU_WAITS, Result, Shared, SingleSplit, Split, diff --git a/crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs b/crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs index 3dcd0d98..17b4e064 100644 --- a/crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs +++ b/crates/native-cpu-expert/src/rust_general_pool/shared_wait_done_and_quantize_lanes.rs @@ -1,5 +1,5 @@ -//! Methods of `Shared`: `wait_done`, `quantize_lanes`. Functions: `quantize_native_lane`. -//! Split out of `rust_general_pool` to keep its files under the line limit. +//! Shared pool state helpers: a spin wait for workers to finish (with a stall report after 60 s) and the requantization +//! of every lane's gate/up output into the down-phase activation, for native and planar formats. use super::{Duration, Instant, Job, NativeFormat, Ordering, Result, Shared, Split}; diff --git a/crates/native-cpu-expert/src/rust_ggml/kind.rs b/crates/native-cpu-expert/src/rust_ggml/kind.rs index 58610978..39f89de4 100644 --- a/crates/native-cpu-expert/src/rust_ggml/kind.rs +++ b/crates/native-cpu-expert/src/rust_ggml/kind.rs @@ -1,5 +1,5 @@ -//! Methods of `Kind`: `from_original`, `original_id`, `block`, `row_bytes` and 3 more. Methods of `ActKind`: `bytes`. -//! Functions: `alloc`, `store_f16`, `bf16_bits`, `store_bf16` and 1 more. +//! Quantization kinds of the GGML-compatible CPU path: ids, block geometry and row sizes of each Kind, its activation +//! encoding, and the owned f32/f16/bf16 activation storage built from float input by Activation::quantize. use super::{ActKind, Activation, Error, Kind, Result, Storage, to_half}; diff --git a/crates/native-cpu-expert/src/rust_ggml/native_format.rs b/crates/native-cpu-expert/src/rust_ggml/native_format.rs index 0c203d04..4fa0edb2 100644 --- a/crates/native-cpu-expert/src/rust_ggml/native_format.rs +++ b/crates/native-cpu-expert/src/rust_ggml/native_format.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeFormat`: `offsets`, `new`, `validate`. -//! Functions: `iq4nl_dot`, `dot_zero`, `dot_k`, `dot` and 8 more. +//! NativeFormat (a gate/up plus down kind pair with its blob layout and shape checks) and the AVX2 row dot +//! kernels against Q8_0-style, Q8_K and float activations (IQ4_NL, Q1, Q2 too), with the dispatching dot entry point. use super::{ __m256, _mm_loadu_si128, _mm256_add_ps, _mm256_castsi256_ps, _mm256_cvtepi32_ps, _mm256_cvtepu16_epi32, diff --git a/crates/native-cpu-expert/src/rust_ggml/quantize_raw.rs b/crates/native-cpu-expert/src/rust_ggml/quantize_raw.rs index 28c10431..71bbc688 100644 --- a/crates/native-cpu-expert/src/rust_ggml/quantize_raw.rs +++ b/crates/native-cpu-expert/src/rust_ggml/quantize_raw.rs @@ -1,5 +1,5 @@ -//! Functions: `raw_align`, `quantize_half_raw`, `quantize_raw`, `dot_raw_zero` and 2 more. -//! Split out of `rust_ggml` to keep its files under the line limit. +//! Raw-buffer entry points of the GGML CPU path: quantize a float row into a caller-provided encoded activation +//! buffer, and compute a weight-row dot against an already encoded one, with the alignment and extent checks. use super::{ActKind, Kind, Q8K, Q8One, Q8Zero, bf16_bits, float_dot, iq4nl_dot, q1_dot, q2_generic, to_half}; diff --git a/crates/native-cpu-expert/src/rust_iq/iq4nl_n.rs b/crates/native-cpu-expert/src/rust_iq/iq4nl_n.rs index d0e72ada..abd6eaaf 100644 --- a/crates/native-cpu-expert/src/rust_iq/iq4nl_n.rs +++ b/crates/native-cpu-expert/src/rust_iq/iq4nl_n.rs @@ -1,5 +1,5 @@ -//! Functions: `iq4nl_values`, `iq4nl_block`, `iq4nl_alternating`, `iq4nl_n`. -//! Split out of `rust_iq` to keep its files under the line limit. +//! AVX2 IQ4_NL row kernel for one to N tokens: decodes each block's codebook values once and accumulates per token, +//! in the exact GGML single-token or the original multi-token order, so results match the reference bit for bit. use super::{ __m128i, __m256, __m256i, _mm_and_si128, _mm_loadu_si128, _mm_set1_epi8, _mm_shuffle_epi8, _mm_srli_epi16, diff --git a/crates/native-cpu-expert/src/rust_iq/tests.rs b/crates/native-cpu-expert/src/rust_iq/tests.rs index 787476c5..6188edd6 100644 --- a/crates/native-cpu-expert/src/rust_iq/tests.rs +++ b/crates/native-cpu-expert/src/rust_iq/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `rust_iq`. +//! Tests that pin the IQ kernels: IQ3 single- and multi-token summation trees are bitwise equal, the AVX2 IQ4_XS +//! multi-token kernel matches a scalar model of the original row_dot bit for bit, plus a timing bench for IQ3. use super::super::rust_quant::q8_k; use super::*; diff --git a/crates/native-cpu-expert/src/rust_iq/u16.rs b/crates/native-cpu-expert/src/rust_iq/u16.rs index e064d7b9..de895a1e 100644 --- a/crates/native-cpu-expert/src/rust_iq/u16.rs +++ b/crates/native-cpu-expert/src/rust_iq/u16.rs @@ -1,5 +1,5 @@ -//! Functions: `u16`, `u32`, `format_bytes`, `factor` and 17 more. -//! Split out of `rust_iq` to keep its files under the line limit. +//! Shared decoding of IQ-format weight blocks for the AVX2/AVX-512 IQ dot kernels: byte readers, block sizes, +//! per-format sign/grid/scale decode, and the multi-token IQ kernel specialised per format and token count. use super::{ __m256i, _mm_loadl_epi64, _mm256_add_epi32, _mm256_and_si256, _mm256_cvtepi32_ps, _mm256_cvtepu8_epi32, diff --git a/crates/native-cpu-expert/src/rust_legacy/admit.rs b/crates/native-cpu-expert/src/rust_legacy/admit.rs index 064d0472..8be3c190 100644 --- a/crates/native-cpu-expert/src/rust_legacy/admit.rs +++ b/crates/native-cpu-expert/src/rust_legacy/admit.rs @@ -1,5 +1,5 @@ -//! Functions: `admit`, `gate_up_rows`, `down_rows`, `admit_expert` and 9 more. Defines `RowSpace`. -//! Split out of `rust_legacy` to keep its files under the line limit. +//! Legacy planar expert entry points: row-range gate/up and down passes, the whole multi-token expert call, and +//! the scalar benchmark; each first admits blob size, row bounds, activation chunk count and CPU support. use super::{ ActQ, BLOB, D_CODES, D_SCALES, Error, FF, GU_SCALES, GateUpOut, H, MAX_ROWS, PlanarActivation, PlanarScratch, diff --git a/crates/native-cpu-expert/src/rust_legacy/gate_each.rs b/crates/native-cpu-expert/src/rust_legacy/gate_each.rs index 0b004880..afd06934 100644 --- a/crates/native-cpu-expert/src/rust_legacy/gate_each.rs +++ b/crates/native-cpu-expert/src/rust_legacy/gate_each.rs @@ -1,5 +1,5 @@ -//! Implements `Default for SingleScratch`. Functions: `gate_each`, `down_each`, `whole_single`. -//! Split out of `rust_legacy` to keep its files under the line limit. +//! Per-row callbacks of the legacy planar path (gate_each, down_each) that hand each result to a pool writer, plus +//! whole_single, the one-token whole-expert fallback with its scratch. use super::{ ActQ, FF, GateUpOut, MAX_ROWS, PlanarActivation, SingleScratch, act_refs, down_row, gate_up_pair, diff --git a/crates/native-cpu-expert/src/rust_legacy/set_oracle_q8_zero.rs b/crates/native-cpu-expert/src/rust_legacy/set_oracle_q8_zero.rs index 2a21a21d..a1f30b0b 100644 --- a/crates/native-cpu-expert/src/rust_legacy/set_oracle_q8_zero.rs +++ b/crates/native-cpu-expert/src/rust_legacy/set_oracle_q8_zero.rs @@ -1,5 +1,5 @@ -//! Methods of `PlanarActivation`: `quantize`, `quantize_oracle`, `quantize_native`. -//! Implements `Default for PlanarActivation`, `Default for PlanarScratch`. +//! Legacy planar CPU kernels: the oracle Q8 switch, CPUID/XCR0 admission, half-float decode, PlanarActivation +//! quantization and the AVX2/AVX-512 VNNI row dot leaves (row256, row512, oracle) over ternary expert rows. use super::{ __cpuid, __cpuid_count, __m256, __m256i, __m512, _mm_add_epi32, _mm_cvtsi128_si32, _mm_hadd_epi32, _mm_loadl_epi64, diff --git a/crates/native-cpu-expert/src/rust_legacy/tests.rs b/crates/native-cpu-expert/src/rust_legacy/tests.rs index 35f6b518..4f472d22 100644 --- a/crates/native-cpu-expert/src/rust_legacy/tests.rs +++ b/crates/native-cpu-expert/src/rust_legacy/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `rust_legacy`. +//! Pins the legacy row leaves: rows longer than the 40-block activation are refused before any load, and the +//! row256 correction is one fused multiply-add, as in the pinned C++ reference. use super::*; use std::panic::{AssertUnwindSafe, catch_unwind}; diff --git a/crates/native-cpu-expert/src/rust_native_general/group_dot_bytes_policy.rs b/crates/native-cpu-expert/src/rust_native_general/group_dot_bytes_policy.rs index 5059b0fd..98726ee0 100644 --- a/crates/native-cpu-expert/src/rust_native_general/group_dot_bytes_policy.rs +++ b/crates/native-cpu-expert/src/rust_native_general/group_dot_bytes_policy.rs @@ -1,5 +1,5 @@ -//! Functions: `typed_bytes`, `typed`, `kq_dot`, `kq256_enabled` and 16 more. -//! Defines `EncodedRow`, `DotRoute`, `DotPolicy` and 2 more. +//! Kernel routing of a native expert row against up to eight activations (K-quant 256-bit env policy, IQ multi-token, +//! IQ4_NL, generic dot) plus the explicit kq_rows, iq_rows and iq_gu_rows benchmark entries and their admission checks. use super::{Error, Kind, NativeActivation, NativeFormat, Q8K, Q8One, Q8Zero, Result, gu_multi_route}; diff --git a/crates/native-cpu-expert/src/rust_native_general/iq4nl_rows.rs b/crates/native-cpu-expert/src/rust_native_general/iq4nl_rows.rs index 8cf7ae24..f5265ac6 100644 --- a/crates/native-cpu-expert/src/rust_native_general/iq4nl_rows.rs +++ b/crates/native-cpu-expert/src/rust_native_general/iq4nl_rows.rs @@ -1,5 +1,5 @@ -//! Functions: `admit_iq4nl`, `iq4nl_rows`, `native_experts_available`, `kq_supported` and 10 more. -//! Split out of `rust_native_general` to keep its files under the line limit. +//! Explicit row-range entry points for the IQ4_NL, K-quant gate/up and Q2 formats, the kind-support predicates and +//! the shape/CPU admission each performs before dispatching to the 256-bit or 512-bit leaves. use super::{ Error, Kind, NativeActivation, NativeFormat, Q8Zero, Result, check_gu, check_rows, check_weights, kq_dot, store, diff --git a/crates/native-cpu-expert/src/rust_native_general/native_activation_quantize.rs b/crates/native-cpu-expert/src/rust_native_general/native_activation_quantize.rs index a1613e89..5e197de8 100644 --- a/crates/native-cpu-expert/src/rust_native_general/native_activation_quantize.rs +++ b/crates/native-cpu-expert/src/rust_native_general/native_activation_quantize.rs @@ -1,5 +1,5 @@ -//! Methods of `NativeActivation`: `quantize`, `encoded_bytes`, `check`, `raw`. -//! Implements `Default for NativeActivation`. +//! NativeActivation quantization and shape check, the multi-token gate/up kernel choice (gu_multi_route), and the +//! native_gu_rows / native_down_rows entry points that run an expert row by row in groups of eight tokens. use super::{ DotPolicy, DotRoute, EncodedRow, Error, Kind, NativeActivation, NativeFormat, Result, check_gu, check_rows, diff --git a/crates/native-cpu-expert/src/rust_native_general/tests.rs b/crates/native-cpu-expert/src/rust_native_general/tests.rs index 5a07b2f5..1f6b2e89 100644 --- a/crates/native-cpu-expert/src/rust_native_general/tests.rs +++ b/crates/native-cpu-expert/src/rust_native_general/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `rust_native_general`. +//! Pins the multi-token gate/up kernel choice (gu_multi_route follows native_expert.cpp) and that IQ4_XS gate/up on +//! the AVX2 tree matches the multi-token kernel row by row, re-running itself under forced AVX2 on AVX-512 CPUs. use super::super::rust_simd::{Dispatch, avx2_ok, avx512_ok}; use super::*; diff --git a/crates/native-cpu-expert/src/rust_pool/native_act_default.rs b/crates/native-cpu-expert/src/rust_pool/native_act_default.rs index d1f14617..ca6895b0 100644 --- a/crates/native-cpu-expert/src/rust_pool/native_act_default.rs +++ b/crates/native-cpu-expert/src/rust_pool/native_act_default.rs @@ -1,5 +1,5 @@ -//! Implements `Default for NativeAct`, `Default for Scratch` and 4 more. Functions: `all_finite`, `allocated`. -//! Split out of `rust_pool` to keep its files under the line limit. +//! Default values of the native pool's plain data (activation, scratch, job, split buffers), the unsafe Send/Sync +//! contract of the shared epoch state, the finite-float scan all_finite and the fallible Vec allocator. use super::{ActQ, Error, FF, Job, MAX_ROWS, NativeAct, Q8K, Result, Scratch, Shared, SingleSplit}; diff --git a/crates/native-cpu-expert/src/rust_pool/native_pool.rs b/crates/native-cpu-expert/src/rust_pool/native_pool.rs index 68d228bc..1ce0c37d 100644 --- a/crates/native-cpu-expert/src/rust_pool/native_pool.rs +++ b/crates/native-cpu-expert/src/rust_pool/native_pool.rs @@ -1,5 +1,5 @@ -//! Methods of `NativePool`: `plan`, `new`, `new_shared`, `empty_batch` and 13 more. -//! Split out of `rust_pool` to keep its files under the line limit. +//! NativePool construction and two-phase dispatch: worker planning and spawn, publishing a phase epoch, batch +//! compute with host requantization between gate/up and down, timing/trace readout, and borrowed-matrix prefetch. use super::{ Arc, AtomicBool, AtomicU32, AtomicU64, Batch, Condvar, Duration, Error, FF, H, Instant, Job, Line, MAX_JOBS, diff --git a/crates/native-cpu-expert/src/rust_pool/native_pool_group_compute.rs b/crates/native-cpu-expert/src/rust_pool/native_pool_group_compute.rs index 47297c2b..25d149e2 100644 --- a/crates/native-cpu-expert/src/rust_pool/native_pool_group_compute.rs +++ b/crates/native-cpu-expert/src/rust_pool/native_pool_group_compute.rs @@ -1,5 +1,5 @@ -//! Methods of `NativePool`: `validate_group`, `group_shape`, `check_expert`, `claim_row` and 2 more. -//! Implements `Drop for NativePool`. +//! NativePool::compute_borrowed: runs a whole borrowed expert group straight into the caller's output rows after +//! validating shapes, extents and distinct output rows, and checking outputs finite; also stops workers on Drop. use super::{Error, H, Instant, MAX_JOBS, MAX_ROWS, NativeFmt, NativePool, Ordering, Result, all_finite}; diff --git a/crates/native-cpu-expert/src/rust_weight_iq/alloc.rs b/crates/native-cpu-expert/src/rust_weight_iq/alloc.rs index 9d23e767..d8aed3b5 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/alloc.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/alloc.rs @@ -1,5 +1,5 @@ -//! Methods of `Grid`: `new`, `index_points`, `neighbor_counts`, `distances` and 4 more. -//! Functions: `alloc`, `grid_kind`, `grid`, `init` and 6 more. Defines `QuantTarget`, `CandidateStep`. +//! Codebook Grid of the IQ quantizers: builds each grid's point table and nearest-neighbour lists for off-grid codes, +//! caches one Grid per quant kind (init/free), and holds the sign-split and candidate-resolve helpers they share. use super::{ Arc, CACHE, Error, Grid, KGRID_1BIT_2048, KGRID_2BIT_256, KGRID_2BIT_512, KGRID_2BIT_1024, KGRID_256, KGRID_512, diff --git a/crates/native-cpu-expert/src/rust_weight_iq/grid.rs b/crates/native-cpu-expert/src/rust_weight_iq/grid.rs index d83c13f0..fb4496de 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/grid.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/grid.rs @@ -1,5 +1,5 @@ -//! Methods of `Grid`: `resolve_one`, `best_neighbor`. -//! Functions: `point_error`, `abs_max`, `split_levels`, `flip_levels` and 8 more. Defines `Iq1Fit`. +//! IQ1_S block quantizer (split search over sorted values, scale refit, packed scales and group heads) with the +//! Grid point resolution (resolve_one, best_neighbor) and the level helpers it shares with IQ1_M. use super::alloc::{sum_sq, weights}; use super::{Error, Grid, Pair, Result, XM, XP, nearest, pairs, put_h}; diff --git a/crates/native-cpu-expert/src/rust_weight_iq/iq1_m.rs b/crates/native-cpu-expert/src/rust_weight_iq/iq1_m.rs index a503b3fe..6b3e1781 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/iq1_m.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/iq1_m.rs @@ -1,5 +1,5 @@ -//! Functions: `iq1_m`, `half_values`, `iq1_m_block`, `iq1_m_search` and 7 more. Defines `Iq1MFit`. -//! Split out of `rust_weight_iq` to keep its files under the line limit. +//! IQ1_M quantizer: per 16-value block split search and scale refit over the shift patterns, packed super-block +//! scales, and row(), the per-kind 256-value block dispatch for the IQ1/IQ2/IQ3 quantizers. use super::alloc::{sum_sq, weights}; use super::grid::{abs_max, flip_levels, split_levels}; diff --git a/crates/native-cpu-expert/src/rust_weight_iq/iq2_xxs.rs b/crates/native-cpu-expert/src/rust_weight_iq/iq2_xxs.rs index 3e8c6036..bd3bad46 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/iq2_xxs.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/iq2_xxs.rs @@ -1,5 +1,5 @@ -//! Functions: `iq2_xxs`, `iq2_xxs_finish`, `iq2_xxs_block`, `iq2_xxs_search` and 3 more. -//! Split out of `rust_weight_iq` to keep its files under the line limit. +//! IQ2_XXS and IQ2_XS quantizers: per-block scale search over candidate scales with sign bytes, then packing of +//! the scale levels and grid indices into the super-block. use super::alloc::{Block, Trial, fix_groups, flip, search_scale, sum_sq, vmax, weights}; use super::{CandidateStep, Grid, QuantTarget, Result, nearest, put_h, qp, quant_candidates, totals}; diff --git a/crates/native-cpu-expert/src/rust_weight_iq/iq3.rs b/crates/native-cpu-expert/src/rust_weight_iq/iq3.rs index ae09a9be..3730c0f8 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq/iq3.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq/iq3.rs @@ -1,5 +1,5 @@ -//! Methods of `Iq3Out`: `store`, `finish`. Functions: `iq3`, `iq3_block`, `iq2_s`, `iq2_s_finish` and 3 more. -//! Defines `Iq3Out`, `BlockFit`. +//! IQ3 (XXS/S) and IQ2_S quantizers sharing the Iq3Out packer, plus the value/index pair sort helpers (pairs, +//! compare_pair) used by the sorted-split searches. use super::alloc::{Block, Trial, fix_groups, flip, search_scale, sum_sq, vmax, weights}; use super::{Grid, Kind, Pair, Result, nearest, put_h, qsort}; diff --git a/crates/native-cpu-expert/src/rust_weight_quant/best_fp4.rs b/crates/native-cpu-expert/src/rust_weight_quant/best_fp4.rs index 8b91d798..9a8b10cd 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/best_fp4.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/best_fp4.rs @@ -1,5 +1,5 @@ -//! Functions: `best_fp4`, `fp4`, `ternary`, `tq2_levels` and 15 more. -//! Split out of `rust_weight_quant` to keep its files under the line limit. +//! Scalar quantizers for the 4-bit float, ternary (TQ1/TQ2), Q2_K and Q3_K formats, with the packing and +//! unpacking of their 3-bit and 4-bit block scales. use super::nearest::{Qkx, Search, sum_sq}; use super::{FP4, Kind, e8_half, h, max_signed, nearest, pack_ue4, put_h, q3, qkx, qp, qx, ue4}; diff --git a/crates/native-cpu-expert/src/rust_weight_quant/iq4.rs b/crates/native-cpu-expert/src/rust_weight_quant/iq4.rs index 1015c4a0..08d3029c 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/iq4.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/iq4.rs @@ -1,5 +1,5 @@ -//! Functions: `iq4`, `iq4_search`, `iq4_block`, `iq4_sums` and 5 more. -//! Split out of `rust_weight_quant` to keep its files under the line limit. +//! IQ4_XS and IQ4_NL quantizers (nonlinear 4-bit codebook, per-block scale search, packed 6-bit scales), and the +//! row driver that quantizes every non-IQ-grid kind, leaving the grid kinds to rust_weight_iq. use super::nearest::sum_sq; use super::{ diff --git a/crates/native-cpu-expert/src/rust_weight_quant/nearest.rs b/crates/native-cpu-expert/src/rust_weight_quant/nearest.rs index 14796bcc..178450d3 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/nearest.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/nearest.rs @@ -1,5 +1,5 @@ -//! Methods of `Search`: `new`, `record`, `factors`, `steps`. `impl Qkx`. -//! Functions: `nearest`, `put_h`, `h`, `sum_sq` and 15 more. Defines `Search`, `QxStart`, `Qkx` and 2 more. +//! Shared numeric core of the K-quant searches: round-to-nearest, half-float store/load, the per-block Search +//! record, and the least-squares scale searches qx, q3 and qkx (with its parameter set) used by all quantizers. use super::{EPS, half, half_rn}; diff --git a/crates/native-cpu-expert/src/rust_weight_quant/q45k.rs b/crates/native-cpu-expert/src/rust_weight_quant/q45k.rs index 6cb1529d..c0b296d0 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/q45k.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/q45k.rs @@ -1,5 +1,5 @@ -//! Functions: `q45k`, `q45k_search`, `q45k_weights`, `q45k_scales` and 7 more. -//! Split out of `rust_weight_quant` to keep its files under the line limit. +//! Q4_K, Q5_K and Q6_K quantizers: importance-weighted per-block scale/minimum search, super-block scale packing, +//! requantization against the stored scales and bit packing; also best_iq4, the nearest IQ4 codebook level. use super::nearest::{Qkx, Search, sum_sq}; use super::{EPS, h, nearest, pack_scale4, put_h, qkx, qp, qx, unpack_scale4}; diff --git a/crates/native-cpu-expert/src/rust_weight_quant/qp.rs b/crates/native-cpu-expert/src/rust_weight_quant/qp.rs index ab80c31d..a980682a 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant/qp.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant/qp.rs @@ -1,5 +1,5 @@ -//! Functions: `qp`, `qp_scale`, `qp_error`, `qp_refine` and 15 more. Defines `Shape`. -//! Split out of `rust_weight_quant` to keep its files under the line limit. +//! Weighted scale search (qp) and the small-block formats of 32 or fewer values per block (F32/F16/BF16, Q1, Q2, Q4/Q5 +//! with and without minimum, Q8), plus the e8/ue4 scale helpers and nibble packing they use. use super::nearest::Qkx; use super::{EPS, Kind, max_signed, nearest, put_h, qkx, qx}; diff --git a/crates/obs/src/level.rs b/crates/obs/src/level.rs index ac896a16..0fc9d66d 100644 --- a/crates/obs/src/level.rs +++ b/crates/obs/src/level.rs @@ -1,5 +1,5 @@ -//! Methods of `Level`: `as_str`, `parse`. Methods of `Settings`: `from_env`. -//! Implements `From for V`, `From for V` and 8 more. +//! Log levels and settings (LELEKA_LOG_* environment), conversion of values into log fields, and the pure line +//! formatter: redaction and capping of fields, then one JSON or text event line. use std::fmt::Write as _; use super::{ diff --git a/crates/obs/src/redact/tests.rs b/crates/obs/src/redact/tests.rs index 85a0f202..9dada0b3 100644 --- a/crates/obs/src/redact/tests.rs +++ b/crates/obs/src/redact/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of `redact`. +//! Tests of log redaction: key classification, registered secrets, bearer and token shapes, query parameters, +//! that ordinary text, digests and paths pass through, and clipping at character boundaries. use super::*; diff --git a/crates/obs/src/write_stderr.rs b/crates/obs/src/write_stderr.rs index 157ce4a8..3c3a567b 100644 --- a/crates/obs/src/write_stderr.rs +++ b/crates/obs/src/write_stderr.rs @@ -1,5 +1,5 @@ -//! Methods of `FileSink`: `new`, `path`, `write_line`. -//! Functions: `write_stderr`, `request_sink`, `emit`, `emit_keyed` and 10 more. +//! Log output: writes lines to stderr or the request log file, with the rate-limited emit family (emit, emit_always, +//! record for per-request lines, level shortcuts) and request id generation. use std::io::Write as _; use super::{ diff --git a/crates/sampler-ref/src/chain/tests.rs b/crates/sampler-ref/src/chain/tests.rs index 47c36a21..0626548c 100644 --- a/crates/sampler-ref/src/chain/tests.rs +++ b/crates/sampler-ref/src/chain/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the sampler chain: top-k rules, repeat penalty on negative and positive logits, greedy and ordering ties +//! by lowest id, penalty window and history, shape checks, per-row counters, temperature zero and min-p. use super::*; diff --git a/crates/sampler-ref/src/params/tests.rs b/crates/sampler-ref/src/params/tests.rs index 43650c49..1e9c91de 100644 --- a/crates/sampler-ref/src/params/tests.rs +++ b/crates/sampler-ref/src/params/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of request sampling parameters: Python repr, the Original defaults, top-k and penalty-window normalisation, +//! engine parameters, rejection of invalid fields, config ranges, request overlay and decimal wire floats. use super::*; diff --git a/crates/sampler-ref/src/serve/tests.rs b/crates/sampler-ref/src/serve/tests.rs index 24c4d691..39474365 100644 --- a/crates/sampler-ref/src/serve/tests.rs +++ b/crates/sampler-ref/src/serve/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the serve-loop sampling helpers: request parameters, coupled drafting setup, per-window draw counters over +//! literal histories, draft history staging, window rows by confidence floor, and settling a window. use super::*; diff --git a/crates/serving-policy/src/cvec/build_tables.rs b/crates/serving-policy/src/cvec/build_tables.rs index ddd90f93..c4220efb 100644 --- a/crates/serving-policy/src/cvec/build_tables.rs +++ b/crates/serving-policy/src/cvec/build_tables.rs @@ -1,5 +1,5 @@ -//! Methods of `Sums`: `new`, `add_file`, `add_tensor`, `steer_layers`. Methods of `Steering`: `new`, `steer`. -//! Functions: `build_tables`, `layer_bounds`, `single_layer`, `tables_summary` and 4 more. Defines `Sums`, `Steering`. +//! Builds the control-vector direction and scale tables from parsed vector files (summing scaled directions per +//! layer, project or add mode, single-layer source) and parses the control-vector command-line values. use super::{Mode, Options, Tables, VectorFile, VectorTensor, strtol}; diff --git a/crates/serving-policy/src/cvec/cursor.rs b/crates/serving-policy/src/cvec/cursor.rs index e8d51788..25a9bb54 100644 --- a/crates/serving-policy/src/cvec/cursor.rs +++ b/crates/serving-policy/src/cvec/cursor.rs @@ -1,5 +1,5 @@ -//! Methods of `Cursor`: `take`, `u32`, `u64`, `string`. Implements `Default for Options`. -//! Functions: `value`, `skip_array`, `parse_gguf`, `read_header` and 4 more. Defines `Info`. +//! Reads control-vector GGUF files: the byte Cursor, header, metadata and tensor-info parsing (v2/v3, little endian), +//! f32 tensor values, the default Options, and the C strtol helper the engine parses numbers with. use super::{Cursor, Mode, Options, VectorFile, VectorTensor}; diff --git a/crates/serving-policy/src/cvec/tests.rs b/crates/serving-policy/src/cvec/tests.rs index 5cac83dd..c84f1111 100644 --- a/crates/serving-policy/src/cvec/tests.rs +++ b/crates/serving-policy/src/cvec/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of control-vector tables: add mode sums scaled files, project mode stores unit vector and norm, loader +//! error wording, command-line value parsing, and GGUF files round-tripping through the parser. use super::*; diff --git a/crates/serving-policy/src/shared/shared_defaults.rs b/crates/serving-policy/src/shared/shared_defaults.rs index 8c7ad455..f1932b34 100644 --- a/crates/serving-policy/src/shared/shared_defaults.rs +++ b/crates/serving-policy/src/shared/shared_defaults.rs @@ -1,5 +1,5 @@ -//! Methods of `SharedDefaults`: `is_empty`, `to_json`, `sampling`. -//! Functions: `float_value`, `py_repr`, `push_escaped`, `py_str_repr` and 10 more. +//! Validation and JSON form of the server-wide shared defaults (POST /settings): clean_shared_defaults with the +//! Original error texts, SharedDefaults JSON and sampling conversion, and Python repr helpers for those messages. use super::{Map, Number, RequestSampling, SharedDefaults, Value, py_float_repr}; diff --git a/crates/serving-policy/src/shared/tests.rs b/crates/serving-policy/src/shared/tests.rs index dd413943..111187e0 100644 --- a/crates/serving-policy/src/shared/tests.rs +++ b/crates/serving-policy/src/shared/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of shared defaults: unknown and empty keys, normalisation like the Original, config range checks, the +//! precedence request over shared over config, llama-server names in props, aliases, and Python repr of values. use super::*; use serde_json::json; diff --git a/crates/serving-policy/src/vision/tests.rs b/crates/serving-policy/src/vision/tests.rs index 7b1e291a..ce69842d 100644 --- a/crates/serving-policy/src/vision/tests.rs +++ b/crates/serving-policy/src/vision/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the host-side image path: M-RoPE positions for text and images, failure wording, image sources, +//! image markers after vision start only, native formats passing through, and lenient base64 decoding. use super::*; use serde_json::json; diff --git a/crates/tokenizer/src/fast/unicode_ranges.rs b/crates/tokenizer/src/fast/unicode_ranges.rs index 56327871..e304423f 100644 --- a/crates/tokenizer/src/fast/unicode_ranges.rs +++ b/crates/tokenizer/src/fast/unicode_ranges.rs @@ -1,5 +1,5 @@ -//! Methods of `Classes`: `new`, `flags_of`, `at`, `letters_end` and 4 more. -//! Methods of `PairTable`: `with_capacity`, `slot`, `insert`, `get`. +//! Character classes of the fast pre-tokenizer: Unicode letter, mark, number and space ranges flattened into an ASCII +//! table plus sorted boundaries, the pre-token splitting rules built on them, and the open-addressing merge-pair table. use super::{Class, Classes, EMPTY, HirKind, LETTER, LETTER_OR_MARK, MARK, NUMBER, PairTable, ParserBuilder, SPACE}; diff --git a/crates/tokenizer/src/gguf_bpe/tests.rs b/crates/tokenizer/src/gguf_bpe/tests.rs index b53e5ae5..b8b35e68 100644 --- a/crates/tokenizer/src/gguf_bpe/tests.rs +++ b/crates/tokenizer/src/gguf_bpe/tests.rs @@ -1,4 +1,5 @@ -//! Unit tests of this module (split out of its file; the test ids are unchanged). +//! Tests of the GGUF BPE tokenizer: GPT-2 byte map, merges in rank order, special tokens on request, byte round trip, +//! o200k-style pre-tokenizer splitting, long pieces, the UTF-8 streaming decoder and refusal of bad vocabularies. use super::*; diff --git a/crates/tokenizer/src/gguf_bpe/utf8_stream.rs b/crates/tokenizer/src/gguf_bpe/utf8_stream.rs index cfdfb5ba..ee173dfc 100644 --- a/crates/tokenizer/src/gguf_bpe/utf8_stream.rs +++ b/crates/tokenizer/src/gguf_bpe/utf8_stream.rs @@ -1,5 +1,5 @@ -//! Methods of `Utf8Stream`: `push`, `finish`. -//! Split out of `gguf_bpe` to keep its files under the line limit. +//! Streaming UTF-8 decoder for token bytes: returns the longest valid text so far (bad bytes become U+FFFD) and holds +//! back an incomplete trailing character until the next push, so a character is never split across tokens. use super::Utf8Stream;