Merge main into claude/debt-rename; rename script rerun over what the engine and low-level branches added; baseline regenerated

This commit is contained in:
Pavlo Ratushnyi
2026-11-14 21:47:45 +01:00
1325 changed files with 4029 additions and 4194 deletions
Generated
+1
View File
@@ -1431,6 +1431,7 @@ dependencies = [
"leleka-cuda-driver",
"leleka-engine-core",
"leleka-experimental-ref",
"leleka-gateway-text",
"leleka-memory",
"leleka-memory-os",
"leleka-model-format",
-3
View File
@@ -3,8 +3,6 @@
"violations": [],
"oversize": {},
"source": {
"allow-unused-imports:leleka-engine-core": 18,
"allow-unused-imports:leleka-engine-qwen35-cuda": 166,
"dyn-trait:leleka-cuda-driver": 45,
"dyn-trait:leleka-engine-core": 18,
"dyn-trait:leleka-engine-fake": 1,
@@ -12,7 +10,6 @@
"env-read:leleka-control-plane": 3,
"env-read:leleka-engine-qwen35-cuda": 1,
"glob-super-import:leleka-cuda-driver": 2,
"glob-super-import:leleka-engine-qwen35-cuda": 70,
"instant-now:leleka-control-plane": 15,
"instant-now:leleka-cuda-driver": 25,
"instant-now:leleka-engine-host": 4,
+2 -2
View File
@@ -92,7 +92,7 @@
{"crate": "leleka-gptoss-npu", "file": "src/service_transfers.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: transfer wall-time measurement toward the NPU service"},
{"crate": "leleka-gpu-npu-worker", "file": "src/lib.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the split prefill passes, reported in the timing line"},
{"crate": "leleka-gpu-npu-worker", "file": "src/split_run.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: lap timers of the GPU and NPU legs of the split prefill"},
{"crate": "leleka-igpu", "file": "src/matrices_and_moe_plan.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the weight upload, reported at load"},
{"crate": "leleka-igpu", "file": "src/matrix_uploads.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the weight upload, reported at load"},
{"crate": "leleka-npu-service", "file": "src/engine/execution.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: lap timers of one NPU execution, summed into the profile report"},
{"crate": "leleka-model-format", "file": "src/bulk_read/for_each_chunk.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the bulk read, reported in the load report"},
{"crate": "leleka-model-format", "file": "src/huge_pages.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of the huge-page allocation probe, reported in the load report"},
@@ -111,7 +111,7 @@
{"crate": "leleka-experimental-ref", "file": "src/remote_experts.rs", "ratchet": "dyn-trait", "reason": "parameter struct Candidates borrows the primary's residency test from the caller's table; generic parameters would leak into every caller's signature"},
{"crate": "leleka-cpu-worker", "file": "src/engine.rs", "ratchet": "dyn-trait", "reason": "port boundary: the engine holds the prefill accelerator (iGPU, NPU or split) as Box<dyn PrefillAccelerator + Send>, chosen by the worker binary"},
{"crate": "leleka-cpu-worker", "file": "src/serve.rs", "ratchet": "dyn-trait", "reason": "dyn-compatible worker trait: the progress callback of a trait method must be a trait object"},
{"crate": "leleka-gptoss", "file": "src/state_and_cache.rs", "ratchet": "dyn-trait", "reason": "port boundary: PrefillAccelerator and LayerCache are the accelerator seams, chosen by the worker binary; their methods take the progress callback as a trait object"},
{"crate": "leleka-gptoss", "file": "src/decode_state.rs", "ratchet": "dyn-trait", "reason": "port boundary: PrefillAccelerator and LayerCache are the accelerator seams, chosen by the worker binary; their methods take the progress callback as a trait object"},
{"crate": "leleka-gptoss", "file": "src/model.rs", "ratchet": "dyn-trait", "reason": "port boundary: the model's weights read through Arc<dyn ModelBytes> (file, memory map or test bytes), chosen when the model is loaded"},
{"crate": "leleka-gptoss", "file": "src/tensor_loading.rs", "ratchet": "dyn-trait", "reason": "port boundary: the model's weights read through Arc<dyn ModelBytes> (file, memory map or test bytes), chosen when the model is loaded"},
{"crate": "leleka-gptoss", "file": "src/weights.rs", "ratchet": "dyn-trait", "reason": "port boundary: the model's weights read through Arc<dyn ModelBytes> (file, memory map or test bytes), chosen when the model is loaded"},
+2 -1
View File
@@ -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::*;
+2 -1
View File
@@ -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::*;
+2 -1
View File
@@ -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::*;
+2 -2
View File
@@ -169,5 +169,5 @@ mod rope_scaling_type;
pub use rope_scaling_type::*;
mod rope_table;
pub use rope_table::*;
mod setup_rope_error_and_resolve;
pub use setup_rope_error_and_resolve::*;
mod setup_rope_resolution;
pub use setup_rope_resolution::*;
@@ -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,
+2 -1
View File
@@ -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::*;
@@ -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};
@@ -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")]
@@ -1,4 +1,5 @@
//! Attention score and weighted-sum kernels, SwiGLU, f16 conversion and the softmax exponent sum.
//! The argument-checked scalar and AVX2 entry points of the attention score and weighted-sum kernels; the elementwise
//! kernels (SwiGLU, f16 conversion, the softmax exponent sum) are the second clause of the same checked surface.
use super::{AttnShape, KernelError, ScoreSpec, check_scores, check_swiglu, check_weighted_sum, simd};
#[cfg(target_arch="x86_64")]
+5 -5
View File
@@ -127,22 +127,22 @@ pub use portable::{
dot_q8_0_q8_0_scalar, dot_q8_0_q8r_multi_scalar, f32_to_f16_bits_scalar, mxfp4_q8_0_isums_scalar,
q8_0_q8_0_isums_scalar, quantize_q8_0_scalar,
};
mod avx2_and_avxvnni;
mod x86_dot_kernels;
#[cfg(target_arch = "x86_64")]
pub use avx2_and_avxvnni::{
pub use x86_dot_kernels::{
dot_i4i8_avx2, dot_i4i8_avxvnni, dot_i8i8_avx2, dot_i8i8_avxvnni, dot_mxfp4_q8_0_avx2, dot_mxfp4_q8_0_avxvnni,
dot_mxfp4_q8r_avx2, dot_mxfp4_q8r4_avx2, dot_mxfp4_q8r4_avxvnni, dot_mxfp4_q8r4_multi_avx2,
dot_mxfp4_q8r4_multi_avxvnni, dot_q8_0_q8_0_avx2, dot_q8_0_q8_0_avxvnni, dot_q8_0_q8r_multi_avx2,
dot_q8_0_q8r_multi_avxvnni, f32_to_f16_bits_f16c, mxfp4_q8_0_isums_avx2, mxfp4_q8_0_isums_avxvnni,
q8_0_q8_0_isums_avx2, q8_0_q8_0_isums_avxvnni, quantize_q8_0_avx2,
};
mod attention_and_elementwise;
mod checked_attention_kernels;
#[cfg(target_arch = "x86_64")]
pub use attention_and_elementwise::{
pub use checked_attention_kernels::{
attn_scores_avx2, attn_scores_f16_avx2, attn_weighted_sum_avx2, attn_weighted_sum_f16_avx2, exp_shift_sum_avx2,
f16_to_f32_slice_avx2, f32_to_f16_slice_avx2, swiglu_oai_avx2,
};
pub use attention_and_elementwise::{
pub use checked_attention_kernels::{
attn_scores_f16_scalar, attn_scores_scalar, attn_weighted_sum_f16_scalar, attn_weighted_sum_scalar,
exp_shift_sum_scalar, f16_to_f32_slice_scalar, f32_to_f16_slice_scalar, swiglu_oai_scalar,
};
+2 -2
View File
@@ -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};
+9 -9
View File
@@ -79,19 +79,19 @@ pub const MULTI_MAX: usize = 16;
#[cfg(target_arch = "x86_64")]
pub mod x86;
mod scalar_dots_and_formats;
use scalar_dots_and_formats::load_u16;
pub use scalar_dots_and_formats::{
mod scalar_dot_kernels;
use scalar_dot_kernels::load_u16;
pub use scalar_dot_kernels::{
attn_scores_f16_scalar, attn_scores_scalar, attn_weighted_sum_f16_scalar, attn_weighted_sum_scalar,
dot_mxfp4_q8_0_scalar, dot_mxfp4_q8r_scalar, dot_q8_q8r_scalar, mxfp4_q8_0_isums_scalar,
};
pub use scalar_dots_and_formats::{dot_i4i8_scalar, dot_i8i8_scalar};
pub use scalar_dots_and_formats::{e8m0_half, f16_to_f32, f32_to_f16};
mod scalar_tiles_and_elementwise;
use scalar_tiles_and_elementwise::dot_i4i8_tail;
pub use scalar_tiles_and_elementwise::{
pub use scalar_dot_kernels::{dot_i4i8_scalar, dot_i8i8_scalar};
pub use scalar_dot_kernels::{e8m0_half, f16_to_f32, f32_to_f16};
mod scalar_tile_kernels;
use scalar_tile_kernels::dot_i4i8_tail;
pub use scalar_tile_kernels::{
dot_mxfp4_q8r_multi_scalar, dot_q8_0_q8r_multi_scalar, exp_shift_sum_scalar, f16_to_f32_slice_scalar,
f32_to_f16_slice_scalar, mxfp4_q8r_tile_scalar, prepare_act, q8_q8r_tile_scalar, quantize_q8_0_scalar,
swiglu_oai_scalar,
};
pub use scalar_tiles_and_elementwise::{dot_q8_0_q8_0_scalar, q8_0_q8_0_isums_scalar};
pub use scalar_tile_kernels::{dot_q8_0_q8_0_scalar, q8_0_q8_0_isums_scalar};
+12 -12
View File
@@ -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
@@ -181,30 +181,30 @@ multi_kernel!(
|xb, ib| (_mm256_loadu_si256(xb.add(2) as *const __m256i), half_to_f32(xb))
);
mod reductions_and_int_dots;
use reductions_and_int_dots::{block_p32_avx2, mx_table, mx_values};
use reductions_and_int_dots::{cvt_f32_f16, half_to_f32, hsum_epi32, hsum_ps};
pub use reductions_and_int_dots::{dot_i4i8_avx2, dot_i4i8_avxvnni, dot_i8i8_avx2, dot_i8i8_avxvnni};
mod int_dot_kernels;
use int_dot_kernels::{block_p32_avx2, mx_table, mx_values};
use int_dot_kernels::{cvt_f32_f16, half_to_f32, hsum_epi32, hsum_ps};
pub use int_dot_kernels::{dot_i4i8_avx2, dot_i4i8_avxvnni, dot_i8i8_avx2, dot_i8i8_avxvnni};
mod mxfp4_q8_dots;
use mxfp4_q8_dots::{block_p32_vnni, mxfp4_scaled_fma};
pub use mxfp4_q8_dots::{
dot_mxfp4_q8_0_avx2, dot_mxfp4_q8_0_avxvnni, dot_mxfp4_q8r_avx2, dot_mxfp4_q8r4_avx2, mxfp4_q8_0_isums_avx2,
mxfp4_q8_0_isums_avxvnni,
};
mod q8_dots_and_mxfp4_tiles;
pub use q8_dots_and_mxfp4_tiles::dot_mxfp4_q8r4_avxvnni;
pub use q8_dots_and_mxfp4_tiles::{
mod q8_0_dot_kernels;
pub use q8_0_dot_kernels::dot_mxfp4_q8r4_avxvnni;
pub use q8_0_dot_kernels::{
dot_q8_0_q8_0_avx2, dot_q8_0_q8_0_avxvnni, q8_0_q8_0_isums_avx2, q8_0_q8_0_isums_avxvnni,
};
use q8_dots_and_mxfp4_tiles::{mx_table_biased, mxfp4_tile_avx2};
use q8_0_dot_kernels::{mx_table_biased, mxfp4_tile_avx2};
mod tile_kernels;
use tile_kernels::{decoded_p32_avx2, decoded_p32_vnni, multi_reduce};
pub use tile_kernels::{mxfp4_q8r_tile_avx2, mxfp4_q8r_tile_avxvnni, q8_q8r_tile_avx2, q8_q8r_tile_avxvnni};
mod attention_kernels;
use attention_kernels::{WeightedSum, attn_dot_f16, exp256, load_f16x8};
pub use attention_kernels::{attn_scores_avx2, attn_weighted_sum_avx2};
mod f16_attention_and_elementwise;
pub use f16_attention_and_elementwise::{
mod f16_attention_kernels;
pub use f16_attention_kernels::{
attn_scores_f16_avx2, attn_weighted_sum_f16_avx2, exp_shift_sum_avx2, f16_to_f32_slice_avx2, f32_to_f16_f16c,
f32_to_f16_slice_avx2, swiglu_oai_avx2,
};
+2 -2
View File
@@ -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",
@@ -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")]
@@ -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,
@@ -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,
@@ -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};
@@ -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;
@@ -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,
@@ -8,5 +8,5 @@ use super::{
poison_slots, s_gemv_entry_index, s_gemv_slots, s_operand_bytes,
};
mod closed_kernels_flash_and_s_gemv;
mod closed_kernels_launches;
mod closed_kernels_open_admit_run;
@@ -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,
@@ -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,
@@ -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};
@@ -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};
+2 -2
View File
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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};
+2 -2
View File
@@ -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"))]
+2 -2
View File
@@ -67,12 +67,12 @@ fn the_window_and_journal_modules_never_clone_a_handle() {
include_str!("../original_verify/window_ops/qsa_prelude_ops.rs"),
include_str!("../original_verify/window_ops/side_qsa_branches.rs"),
include_str!("../original_verify/window_ops/side_shared_expert.rs"),
include_str!("../original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs"),
include_str!("../original_verify/window_ops/window_step_recording.rs"),
];
let journals = [
include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_fused_step.rs"),
include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_journal_ladder_logits_scan.rs"),
include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_journal_stage_and_commit.rs"),
include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_journal_commit.rs"),
include_str!("../original_verify/original_verify_gdn_journal/verify_gdn_journal_window_launches.rs"),
include_str!("../qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs"),
include_str!("../qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_index_image.rs"),
+2 -1
View File
@@ -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;
@@ -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,
+2 -2
View File
@@ -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,
+2 -1
View File
@@ -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::*;
@@ -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,
@@ -10,5 +10,5 @@ use super::{
};
mod attention_launch;
mod program_and_kv_pool_launches;
mod kv_pool_launches;
mod stream_keyless_cvec_launches;
@@ -7,8 +7,8 @@ use super::{
experimental, i32_of, i64_of, invalid, stream_runs,
};
mod q8_gather_and_resolve_launch;
use q8_gather_and_resolve_launch::Q8Gather;
mod q8_gather_launch;
use q8_gather_launch::Q8Gather;
impl<'c> Experimental<'c> {
/// `kv_gather_q8_step`: dequantize the selected cells into fp16 scratch (K and V of the same pool).
@@ -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,
+2 -2
View File
@@ -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] = [
+2 -2
View File
@@ -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",
+2 -2
View File
@@ -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
@@ -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,
@@ -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};
@@ -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};
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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};
@@ -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,
+2 -2
View File
@@ -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};
@@ -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};
@@ -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};
@@ -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,
@@ -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};
@@ -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};
@@ -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]
@@ -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};
@@ -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};
+2 -1
View File
@@ -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() {
@@ -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::*;
@@ -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::*;
@@ -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,
@@ -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,
@@ -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};
@@ -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,
+2 -2
View File
@@ -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,
+6 -6
View File
@@ -257,12 +257,12 @@ mod original_serve_access;
mod bringup_trace_enabled;
use bringup_trace_enabled::combine;
use bringup_trace_enabled::valid_size;
mod projection_grids_and_bounds;
use projection_grids_and_bounds::projection_ranges;
use projection_grids_and_bounds::projection_shape;
mod projection_geometry;
use projection_geometry::projection_ranges;
use projection_geometry::projection_shape;
#[cfg(test)]
use projection_grids_and_bounds::q4_k_native_indices_fit;
use projection_grids_and_bounds::q5_k_shape;
use projection_geometry::q4_k_native_indices_fit;
use projection_geometry::q5_k_shape;
mod q6_k_shape;
use q6_k_shape::matvec_allocations;
use q6_k_shape::matvec_shape;
@@ -272,7 +272,7 @@ mod context;
mod context_gate_up_projection_admission;
mod context_matvec_k_quant_projections;
mod context_projection_kernel_slots;
mod context_q8_1_and_gate_up_projection;
mod context_routed_gate_up_projection;
mod context_unload_close_destroy;
mod device_buffer;
@@ -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,
@@ -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,
@@ -8,5 +8,5 @@ use super::{
};
mod mapped_expert_bank_close;
mod mapped_expert_bank_pcie_and_triplets;
mod mapped_expert_bank_pieces_and_pinning;
mod mapped_expert_bank_device_copies;
mod mapped_expert_bank_host_views;
@@ -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};
@@ -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,
@@ -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,
+2 -2
View File
@@ -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};
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
@@ -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,
@@ -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,
@@ -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};
@@ -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};
+2 -2
View File
@@ -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};
@@ -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,

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