Merge main into claude/debt-engine

This commit is contained in:
Pavlo Ratushnyi
2026-11-14 21:23:57 +01:00
1069 changed files with 2435 additions and 3690 deletions
+2 -57
View File
@@ -3,77 +3,22 @@
"violations": [],
"oversize": {},
"source": {
"allow-unused-imports:leleka-cpu-sys": 35,
"allow-unused-imports:leleka-cuda-driver": 410,
"allow-unused-imports:leleka-experimental-ref": 1,
"allow-unused-imports:leleka-harmony": 2,
"allow-unused-imports:leleka-igpu": 2,
"allow-unused-imports:leleka-model-format": 22,
"allow-unused-imports:leleka-native-cpu-expert": 75,
"allow-unused-imports:leleka-tokenizer": 3,
"dyn-trait:leleka-cpu-worker": 4,
"dyn-trait:leleka-cuda-driver": 45,
"dyn-trait:leleka-cuda-model": 3,
"dyn-trait:leleka-engine-core": 18,
"dyn-trait:leleka-engine-fake": 1,
"dyn-trait:leleka-engine-qwen35-cuda": 53,
"dyn-trait:leleka-experimental-ref": 3,
"dyn-trait:leleka-gptoss": 10,
"dyn-trait:leleka-gptoss-igpu": 3,
"dyn-trait:leleka-gptoss-npu": 3,
"dyn-trait:leleka-gpu-npu-worker": 5,
"dyn-trait:leleka-memory": 12,
"dyn-trait:leleka-model-format": 8,
"dyn-trait:leleka-tokenizer": 1,
"env-read:leleka-cpu-kernels": 1,
"env-read:leleka-cpu-worker": 2,
"env-read:leleka-cuda-driver": 2,
"env-read:leleka-cuda-model": 2,
"env-read:leleka-engine-qwen35-cuda": 1,
"env-read:leleka-gptoss": 1,
"env-read:leleka-gptoss-npu": 1,
"env-read:leleka-gpu-npu-worker": 2,
"env-read:leleka-igpu": 1,
"env-read:leleka-libc-shim": 3,
"env-read:leleka-memory": 2,
"env-read:leleka-memory-os": 1,
"env-read:leleka-model-format": 1,
"env-read:leleka-native-cpu-expert": 2,
"env-read:leleka-native-parity-bench": 1,
"env-read:leleka-npu-worker": 1,
"env-read:leleka-obs": 2,
"env-read:leleka-tokenizer": 2,
"env-read:strata-control": 3,
"glob-super-import:leleka-cuda-driver": 3,
"instant-now:leleka-cpu-worker": 9,
"glob-super-import:leleka-cuda-driver": 2,
"instant-now:leleka-cuda-driver": 25,
"instant-now:leleka-engine-qwen35-cuda": 16,
"instant-now:leleka-gptoss": 4,
"instant-now:leleka-gptoss-igpu": 5,
"instant-now:leleka-gptoss-npu": 12,
"instant-now:leleka-gpu-npu-worker": 4,
"instant-now:leleka-igpu": 1,
"instant-now:leleka-memory": 1,
"instant-now:leleka-model-format": 10,
"instant-now:leleka-native-cpu-expert": 27,
"instant-now:leleka-obs": 3,
"instant-now:strata-control": 15,
"instant-now:strata-desktop-core": 4,
"path-include:leleka-cuda-driver": 118,
"path-include:leleka-engine-qwen35-cuda": 1,
"path-include:leleka-model-format": 12,
"path-include:leleka-native-cpu-expert": 2,
"path-include:leleka-cuda-driver": 1,
"process-global:leleka-cuda-driver": 96,
"process-global:leleka-cuda-model": 10,
"process-global:leleka-engine-qwen35-cuda": 59,
"process-global:leleka-gptoss-npu": 2,
"process-global:leleka-libc-shim": 12,
"process-global:leleka-memory": 6,
"process-global:leleka-memory-os": 2,
"process-global:leleka-model-format": 8,
"process-global:leleka-native-cpu-expert": 27,
"process-global:leleka-obs": 6,
"process-global:leleka-tokenizer": 4,
"process-global:strata-control": 2
},
"mechanical_names": []
+81 -1
View File
@@ -51,10 +51,90 @@
},
"_exceptions": "Sites that must stay, so the ratchet is zero outside this list (STRA-338 stage 10). Each entry: crate, file (relative to the crate directory), ratchet (a source_patterns id), reason. The file's hits of that ratchet are not counted; an entry that excuses nothing is an error.",
"exceptions": [
{"crate": "leleka-cuda-model", "file": "src/env_switch.rs", "ratchet": "env-read", "reason": "EnvSwitch is the one reader of the operator environment in this crate: it reads one named variable on the first get() and applies a typed rule"},
{"crate": "leleka-cuda-model", "file": "src/env_switch.rs", "ratchet": "process-global", "reason": "the OnceLock inside EnvSwitch caches the switch position for the process life (an immutable operator setting; a hot path pays one atomic load)"},
{"crate": "leleka-cuda-model", "file": "src/serving_context.rs", "ratchet": "process-global", "reason": "the serving context and the resident KV window are fixed once at engine start (configure_*) and read by every kernel geometry; injecting them through every owner is the settings follow-up of S13"},
{"crate": "leleka-cpu-worker", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: it returns the operator's switches as typed values"},
{"crate": "leleka-tokenizer", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: it returns the operator's switches as typed values"},
{"crate": "leleka-gptoss-npu", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: it returns the operator's switches as typed values"},
{"crate": "leleka-gpu-npu-worker", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: it returns the operator's switches as typed values"},
{"crate": "leleka-igpu", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: it returns the operator's switches as typed values"},
{"crate": "leleka-memory", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: it returns the operator's switches as typed values"},
{"crate": "leleka-gptoss", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: it returns the operator's switches as typed values"},
{"crate": "leleka-model-format", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: it returns the operator's switches as typed values"},
{"crate": "leleka-obs", "file": "src/level.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: LELEKA_LOG* parsed once into Settings, and the request-log path"},
{"crate": "leleka-cuda-driver", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate; call sites still parse the text they ask for (typed switches: EnvSwitch in leleka-cuda-model, in progress on claude/debt-hot-low)"},
{"crate": "leleka-native-cpu-expert", "file": "src/settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate; call sites still parse the text they ask for (CPU expert pool: hot path, in progress on claude/debt-hot-low)"},
{"crate": "leleka-cpu-kernels", "file": "src/dispatch.rs", "ratchet": "env-read", "reason": "the one reader of the process environment in this crate: ISA_ENV is parsed by Isa::from_request into the selected instruction set"},
{"crate": "leleka-libc-shim", "file": "src/cuda_trace/trace_state.rs", "ratchet": "env-read", "reason": "Windows interposer (FFI): the CUDA call tracer reads its own LELEKA_BRINGUP_TRACE switches and must not depend on other crates"},
{"crate": "leleka-libc-shim", "file": "src/lib.rs", "ratchet": "env-read", "reason": "Windows interposer (FFI): the DLL search directories come from the process environment before any other crate can load"},
{"crate": "leleka-memory-os", "file": "src/heap.rs", "ratchet": "env-read", "reason": "platform adapter (glibc heap): reads its own LELEKA_MEMORY_NO_TRIM switch once"},
{"crate": "leleka-native-parity-bench", "file": "src/lib.rs", "ratchet": "env-read", "reason": "benchmark host (L4): reads the operator's STRATA_IQ_MT_MIN override to report which value it measured"},
{"crate": "leleka-npu-worker", "file": "src/main.rs", "ratchet": "env-read", "reason": "worker binary (composition root): reads LELEKA_OPENVINO_ROOT into its configuration"},
{"crate": "leleka-memory", "file": "src/settings.rs", "ratchet": "process-global", "reason": "the cached LELEKA_NO_TRIM_FILE path: an immutable operator setting read once by the crate's one environment reader"},
{"crate": "leleka-memory", "file": "src/governor.rs", "ratchet": "process-global", "reason": "Governor::global(): the process-wide memory governor installed once at engine start; its injection through the engine stack (S13/S14) belongs to the engine crate"},
{"crate": "leleka-memory", "file": "src/inventory.rs", "ratchet": "process-global", "reason": "Inventory::global(): the process-wide census of live mappings and pinned regions, filled by the loaders; injected with the governor (S13/S14)"},
{"crate": "leleka-memory", "file": "src/governor.rs", "ratchet": "dyn-trait", "reason": "port boundary: the Governor holds its MemoryPressure adapter as Arc<dyn MemoryPressure>, chosen at start-up (hexagonal.md, ports table)"},
{"crate": "leleka-memory", "file": "src/governor/operations/setup.rs", "ratchet": "dyn-trait", "reason": "port boundary: Governor::new takes the host as Arc<dyn ProcSource + Send + Sync> (the adapter is chosen by the composition root) and source() hands it back"},
{"crate": "leleka-memory", "file": "src/lock/page_locking.rs", "ratchet": "dyn-trait", "reason": "port boundary: SharedPageLocking = Arc<dyn PageLocking>, the OS adapter of mmap/mlock chosen by the composition root"},
{"crate": "leleka-memory", "file": "src/telemetry.rs", "ratchet": "dyn-trait", "reason": "port boundary: the GPU probe is a closure chosen at start-up (nvidia-smi or NVML) and owned by the sampler thread"},
{"crate": "leleka-memory", "file": "src/smi.rs", "ratchet": "dyn-trait", "reason": "port boundary: the nvidia-smi probe closure handed to the telemetry sampler (see telemetry.rs)"},
{"crate": "leleka-cpu-worker", "file": "src/engine.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: load and prefill wall-time measurement, reported in the worker's timing line"},
{"crate": "leleka-cpu-worker", "file": "src/serve.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: per-request wall-time measurement (prefill and decode), reported in the worker's timing line"},
{"crate": "leleka-cpu-worker", "file": "src/serve/decode_loop.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: per-token lap timers of the decode loop; one reading per lap, summed into the timing line"},
{"crate": "leleka-gptoss", "file": "src/forward_pass.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: per-pass lap timer inside the forward pass; one reading per lap, summed into the timing report"},
{"crate": "leleka-gptoss", "file": "src/generation.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: generation wall-time measurement for the timing report"},
{"crate": "leleka-gptoss-igpu", "file": "src/prefill_pass.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of one prefill pass, reported with the pass"},
{"crate": "leleka-gptoss-igpu", "file": "src/prefill_run.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: stage lap timers of the iGPU prefill, reported in the timing line"},
{"crate": "leleka-gptoss-npu", "file": "src/expert_pass.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: stage lap timers of the NPU expert pass, reported in the timing line"},
{"crate": "leleka-gptoss-npu", "file": "src/prefill_batch.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: stage lap timers of the NPU prefill batch, reported in the timing line"},
{"crate": "leleka-gptoss-npu", "file": "src/prefill_part_pass.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of one NPU prefill part, reported with the pass"},
{"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-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"},
{"crate": "leleka-model-format", "file": "src/kar/independent_handles.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: wall-time measurement of opening the independent file handles"},
{"crate": "leleka-model-format", "file": "src/pinned_arena_plan/expert_parallel_load.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: read and copy lap timers of the expert load, reported in the load report"},
{"crate": "leleka-model-format", "file": "src/ple_reader/read_queue.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: readings of the per-row read queue's latency window, inside the reader loop"},
{"crate": "leleka-model-format", "file": "src/ple_reader/row_reading.rs", "ratchet": "instant-now", "reason": "measurement timer, not decision logic: latency measurement of one PLE row read, inside the reader loop"},
{"crate": "leleka-obs", "file": "src/time/clock.rs", "ratchet": "instant-now", "reason": "the clock adapter itself: SystemClock, AnyClock and ManualClock are the one place that reads the monotonic clock"},
{"crate": "leleka-memory-os", "file": "src/heap.rs", "ratchet": "process-global", "reason": "platform adapter (glibc heap): the LELEKA_MEMORY_NO_TRIM switch is read once and cached"},
{"crate": "leleka-libc-shim", "file": "src/cuda_trace/trace_state.rs", "ratchet": "process-global", "reason": "Windows interposer (FFI): the CUDA call tracer is process-wide state behind C-ABI hooks that carry no context pointer"},
{"crate": "leleka-obs", "file": "src/lib.rs", "ratchet": "process-global", "reason": "the logger is process-wide: its Settings, rate limiter and request sink are built once from the environment"},
{"crate": "leleka-obs", "file": "src/write_stderr.rs", "ratchet": "process-global", "reason": "the request-log sink of the process-wide logger (see lib.rs)"},
{"crate": "leleka-tokenizer", "file": "src/lib.rs", "ratchet": "process-global", "reason": "immutable constant tables built once: the pre-tokenizer regex and the character classes"},
{"crate": "leleka-gptoss-npu", "file": "src/half.rs", "ratchet": "process-global", "reason": "immutable constant table: the half-to-float conversion table, built once"},
{"crate": "leleka-cuda-model", "file": "src/original_prefill_schedule.rs", "ratchet": "dyn-trait", "reason": "parameter struct SourceView borrows three residency queries (resident, pinned, transient) from the caller's tables; a generic parameter per closure would make the type unnameable in the callers' signatures"},
{"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/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"},
{"crate": "leleka-gptoss", "file": "src/pool.rs", "ratchet": "dyn-trait", "reason": "the worker pool runs heterogeneous closures: Box<dyn FnOnce + Send> is the type-erased job of its queue"},
{"crate": "leleka-gptoss-igpu", "file": "src/lib.rs", "ratchet": "dyn-trait", "reason": "port boundary: the memory probe closure and the PrefillAccelerator impl (trait objects by the trait's own signature)"},
{"crate": "leleka-gptoss-npu", "file": "src/lib.rs", "ratchet": "dyn-trait", "reason": "port boundary: the memory probe closure chosen by the worker binary"},
{"crate": "leleka-gptoss-npu", "file": "src/accelerator.rs", "ratchet": "dyn-trait", "reason": "PrefillAccelerator impl: the progress callback is a trait object by the trait's own signature"},
{"crate": "leleka-gpu-npu-worker", "file": "src/lib.rs", "ratchet": "dyn-trait", "reason": "port boundary: the memory probe closure, the LayerCache seam and the PrefillAccelerator impl (trait objects by the traits' own signatures)"},
{"crate": "leleka-tokenizer", "file": "src/lib.rs", "ratchet": "dyn-trait", "reason": "Result<T, Box<dyn Error>> of the public tokenizer API: the error is the std error object at the library boundary"},
{"crate": "leleka-model-format", "file": "src/gguf.rs", "ratchet": "dyn-trait", "reason": "Result<T, Box<dyn Error>> of the GGUF reader's public API: the std error object at the library boundary"},
{"crate": "leleka-model-format", "file": "src/qwen4exp.rs", "ratchet": "dyn-trait", "reason": "the artifact error wraps any std error (Box<dyn Error>) from the byte sources it reads through"},
{"crate": "leleka-model-format", "file": "src/qwen4exp/binding_topology.rs", "ratchet": "dyn-trait", "reason": "std::error::Error::source() returns &(dyn Error + 'static) by the trait's own signature"},
{"crate": "leleka-model-format", "file": "src/ple_reader.rs", "ratchet": "dyn-trait", "reason": "port boundary: the PLE reader holds its PageSource (file, direct-IO file or test double) as Arc<dyn PageSource>"},
{"crate": "leleka-model-format", "file": "src/ple_reader/row_reading.rs", "ratchet": "dyn-trait", "reason": "port boundary: PleReader::open takes the PageSource as Arc<dyn PageSource>"},
{"crate": "leleka-model-format", "file": "src/huge_pages.rs", "ratchet": "process-global", "reason": "the huge-page mode is an operator setting parsed once from LELEKA_HUGEPAGES and cached for the process"},
{"crate": "leleka-model-format", "file": "src/kar/independent_handles.rs", "ratchet": "process-global", "reason": "the identity-recheck switch is an operator setting parsed once and cached for the process"},
{"crate": "leleka-model-format", "file": "src/kar.rs", "ratchet": "process-global", "reason": "a per-instance lazily opened set of file handles (a OnceLock field of the archive), not a process global"},
{"crate": "leleka-model-format", "file": "src/kar/verified_kar_ple_artifact.rs", "ratchet": "process-global", "reason": "constructs the per-instance lazy handle cell of kar.rs, not a process global"},
{"crate": "leleka-model-format", "file": "src/verify_stamp.rs", "ratchet": "process-global", "reason": "the process-wide registry of verified-file stamps, written by the loaders and read by the identity re-checks; its injection belongs to the loader stack (S13)"},
{"crate": "strata-control", "file": "src/env_settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment of the crate: every variable is parsed here into a typed value (number, path, flag, mode)"},
{"crate": "leleka-deploy", "file": "src/env_settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment of the crate: every variable is parsed here into a typed value (path, flag, text)"},
{"crate": "strata-desktop-core", "file": "src/env_settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment of the crate and its binaries: credentials by name, the evaluation switches, the inherited child variables"},
{"crate": "leleka-gateway-text", "file": "src/env_settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment of the crate: the two prompt rendering switches"},
{"crate": "leleka-gateway-text", "file": "src/prompt/env_settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment of the crate: the two prompt rendering switches"},
{"crate": "leleka-npu-service", "file": "src/env_settings.rs", "ratchet": "env-read", "reason": "the one reader of the process environment of the crate: the profile report switch"},
{"crate": "strata-control", "file": "src/adapters/system_clock.rs", "ratchet": "instant-now", "reason": "the production Clock adapter: the one place that reads the runtime clock for the injected Clock port"},
{"crate": "strata-control", "file": "src/ports/fakes/clock.rs", "ratchet": "instant-now", "reason": "test fixture: the manual clock needs one base instant to count from and never moves by itself"},
+2 -2
View File
@@ -180,8 +180,8 @@ pub struct Summary {
pub provenance_path: PathBuf,
}
mod sidecar_and_tensor_locations;
use sidecar_and_tensor_locations::*;
mod overlay_source_reading;
use overlay_source_reading::*;
mod base_provenance;
use base_provenance::*;
mod verified_source_resolution;
+2 -2
View File
@@ -100,8 +100,8 @@ pub use tensor_encoding::*;
mod derived_verification;
#[allow(unused_imports)]
pub use derived_verification::*;
mod staging_and_raw_tensor_reads;
use staging_and_raw_tensor_reads::*;
mod preview_tensor_io;
use preview_tensor_io::*;
mod sharded_encode;
use sharded_encode::*;
mod streamed_encode;
+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
View File
@@ -127,8 +127,6 @@ pub struct EngineResidentEstimate {
mod tests;
mod geometry_sizes;
#[allow(unused_imports)]
pub use geometry_sizes::*;
mod per_token_plan;
#[allow(unused_imports)]
pub use per_token_plan::*;
+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::*;
-3
View File
@@ -166,11 +166,8 @@ pub enum SetupRopeError {
mod tests;
mod rope_scaling_type;
#[allow(unused_imports)]
pub use rope_scaling_type::*;
mod rope_table;
#[allow(unused_imports)]
pub use rope_table::*;
mod setup_rope_error_and_resolve;
#[allow(unused_imports)]
pub use setup_rope_error_and_resolve::*;
@@ -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::*;
@@ -2,7 +2,6 @@
//! yarn_is_observably_different_from_none, strata_plan_cli_output_is_reproduced_exactly,
//! kv_pool_bytes_match_the_originals_layer_cpp.
#[allow(unused_imports)]
use super::*;
#[test]
-37
View File
@@ -84,92 +84,55 @@ mod ffi {
}
mod abi_version;
#[allow(unused_imports)]
pub use abi_version::abi_version;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use abi_version::avxvnni_available;
#[allow(unused_imports)]
use abi_version::check_i4;
#[allow(unused_imports)]
use abi_version::check_i8;
#[allow(unused_imports)]
use abi_version::check_mx;
#[allow(unused_imports)]
use abi_version::check_mx_out;
#[allow(unused_imports)]
use abi_version::check_q8;
#[allow(unused_imports)]
use abi_version::check_q8r;
#[allow(unused_imports)]
use abi_version::check_quantize;
#[allow(unused_imports)]
pub use abi_version::dot_i4i8_scalar;
#[allow(unused_imports)]
pub use abi_version::dot_i8i8_scalar;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use abi_version::dot_mxfp4_q8_0_avx2;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use abi_version::dot_mxfp4_q8_0_avxvnni;
#[allow(unused_imports)]
pub use abi_version::dot_mxfp4_q8_0_scalar;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use abi_version::dot_mxfp4_q8r_avx2;
#[allow(unused_imports)]
pub use abi_version::dot_mxfp4_q8r_scalar;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use abi_version::dot_mxfp4_q8r4_avx2;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use abi_version::dot_mxfp4_q8r4_avxvnni;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use abi_version::mxfp4_q8_0_isums_avx2;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use abi_version::mxfp4_q8_0_isums_avxvnni;
#[allow(unused_imports)]
pub use abi_version::mxfp4_q8_0_isums_scalar;
mod quantize_q8_0_scalar;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::dot_i4i8_avx2;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::dot_i4i8_avxvnni;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::dot_i8i8_avx2;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::dot_i8i8_avxvnni;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::dot_q8_0_q8_0_avx2;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::dot_q8_0_q8_0_avxvnni;
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::dot_q8_0_q8_0_scalar;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::f32_to_f16_bits_f16c;
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::f32_to_f16_bits_scalar;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::q8_0_q8_0_isums_avx2;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::q8_0_q8_0_isums_avxvnni;
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::q8_0_q8_0_isums_scalar;
#[cfg(target_arch = "x86_64")]
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::quantize_q8_0_avx2;
#[allow(unused_imports)]
pub use quantize_q8_0_scalar::quantize_q8_0_scalar;
@@ -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")]
+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};
+2 -2
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
+2 -1
View File
@@ -174,6 +174,7 @@ pub fn load(options: &LoadOptions) -> Result<Loaded, String> {
let stop_tokens = stop_tokens_of(&tokenizer)?;
let mapping = Mapping::open(options.model).map_err(|e| format!("cannot map the model: {e}"))?;
if options.warm {
// Measurement timer, not decision logic (instant-now exception in architecture.json).
let started = Instant::now();
let checksum = mapping.touch_pages();
eprintln!(
@@ -225,7 +226,7 @@ impl GptOssEngine {
max_slots: 1,
active: 0,
clock: 0,
log_slots: std::env::var_os("LELEKA_SLOT_LOG").is_some(),
log_slots: crate::settings::slot_log_enabled(),
context,
accelerator: None,
accelerate_from: usize::MAX,
+1
View File
@@ -4,4 +4,5 @@
pub mod engine;
pub mod protocol;
pub mod serve;
mod settings;
pub mod slots;
+1
View File
@@ -221,6 +221,7 @@ fn generate<D: Decoder, W: Write>(
output: &Mutex<W>,
) -> Result<(), GenerationError> {
check_budget(decoder, request)?;
// Measurement timer, not decision logic (instant-now exception in architecture.json).
let started = Instant::now();
let reused = prefill_prompt(decoder, request, control, output)?;
let prompt_ms = started.elapsed().as_secs_f64() * 1000.0;
+2 -1
View File
@@ -54,6 +54,7 @@ impl Speculation {
self.abandon_pending(decoder, times);
}
self.logits = None;
// Measurement timer, not decision logic (instant-now exception in architecture.json).
let lap = Instant::now();
let mut drafts = self.drafter.draft(&self.history);
times.draft += lap.elapsed();
@@ -193,7 +194,7 @@ impl Decoding {
/// The diagnostics line of `LELEKA_SPECULATION_LOG`, when set.
pub(super) fn log(&self, decode_started: Instant) {
if std::env::var_os("LELEKA_SPECULATION_LOG").is_none() {
if !crate::settings::speculation_log_enabled() {
return;
}
if let Some(s) = self.speculation.as_ref().filter(|s| s.batches > 0) {
+11
View File
@@ -0,0 +1,11 @@
//! The only place of this crate that reads the process environment: the operator's logging switches, as typed values.
/// `LELEKA_SLOT_LOG` is set: print the slot reuse decisions.
pub(crate) fn slot_log_enabled() -> bool {
std::env::var_os("LELEKA_SLOT_LOG").is_some()
}
/// `LELEKA_SPECULATION_LOG` is set: print the speculation diagnostics line after each generation.
pub(crate) fn speculation_log_enabled() -> bool {
std::env::var_os("LELEKA_SPECULATION_LOG").is_some()
}
@@ -1,6 +1,5 @@
//! Engine failure, quit, a broken output pipe, and speculative decoding with rollback.
#[allow(unused_imports)]
use super::*;
#[test]
@@ -1,6 +1,5 @@
//! Streaming a generation to its stop token or budget, prefix reuse, cancellation by stop, and reported errors.
#[allow(unused_imports)]
use super::*;
#[test]
-1
View File
@@ -43,5 +43,4 @@ mod async_api;
any(target_os = "linux", target_os = "windows"),
target_pointer_width = "64"
)))]
#[allow(unused_imports)]
pub(crate) use async_api::page_size;
+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",
+2 -13
View File
@@ -230,32 +230,21 @@ mod tests {
}
mod stream_k_off;
#[allow(unused_imports)]
pub(crate) use stream_k_off::cc_major_ok;
#[allow(unused_imports)]
pub(crate) use stream_k_off::chunk_drain;
#[allow(unused_imports)]
#[cfg(all(test, feature = "sm86"))]
pub(crate) use stream_k_off::companion_cc;
#[cfg(feature = "sm86")]
#[allow(unused_imports)]
#[cfg(all(test, feature = "sm86"))]
pub(crate) use stream_k_off::companion_for;
#[allow(unused_imports)]
pub(crate) use stream_k_off::forced_sms;
#[cfg(not(feature = "sm86"))]
#[allow(unused_imports)]
pub(crate) use stream_k_off::image;
#[cfg(feature = "sm86")]
#[allow(unused_imports)]
pub(crate) use stream_k_off::image;
#[allow(unused_imports)]
pub(crate) use stream_k_off::latch_stream_k_policy;
#[cfg(feature = "sm86")]
#[allow(unused_imports)]
pub(crate) use stream_k_off::loadable;
#[allow(unused_imports)]
pub(crate) use stream_k_off::mmq_cc_ok;
#[cfg(feature = "sm86")]
#[allow(unused_imports)]
pub(crate) use stream_k_off::native_sm120;
#[allow(unused_imports)]
pub(crate) use stream_k_off::stream_k_off;
@@ -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")]
@@ -358,5 +358,4 @@ impl Drop for PendingOwnedCopy<'_> {
}
#[cfg(test)]
#[path = "async_owned_copy_gpu.rs"]
mod gpu;
@@ -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,
-11
View File
@@ -184,24 +184,13 @@ pub struct SBytes {
mod tests;
mod program;
#[allow(unused_imports)]
pub use program::admit;
#[allow(unused_imports)]
pub use program::admit_ptx;
#[allow(unused_imports)]
pub use program::conforms;
#[allow(unused_imports)]
pub use program::flash_bytes;
#[allow(unused_imports)]
pub use program::flash_slots;
#[allow(unused_imports)]
pub use program::poison_slots;
#[allow(unused_imports)]
use program::s_activation_bytes;
#[allow(unused_imports)]
pub use program::s_gemv_entry_index;
#[allow(unused_imports)]
pub use program::s_operand_bytes;
mod s_gemv_slots;
#[allow(unused_imports)]
pub use s_gemv_slots::s_gemv_slots;
@@ -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;
@@ -64,7 +65,5 @@ fn arg_kinds(entry: &Entry) -> Vec<&'static str> {
.collect()
}
#[path = "tests/flash_and_poison_signatures_match.rs"]
mod flash_and_poison_signatures_match;
#[path = "tests/sealed_assets_match_their_pins.rs"]
mod sealed_assets_match_their_pins;
@@ -104,6 +104,5 @@ struct Launch {
}
mod failure;
#[allow(unused_imports)]
use failure::failure;
mod closed_kernels;
@@ -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,
@@ -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};
@@ -94,23 +94,13 @@ fn closed_gpu_s_gemv_matches_the_shim_executed_golden() {
ctx.close().unwrap();
}
#[path = "closed_kernels_gpu_smoke/cases.rs"]
mod cases;
#[path = "closed_kernels_gpu_smoke/rng.rs"]
mod rng;
#[allow(unused_imports)]
use rng::download;
#[allow(unused_imports)]
use rng::f16_bits;
#[allow(unused_imports)]
use rng::f32s;
#[allow(unused_imports)]
use rng::json_bytes;
#[allow(unused_imports)]
use rng::json_f32;
#[allow(unused_imports)]
use rng::open;
#[allow(unused_imports)]
use rng::upload;
#[allow(unused_imports)]
use rng::zero_kv;
@@ -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};
+3 -3
View File
@@ -226,8 +226,9 @@ mod device {
}
}
#[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))]
#[allow(unused_imports)]
pub(crate) use device::{begin, finish, pending, resolve};
pub(crate) use device::{begin, finish, resolve};
#[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))]
pub(crate) use device::pending;
#[cfg(not(all(
feature = "cuda-driver",
@@ -263,7 +264,6 @@ pub(crate) use unsupported::{begin, finish, pending, resolve};
any(target_os = "linux", target_os = "windows"),
target_pointer_width = "64"
))]
#[path = "deferred_status_gpu.rs"]
mod gpu_tests;
#[cfg(test)]
+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"))]
+9 -9
View File
@@ -61,21 +61,21 @@ fn a_handle_to_a_slab_range_keeps_the_slab_alive_after_the_allocator_released_it
#[test]
fn the_window_and_journal_modules_never_clone_a_handle() {
let window_ops = [
include_str!("../original_verify_window_ops.rs"),
include_str!("../original_verify_window_ops/gdn_stages.rs"),
include_str!("../original_verify_window_ops/window_launches.rs"),
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.rs"),
include_str!("../original_verify/window_ops/gdn_stages.rs"),
include_str!("../original_verify/window_ops/window_launches.rs"),
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"),
];
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_window_launches.rs"),
include_str!("../qsa_verification_commit/verify_qsa_journal_capture_commit.rs"),
include_str!("../qsa_verification_commit/verify_qsa_journal_index_image.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"),
];
for source in window_ops.iter().chain(journals.iter()) {
let code = source.split("#[cfg(test)]").next().unwrap_or(source);
+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;
-23
View File
@@ -305,48 +305,25 @@ pub(crate) struct LoadedProgram {
mod tests;
mod mode;
#[allow(unused_imports)]
pub use mode::admit;
#[allow(unused_imports)]
pub use mode::admit_ptx;
#[allow(unused_imports)]
use mode::grid_x;
#[allow(unused_imports)]
use mode::grid_yz;
#[allow(unused_imports)]
pub(crate) use mode::invalid;
#[allow(unused_imports)]
pub use mode::source_is_sealed;
mod kv_shape;
#[allow(unused_imports)]
pub use kv_shape::attn_chunk_grid;
#[allow(unused_imports)]
pub use kv_shape::attn_merge_grid;
#[allow(unused_imports)]
pub use kv_shape::attn_scratch_floats;
#[allow(unused_imports)]
pub use kv_shape::check_stream_resolve;
#[allow(unused_imports)]
pub use kv_shape::copy_u4_grid;
#[allow(unused_imports)]
pub use kv_shape::cvec_grid;
#[allow(unused_imports)]
pub use kv_shape::fwht_bytes;
#[allow(unused_imports)]
pub use kv_shape::fwht_grid;
#[allow(unused_imports)]
pub use kv_shape::keyless_grid;
#[allow(unused_imports)]
pub use kv_shape::keyless_matrices_bytes;
#[allow(unused_imports)]
pub use kv_shape::q4_batch_grid;
#[allow(unused_imports)]
pub use kv_shape::q4_gather_grid;
#[allow(unused_imports)]
pub use kv_shape::q4_step_grid;
#[allow(unused_imports)]
pub use kv_shape::q8_gather_grid;
#[allow(unused_imports)]
pub use kv_shape::q8_step_grid;
#[allow(unused_imports)]
use kv_shape::stream_error_text;
@@ -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::*;
@@ -110,12 +110,9 @@ struct Call<'g, 'c> {
mod context;
mod operands;
#[allow(unused_imports)]
use context::i32_of;
#[allow(unused_imports)]
use context::i64_of;
pub use operands::*;
mod facade_launches;
mod stream_map;
#[allow(unused_imports)]
use stream_map::failure;
@@ -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,
@@ -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] = [
-10
View File
@@ -8,7 +8,6 @@
//! a fixed export ABI from the newer alias.
use crate::{DenseFormat, Error, FixedOperation, ProjectionKind, Result, RoutedFormat};
#[path = "mmq_original_enqueue_ffi.rs"]
pub(crate) mod original_enqueue;
#[derive(Clone, Copy, PartialEq, Eq)]
@@ -94,7 +93,6 @@ pub(crate) struct Q5ProjectionArguments {
storage: std::ptr::NonNull<Q5ProjectionStorage>,
}
#[path = "mmq_ffi.rs"]
mod mmq_abi;
pub(crate) use mmq_abi::{
Iq3NativeIntegerArguments, MmqArguments, MmqFixupArguments, MmqGatherShape, MmqGroupBuffers, MmqGroupRouting,
@@ -103,7 +101,6 @@ pub(crate) use mmq_abi::{
// Closed kernel-parameter storage of the Strata-prefill GDN / native dequant modules.
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))]
#[path = "gdn_native_batch_abi.rs"]
mod gdn_native_abi;
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))]
pub(crate) use gdn_native_abi::{GdnPrefillArguments, KernelArg};
@@ -143,29 +140,22 @@ struct HeadGreedyStorage {
pub(crate) struct HeadGreedyArguments(std::ptr::NonNull<HeadGreedyStorage>);
#[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))]
#[path = "original_expert_stager_ffi.rs"]
pub(crate) mod original_stager;
#[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))]
#[path = "original_file_expert_source_ffi.rs"]
pub(crate) mod original_file_source;
#[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))]
#[path = "deferred_status_ffi.rs"]
pub(crate) mod deferred_status;
mod context_handle;
#[allow(unused_imports)]
pub(crate) use context_handle::projection_available;
#[allow(unused_imports)]
use context_handle::projection_entry;
#[allow(unused_imports)]
use context_handle::projection_ptx;
#[cfg(any(
test,
all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64")
))]
#[allow(unused_imports)]
use context_handle::validate_projection_ptx;
mod api;
mod function_handle;
+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 -3
View File
@@ -1,9 +1,8 @@
//! 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
#[allow(unused_imports)]
use super::ModuleHandle;
#[cfg(all(
@@ -106,7 +106,6 @@ macro_rules! symbol {
include!("../kar_decode_levels_ffi.rs");
mod library_drop;
#[allow(unused_imports)]
use library_drop::check;
mod api;
mod device_context_memory_copies;
@@ -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,
@@ -7,7 +7,6 @@ use super::{
Q6ProjectionArguments, Q6ProjectionStorage, Q8QuantizeArguments, Q8QuantizeStorage,
};
// used only with some cargo features or targets of this crate
#[allow(unused_imports)]
use super::{Error, FunctionHandle, Result};
#[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))]
@@ -54,11 +54,7 @@ pub(crate) struct MmqGatherShape {
pub(crate) blocks: u32,
}
#[path = "mmq_ffi/owned.rs"]
mod owned;
#[allow(unused_imports)]
use owned::fastdiv;
#[path = "mmq_ffi/mmq_original_gather_arguments.rs"]
mod mmq_original_gather_arguments;
#[path = "mmq_ffi/mmq_resident_arguments.rs"]
mod mmq_resident_arguments;
@@ -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,
@@ -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};
@@ -45,22 +45,13 @@ pub(crate) struct Copy {
}
#[cfg(test)]
#[path = "original_file_expert_source_ffi/tests.rs"]
#[path = "../original_file_expert_source_ffi/tests.rs"]
mod tests;
#[path = "original_file_expert_source_ffi/check.rs"]
mod check;
#[allow(unused_imports)]
use check::check;
#[path = "original_file_expert_source_ffi/arena.rs"]
mod arena;
#[allow(unused_imports)]
pub(crate) use arena::copy_parts_record;
#[allow(unused_imports)]
pub(crate) use arena::copy_parts_to;
#[allow(unused_imports)]
pub(crate) use arena::partial_pin_cap;
#[allow(unused_imports)]
pub(crate) use arena::warm;
#[allow(unused_imports)]
pub(crate) use arena::worker_stack_bytes;
@@ -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};
@@ -62,14 +62,10 @@ pub(crate) struct ExpertFileMap {
}
#[cfg(test)]
#[path = "original_expert_stager_ffi/tests.rs"]
#[path = "../original_expert_stager_ffi/tests.rs"]
mod tests;
#[path = "original_expert_stager_ffi/check.rs"]
mod check;
#[allow(unused_imports)]
use check::check;
#[path = "original_expert_stager_ffi/api.rs"]
mod api;
#[path = "original_expert_stager_ffi/host_buffer.rs"]
mod host_buffer;
@@ -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,14 +0,0 @@
//! 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.
use super::{
Arguments, Context, DeviceBuffer, Error, FixedKernel, GrMicroValues, GrMicrobatchRead, OPS, Operation, RESERVE,
Result, SIZES, STAGES, checked_row, combine, decode, encode, ffi, qwen_ffi, ranges_layout, registered,
};
#[path = "gr_microbatch_read/gr_microbatch_read_inject.rs"]
mod gr_microbatch_read_inject;
#[path = "gr_microbatch_read/gr_microbatch_read_open.rs"]
mod gr_microbatch_read_open;
#[path = "gr_microbatch_read/micro_stage_launch.rs"]
mod micro_stage_launch;
-1
View File
@@ -3,7 +3,6 @@ use super::{Context, DeviceBuffer, Error, Result, combine, ffi};
#[cfg(test)]
use super::Driver;
// used only with some cargo features or targets of this crate
#[allow(unused_imports)]
use super::{FixedOperation, Rc};
const BYTES: [usize; 5] = [40960, 1280, 1280, 40960, 40960];
fn shape(bytes: [usize; 5]) -> Result<()> {
-1
View File
@@ -245,7 +245,6 @@ impl Drop for HeadGreedyWorkspace<'_> {
}
#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))]
#[path = "head_greedy_gpu.rs"]
mod gpu;
const ASSET_SHA: [u8; 32] = [
@@ -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::*;
@@ -74,13 +74,8 @@ mod context;
mod expert_mlp;
mod f32_bytes;
mod kar_decode_levels;
#[allow(unused_imports)]
use f32_bytes::download;
#[allow(unused_imports)]
use f32_bytes::f32_bytes;
#[allow(unused_imports)]
use f32_bytes::failure;
#[allow(unused_imports)]
use f32_bytes::finite_f32;
#[allow(unused_imports)]
use f32_bytes::release_all;

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