diff --git a/architecture-baseline.json b/architecture-baseline.json index ff15990f..6a329052 100644 --- a/architecture-baseline.json +++ b/architecture-baseline.json @@ -3,80 +3,25 @@ "violations": [], "oversize": {}, "source": { - "allow-unused-imports:leleka-cpu-sys": 35, - "allow-unused-imports:leleka-cuda-driver": 410, "allow-unused-imports:leleka-engine-core": 18, "allow-unused-imports:leleka-engine-qwen35-cuda": 166, - "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:leleka-control-plane": 3, - "glob-super-import:leleka-cuda-driver": 3, + "glob-super-import:leleka-cuda-driver": 2, "glob-super-import:leleka-engine-qwen35-cuda": 70, - "instant-now:leleka-cpu-worker": 9, "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:leleka-control-plane": 15, "instant-now:leleka-engine-host": 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:leleka-control-plane": 2 }, "mechanical_names": [] diff --git a/architecture.json b/architecture.json index 821ff769..38f7b13c 100644 --- a/architecture.json +++ b/architecture.json @@ -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, 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 (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, 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, 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 (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 (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 (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 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> 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> 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) 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"}, + {"crate": "leleka-model-format", "file": "src/ple_reader/row_reading.rs", "ratchet": "dyn-trait", "reason": "port boundary: PleReader::open takes the PageSource as Arc"}, + {"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": "leleka-control-plane", "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": "leleka-engine-host", "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": "leleka-control-plane", "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": "leleka-control-plane", "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"}, diff --git a/crates/context/src/memory_plan.rs b/crates/context/src/memory_plan.rs index 83a53a14..0f9886a5 100644 --- a/crates/context/src/memory_plan.rs +++ b/crates/context/src/memory_plan.rs @@ -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::*; diff --git a/crates/context/src/rope_scaling.rs b/crates/context/src/rope_scaling.rs index 0a7df1d6..f0366622 100644 --- a/crates/context/src/rope_scaling.rs +++ b/crates/context/src/rope_scaling.rs @@ -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::*; diff --git a/crates/context/tests/rope_plan_golden/every_fixture_case_has.rs b/crates/context/tests/rope_plan_golden/every_fixture_case_has.rs index 7289bbc4..72b8a55b 100644 --- a/crates/context/tests/rope_plan_golden/every_fixture_case_has.rs +++ b/crates/context/tests/rope_plan_golden/every_fixture_case_has.rs @@ -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] diff --git a/crates/cpu-sys/src/c_reference.rs b/crates/cpu-sys/src/c_reference.rs index 89a61669..a60830da 100644 --- a/crates/cpu-sys/src/c_reference.rs +++ b/crates/cpu-sys/src/c_reference.rs @@ -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; diff --git a/crates/cpu-worker/src/engine.rs b/crates/cpu-worker/src/engine.rs index 3199bb6d..b1a27764 100644 --- a/crates/cpu-worker/src/engine.rs +++ b/crates/cpu-worker/src/engine.rs @@ -174,6 +174,7 @@ pub fn load(options: &LoadOptions) -> Result { 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, diff --git a/crates/cpu-worker/src/lib.rs b/crates/cpu-worker/src/lib.rs index 5355152a..ddcde844 100644 --- a/crates/cpu-worker/src/lib.rs +++ b/crates/cpu-worker/src/lib.rs @@ -4,4 +4,5 @@ pub mod engine; pub mod protocol; pub mod serve; +mod settings; pub mod slots; diff --git a/crates/cpu-worker/src/serve.rs b/crates/cpu-worker/src/serve.rs index c0fe86bf..eecaba70 100644 --- a/crates/cpu-worker/src/serve.rs +++ b/crates/cpu-worker/src/serve.rs @@ -221,6 +221,7 @@ fn generate( output: &Mutex, ) -> 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; diff --git a/crates/cpu-worker/src/serve/decode_loop.rs b/crates/cpu-worker/src/serve/decode_loop.rs index 2c043a73..6b03a6ff 100644 --- a/crates/cpu-worker/src/serve/decode_loop.rs +++ b/crates/cpu-worker/src/serve/decode_loop.rs @@ -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) { diff --git a/crates/cpu-worker/src/settings.rs b/crates/cpu-worker/src/settings.rs new file mode 100644 index 00000000..3a615a28 --- /dev/null +++ b/crates/cpu-worker/src/settings.rs @@ -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() +} diff --git a/crates/cpu-worker/tests/serve_loop/failure_shutdown_and_speculation.rs b/crates/cpu-worker/tests/serve_loop/failure_shutdown_and_speculation.rs index dd0291ad..05315ec6 100644 --- a/crates/cpu-worker/tests/serve_loop/failure_shutdown_and_speculation.rs +++ b/crates/cpu-worker/tests/serve_loop/failure_shutdown_and_speculation.rs @@ -1,6 +1,5 @@ //! Engine failure, quit, a broken output pipe, and speculative decoding with rollback. -#[allow(unused_imports)] use super::*; #[test] diff --git a/crates/cpu-worker/tests/serve_loop/generation_and_cancellation.rs b/crates/cpu-worker/tests/serve_loop/generation_and_cancellation.rs index c2c33373..df182d89 100644 --- a/crates/cpu-worker/tests/serve_loop/generation_and_cancellation.rs +++ b/crates/cpu-worker/tests/serve_loop/generation_and_cancellation.rs @@ -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] diff --git a/crates/cuda-driver/src/api.rs b/crates/cuda-driver/src/api.rs index 5906f9da..4f3b107b 100644 --- a/crates/cuda-driver/src/api.rs +++ b/crates/cuda-driver/src/api.rs @@ -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; diff --git a/crates/cuda-driver/src/arch_ptx.rs b/crates/cuda-driver/src/arch_ptx.rs index e90392e5..261cdd5d 100644 --- a/crates/cuda-driver/src/arch_ptx.rs +++ b/crates/cuda-driver/src/arch_ptx.rs @@ -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; diff --git a/crates/cuda-driver/src/async_owned_copy.rs b/crates/cuda-driver/src/async_owned_copy.rs index 6daaba8e..cb00da82 100644 --- a/crates/cuda-driver/src/async_owned_copy.rs +++ b/crates/cuda-driver/src/async_owned_copy.rs @@ -358,5 +358,4 @@ impl Drop for PendingOwnedCopy<'_> { } #[cfg(test)] -#[path = "async_owned_copy_gpu.rs"] mod gpu; diff --git a/crates/cuda-driver/src/async_owned_copy_gpu.rs b/crates/cuda-driver/src/async_owned_copy/gpu.rs similarity index 100% rename from crates/cuda-driver/src/async_owned_copy_gpu.rs rename to crates/cuda-driver/src/async_owned_copy/gpu.rs diff --git a/crates/cuda-driver/src/closed_kernels.rs b/crates/cuda-driver/src/closed_kernels.rs index 0a824211..4a3cb6a6 100644 --- a/crates/cuda-driver/src/closed_kernels.rs +++ b/crates/cuda-driver/src/closed_kernels.rs @@ -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; diff --git a/crates/cuda-driver/src/closed_kernels/tests.rs b/crates/cuda-driver/src/closed_kernels/tests.rs index aca93871..1d0fe45c 100644 --- a/crates/cuda-driver/src/closed_kernels/tests.rs +++ b/crates/cuda-driver/src/closed_kernels/tests.rs @@ -64,7 +64,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; diff --git a/crates/cuda-driver/src/closed_kernels_gpu.rs b/crates/cuda-driver/src/closed_kernels_gpu.rs index ff02fdc0..7970a2f3 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu.rs @@ -104,6 +104,5 @@ struct Launch { } mod failure; -#[allow(unused_imports)] use failure::failure; mod closed_kernels; diff --git a/crates/cuda-driver/src/closed_kernels_gpu_smoke.rs b/crates/cuda-driver/src/closed_kernels_gpu_smoke.rs index 07d64e9b..c2e2f126 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu_smoke.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu_smoke.rs @@ -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; diff --git a/crates/cuda-driver/src/deferred_status.rs b/crates/cuda-driver/src/deferred_status.rs index dacfece1..77aaa998 100644 --- a/crates/cuda-driver/src/deferred_status.rs +++ b/crates/cuda-driver/src/deferred_status.rs @@ -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)] diff --git a/crates/cuda-driver/src/deferred_status_gpu.rs b/crates/cuda-driver/src/deferred_status/gpu_tests.rs similarity index 100% rename from crates/cuda-driver/src/deferred_status_gpu.rs rename to crates/cuda-driver/src/deferred_status/gpu_tests.rs diff --git a/crates/cuda-driver/src/device_ref/tests.rs b/crates/cuda-driver/src/device_ref/tests.rs index 7a0db691..ae448b6b 100644 --- a/crates/cuda-driver/src/device_ref/tests.rs +++ b/crates/cuda-driver/src/device_ref/tests.rs @@ -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); diff --git a/crates/cuda-driver/src/experimental.rs b/crates/cuda-driver/src/experimental.rs index 54d15c85..ad512e83 100644 --- a/crates/cuda-driver/src/experimental.rs +++ b/crates/cuda-driver/src/experimental.rs @@ -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; diff --git a/crates/cuda-driver/src/experimental_gpu.rs b/crates/cuda-driver/src/experimental_gpu.rs index 338956d4..7477b19a 100644 --- a/crates/cuda-driver/src/experimental_gpu.rs +++ b/crates/cuda-driver/src/experimental_gpu.rs @@ -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; diff --git a/crates/cuda-driver/src/ffi.rs b/crates/cuda-driver/src/ffi.rs index 96172ec2..3659592e 100644 --- a/crates/cuda-driver/src/ffi.rs +++ b/crates/cuda-driver/src/ffi.rs @@ -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, } -#[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); #[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; diff --git a/crates/cuda-driver/src/ffi/context_handle.rs b/crates/cuda-driver/src/ffi/context_handle.rs index 13d66dfe..125070f1 100644 --- a/crates/cuda-driver/src/ffi/context_handle.rs +++ b/crates/cuda-driver/src/ffi/context_handle.rs @@ -3,7 +3,6 @@ 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( diff --git a/crates/cuda-driver/src/deferred_status_ffi.rs b/crates/cuda-driver/src/ffi/deferred_status.rs similarity index 100% rename from crates/cuda-driver/src/deferred_status_ffi.rs rename to crates/cuda-driver/src/ffi/deferred_status.rs diff --git a/crates/cuda-driver/src/ffi/driver_backed.rs b/crates/cuda-driver/src/ffi/driver_backed.rs index 28c14400..42faff97 100644 --- a/crates/cuda-driver/src/ffi/driver_backed.rs +++ b/crates/cuda-driver/src/ffi/driver_backed.rs @@ -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; diff --git a/crates/cuda-driver/src/ffi/function_handle.rs b/crates/cuda-driver/src/ffi/function_handle.rs index 86fd93f6..c8914d49 100644 --- a/crates/cuda-driver/src/ffi/function_handle.rs +++ b/crates/cuda-driver/src/ffi/function_handle.rs @@ -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"))] diff --git a/crates/cuda-driver/src/gdn_native_batch_abi.rs b/crates/cuda-driver/src/ffi/gdn_native_abi.rs similarity index 100% rename from crates/cuda-driver/src/gdn_native_batch_abi.rs rename to crates/cuda-driver/src/ffi/gdn_native_abi.rs diff --git a/crates/cuda-driver/src/mmq_ffi.rs b/crates/cuda-driver/src/ffi/mmq_abi.rs similarity index 92% rename from crates/cuda-driver/src/mmq_ffi.rs rename to crates/cuda-driver/src/ffi/mmq_abi.rs index 2dbe9709..e10ca03b 100644 --- a/crates/cuda-driver/src/mmq_ffi.rs +++ b/crates/cuda-driver/src/ffi/mmq_abi.rs @@ -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; diff --git a/crates/cuda-driver/src/mmq_ffi/mmq_original_gather_arguments.rs b/crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs similarity index 100% rename from crates/cuda-driver/src/mmq_ffi/mmq_original_gather_arguments.rs rename to crates/cuda-driver/src/ffi/mmq_abi/mmq_original_gather_arguments.rs diff --git a/crates/cuda-driver/src/mmq_ffi/mmq_resident_arguments.rs b/crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs similarity index 100% rename from crates/cuda-driver/src/mmq_ffi/mmq_resident_arguments.rs rename to crates/cuda-driver/src/ffi/mmq_abi/mmq_resident_arguments.rs diff --git a/crates/cuda-driver/src/mmq_ffi/owned.rs b/crates/cuda-driver/src/ffi/mmq_abi/owned.rs similarity index 100% rename from crates/cuda-driver/src/mmq_ffi/owned.rs rename to crates/cuda-driver/src/ffi/mmq_abi/owned.rs diff --git a/crates/cuda-driver/src/mmq_original_enqueue_ffi.rs b/crates/cuda-driver/src/ffi/original_enqueue.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_enqueue_ffi.rs rename to crates/cuda-driver/src/ffi/original_enqueue.rs diff --git a/crates/cuda-driver/src/original_file_expert_source_ffi.rs b/crates/cuda-driver/src/ffi/original_file_source.rs similarity index 82% rename from crates/cuda-driver/src/original_file_expert_source_ffi.rs rename to crates/cuda-driver/src/ffi/original_file_source.rs index c934caf3..457a0783 100644 --- a/crates/cuda-driver/src/original_file_expert_source_ffi.rs +++ b/crates/cuda-driver/src/ffi/original_file_source.rs @@ -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; diff --git a/crates/cuda-driver/src/original_file_expert_source_ffi/arena.rs b/crates/cuda-driver/src/ffi/original_file_source/arena.rs similarity index 100% rename from crates/cuda-driver/src/original_file_expert_source_ffi/arena.rs rename to crates/cuda-driver/src/ffi/original_file_source/arena.rs diff --git a/crates/cuda-driver/src/original_file_expert_source_ffi/check.rs b/crates/cuda-driver/src/ffi/original_file_source/check.rs similarity index 100% rename from crates/cuda-driver/src/original_file_expert_source_ffi/check.rs rename to crates/cuda-driver/src/ffi/original_file_source/check.rs diff --git a/crates/cuda-driver/src/original_expert_stager_ffi.rs b/crates/cuda-driver/src/ffi/original_stager.rs similarity index 91% rename from crates/cuda-driver/src/original_expert_stager_ffi.rs rename to crates/cuda-driver/src/ffi/original_stager.rs index afec2221..740ad5e8 100644 --- a/crates/cuda-driver/src/original_expert_stager_ffi.rs +++ b/crates/cuda-driver/src/ffi/original_stager.rs @@ -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; diff --git a/crates/cuda-driver/src/original_expert_stager_ffi/api.rs b/crates/cuda-driver/src/ffi/original_stager/api.rs similarity index 100% rename from crates/cuda-driver/src/original_expert_stager_ffi/api.rs rename to crates/cuda-driver/src/ffi/original_stager/api.rs diff --git a/crates/cuda-driver/src/original_expert_stager_ffi/check.rs b/crates/cuda-driver/src/ffi/original_stager/check.rs similarity index 100% rename from crates/cuda-driver/src/original_expert_stager_ffi/check.rs rename to crates/cuda-driver/src/ffi/original_stager/check.rs diff --git a/crates/cuda-driver/src/original_expert_stager_ffi/host_buffer.rs b/crates/cuda-driver/src/ffi/original_stager/host_buffer.rs similarity index 100% rename from crates/cuda-driver/src/original_expert_stager_ffi/host_buffer.rs rename to crates/cuda-driver/src/ffi/original_stager/host_buffer.rs diff --git a/crates/cuda-driver/src/gr_read_guard.rs b/crates/cuda-driver/src/gr_read_guard.rs index 7089d0f2..ec566a29 100644 --- a/crates/cuda-driver/src/gr_read_guard.rs +++ b/crates/cuda-driver/src/gr_read_guard.rs @@ -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<()> { diff --git a/crates/cuda-driver/src/head_greedy.rs b/crates/cuda-driver/src/head_greedy.rs index 816abadd..7d2c1386 100644 --- a/crates/cuda-driver/src/head_greedy.rs +++ b/crates/cuda-driver/src/head_greedy.rs @@ -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] = [ diff --git a/crates/cuda-driver/src/head_greedy_gpu.rs b/crates/cuda-driver/src/head_greedy/gpu.rs similarity index 100% rename from crates/cuda-driver/src/head_greedy_gpu.rs rename to crates/cuda-driver/src/head_greedy/gpu.rs diff --git a/crates/cuda-driver/src/kar_decode_levels_gpu.rs b/crates/cuda-driver/src/kar_decode_levels_gpu.rs index cf676f28..736dbd66 100644 --- a/crates/cuda-driver/src/kar_decode_levels_gpu.rs +++ b/crates/cuda-driver/src/kar_decode_levels_gpu.rs @@ -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; diff --git a/crates/cuda-driver/src/kv_stream_gpu.rs b/crates/cuda-driver/src/kv_stream_gpu.rs index 687fe049..d2fbf464 100644 --- a/crates/cuda-driver/src/kv_stream_gpu.rs +++ b/crates/cuda-driver/src/kv_stream_gpu.rs @@ -45,21 +45,12 @@ fn streamed_attention_equals_fully_resident_attention_with_a_20480_cell_window() mod append_proof; mod rng; mod stream_proof; -#[allow(unused_imports)] use rng::addr; -#[allow(unused_imports)] use rng::f32s; -#[allow(unused_imports)] use rng::group; -#[allow(unused_imports)] use rng::i32s; -#[allow(unused_imports)] use rng::launch; -#[allow(unused_imports)] use rng::load; -#[allow(unused_imports)] use rng::selection; -#[allow(unused_imports)] use rng::upload; -#[allow(unused_imports)] use rng::{ImageLayout, KernelShape, expected}; diff --git a/crates/cuda-driver/src/lib.rs b/crates/cuda-driver/src/lib.rs index 242c1989..f2f5364c 100644 --- a/crates/cuda-driver/src/lib.rs +++ b/crates/cuda-driver/src/lib.rs @@ -91,7 +91,6 @@ pub mod experimental; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] pub mod experimental_gpu; #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "experimental_gpu_smoke.rs"] mod experimental_gpu_smoke; pub mod kar_decode_levels; // Closed driver programs for native_flash_attn / s_gemv_legacy / device_poison: pins, entry signatures, argument slots @@ -100,12 +99,10 @@ pub mod closed_kernels; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] pub mod closed_kernels_gpu; #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "closed_kernels_gpu_smoke.rs"] mod closed_kernels_gpu_smoke; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] pub mod kar_decode_levels_gpu; #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "kar_decode_levels_gpu_smoke.rs"] mod kar_decode_levels_gpu_smoke; #[cfg(all( test, @@ -117,15 +114,12 @@ mod original_prefill_schedule_crosscheck; // Model-free stress of DMA out of a read-only file mapping that is page-locked in place, under working-set trimming // (Windows only). #[cfg(all(test, windows, feature = "cuda-driver", target_pointer_width = "64"))] -#[path = "mapped_file_dma_stress_gpu.rs"] mod mapped_file_dma_stress_gpu; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "moe_down_pack_gpu.rs"] mod moe_down_pack_gpu_tests; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "ple_value_full_gpu.rs"] mod ple_value_full_gpu_tests; #[cfg(test)] @@ -155,7 +149,6 @@ pub mod q6_layer_preview; any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" ))] -#[path = "grouped_down_columns_gpu.rs"] mod grouped_down_columns_gpu; // Separately selected asynchronous owned-copy adapter; original APIs unchanged. @@ -166,7 +159,6 @@ mod async_owned_copy; mod refill_batch_copy; pub use refill_batch_copy::RefillBatchReport; #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "refill_batch_copy_gpu.rs"] mod refill_batch_copy_gpu; // Explicit experimental resident pipeline; original entry bodies remain unchanged. @@ -263,27 +255,18 @@ mod original_serve_assets; mod original_serve_access; mod bringup_trace_enabled; -#[allow(unused_imports)] use bringup_trace_enabled::combine; -#[allow(unused_imports)] use bringup_trace_enabled::valid_size; mod projection_grids_and_bounds; -#[allow(unused_imports)] use projection_grids_and_bounds::projection_ranges; -#[allow(unused_imports)] use projection_grids_and_bounds::projection_shape; -#[allow(unused_imports)] +#[cfg(test)] use projection_grids_and_bounds::q4_k_native_indices_fit; -#[allow(unused_imports)] use projection_grids_and_bounds::q5_k_shape; mod q6_k_shape; -#[allow(unused_imports)] use q6_k_shape::matvec_allocations; -#[allow(unused_imports)] use q6_k_shape::matvec_shape; -#[allow(unused_imports)] use q6_k_shape::q6_k_shape; -#[allow(unused_imports)] use q6_k_shape::vector_shape; mod context; mod context_gate_up_projection_admission; @@ -294,24 +277,14 @@ mod context_unload_close_destroy; mod device_buffer; mod prompt_sync_trace_types; -#[allow(unused_imports)] use prompt_sync_trace_types::FixedKernel; -#[allow(unused_imports)] use prompt_sync_trace_types::FixedOperation; -#[allow(unused_imports)] use prompt_sync_trace_types::FixedPairKernels; -#[allow(unused_imports)] pub(crate) use prompt_sync_trace_types::PoisonCell; -#[allow(unused_imports)] use prompt_sync_trace_types::ProjectionKernels; -#[allow(unused_imports)] use prompt_sync_trace_types::ProjectionShape; mod q5_kshape_types; -#[allow(unused_imports)] use q5_kshape_types::CurrentGuard; -#[allow(unused_imports)] use q5_kshape_types::MatvecShape; -#[allow(unused_imports)] use q5_kshape_types::Q5KShape; -#[allow(unused_imports)] use q5_kshape_types::Q6KShape; diff --git a/crates/cuda-driver/src/mapped_expert_bank.rs b/crates/cuda-driver/src/mapped_expert_bank.rs index 4f11f6e7..27308fd8 100644 --- a/crates/cuda-driver/src/mapped_expert_bank.rs +++ b/crates/cuda-driver/src/mapped_expert_bank.rs @@ -81,9 +81,7 @@ mod locked_tests { } mod context; -#[allow(unused_imports)] pub(crate) use context::aligned_copy_enabled; mod mapped_expert_bank_drop; mod mapped_expert_bank_operations; -#[allow(unused_imports)] use mapped_expert_bank_drop::range_covered; diff --git a/crates/cuda-driver/src/mmq.rs b/crates/cuda-driver/src/mmq.rs index d4a6adbd..cb1c063e 100644 --- a/crates/cuda-driver/src/mmq.rs +++ b/crates/cuda-driver/src/mmq.rs @@ -5,7 +5,6 @@ use super::{ }; #[cfg(test)] use super::{DenseFormat, Device, Driver, qwen_ffi}; -#[path = "mmq_original_weights.rs"] mod original_weights; use std::ffi::CStr; @@ -100,10 +99,8 @@ pub struct MmqWeights<'ctx> { } #[cfg(all(test, target_os = "linux", target_arch = "x86_64"))] -#[path = "mmq_numeric_gpu.rs"] mod mmq_numeric_gpu_tests; -#[path = "mmq_resident.rs"] pub(crate) mod resident; #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] @@ -294,22 +291,16 @@ mod triplet_upload_installed { } #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "owned_gate_up_upload_gpu.rs"] mod owned_gate_up_upload_gpu; mod asset; mod tile; -#[allow(unused_imports)] pub(crate) use asset::asset; -#[allow(unused_imports)] use asset::bytes; -#[allow(unused_imports)] use asset::finite_f32; -#[allow(unused_imports)] use asset::original_formats_asset; mod context; mod release_triplet; -#[allow(unused_imports)] use release_triplet::release_triplet; mod experiment_load; mod mmq_experiment; diff --git a/crates/cuda-driver/src/mmq_numeric_gpu.rs b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests.rs similarity index 94% rename from crates/cuda-driver/src/mmq_numeric_gpu.rs rename to crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests.rs index b6e7d8f2..3946533a 100644 --- a/crates/cuda-driver/src/mmq_numeric_gpu.rs +++ b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests.rs @@ -169,23 +169,10 @@ fn original_first_mmq_adaptive_and_distinct_fixed_profiles_exact() { ); } -#[path = "mmq_numeric_gpu/digest.rs"] mod digest; -#[allow(unused_imports)] use digest::compare; -#[allow(unused_imports)] -use digest::digest; -#[allow(unused_imports)] use digest::field; -#[allow(unused_imports)] use digest::finite; -#[allow(unused_imports)] -use digest::hex; -#[allow(unused_imports)] use digest::integer; -#[allow(unused_imports)] -use digest::read_regular; -#[path = "mmq_numeric_gpu/format_cases.rs"] mod format_cases; -#[allow(unused_imports)] use format_cases::cases; diff --git a/crates/cuda-driver/src/mmq_numeric_gpu/digest.rs b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs similarity index 100% rename from crates/cuda-driver/src/mmq_numeric_gpu/digest.rs rename to crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/digest.rs diff --git a/crates/cuda-driver/src/mmq_numeric_gpu/format_cases.rs b/crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs similarity index 100% rename from crates/cuda-driver/src/mmq_numeric_gpu/format_cases.rs rename to crates/cuda-driver/src/mmq/mmq_numeric_gpu_tests/format_cases.rs diff --git a/crates/cuda-driver/src/mmq_original_weights.rs b/crates/cuda-driver/src/mmq/original_weights.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_weights.rs rename to crates/cuda-driver/src/mmq/original_weights.rs diff --git a/crates/cuda-driver/src/owned_gate_up_upload_gpu.rs b/crates/cuda-driver/src/mmq/owned_gate_up_upload_gpu.rs similarity index 100% rename from crates/cuda-driver/src/owned_gate_up_upload_gpu.rs rename to crates/cuda-driver/src/mmq/owned_gate_up_upload_gpu.rs diff --git a/crates/cuda-driver/src/mmq_resident.rs b/crates/cuda-driver/src/mmq/resident.rs similarity index 90% rename from crates/cuda-driver/src/mmq_resident.rs rename to crates/cuda-driver/src/mmq/resident.rs index c66b6d4f..cdf8eeb5 100644 --- a/crates/cuda-driver/src/mmq_resident.rs +++ b/crates/cuda-driver/src/mmq/resident.rs @@ -6,13 +6,9 @@ use super::{ }; #[cfg(test)] use super::{Device, DownColumns, Driver, MmqRequest, finite_f32, qwen_ffi}; -#[path = "mmq_native_activation.rs"] pub(crate) mod native_activation; -#[path = "mmq_native_down.rs"] mod native_down; -#[path = "iq3_native_integer_mma.rs"] pub(crate) mod native_integer; -#[path = "mmq_original_group.rs"] pub(crate) mod original_group; const INPUT: usize = 0; const CHUNK: usize = 1; @@ -76,20 +72,14 @@ pub struct FiniteMmqOutput<'lease, 'ctx> { } #[cfg(all(test, target_os = "linux", target_arch = "x86_64"))] -#[path = "mmq_resident_gpu.rs"] mod mmq_resident_gpu_tests; #[cfg(all(test, target_os = "linux", target_arch = "x86_64"))] -#[path = "mmq_native_resident_gpu.rs"] mod mmq_native_resident_gpu_tests; -#[path = "mmq_resident/asset.rs"] mod asset; -#[allow(unused_imports)] pub(crate) use asset::asset; -#[allow(unused_imports)] use asset::commands; -#[path = "mmq_resident/mmq_workspace_drop.rs"] mod mmq_workspace_drop; /// The workspace slots of one projection: the packed activation and the output. #[derive(Clone, Copy)] @@ -97,5 +87,4 @@ struct ProjectionSlots { packed: usize, out: usize, } -#[path = "mmq_resident/mmq_workspace.rs"] mod mmq_workspace; diff --git a/crates/cuda-driver/src/mmq_resident/asset.rs b/crates/cuda-driver/src/mmq/resident/asset.rs similarity index 98% rename from crates/cuda-driver/src/mmq_resident/asset.rs rename to crates/cuda-driver/src/mmq/resident/asset.rs index 48b2fac1..69a8d950 100644 --- a/crates/cuda-driver/src/mmq_resident/asset.rs +++ b/crates/cuda-driver/src/mmq/resident/asset.rs @@ -5,7 +5,7 @@ use super::{Context, Error, MmqWorkspace, QueuedCommand, Result, combine, origin // PTX is supplied only by ROOT's pinned GPU-hidden compiler. No placeholder artifact. pub(crate) fn asset() -> Result<&'static [u8]> { - let b = include_bytes!("../mmq_resident_helpers.ptx"); + let b = include_bytes!("../../mmq_resident_helpers.ptx"); if b.last() != Some(&0) || !b[..b.len() - 1].is_ascii() || b[..b.len() - 1].contains(&0) { return Err(Error::InvalidDriverValue("MMQ resident artifact")); } diff --git a/crates/cuda-driver/src/mmq_native_resident_gpu.rs b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests.rs similarity index 96% rename from crates/cuda-driver/src/mmq_native_resident_gpu.rs rename to crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests.rs index d9e4337d..0d4622b6 100644 --- a/crates/cuda-driver/src/mmq_native_resident_gpu.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests.rs @@ -303,33 +303,16 @@ fn actual_expert215_native_resident_gu_and_same_source_down_diagnostic() { ); } -#[path = "mmq_native_resident_gpu/digest.rs"] mod digest; -#[allow(unused_imports)] use digest::associate; -#[allow(unused_imports)] use digest::digest; -#[allow(unused_imports)] use digest::download; -#[allow(unused_imports)] use digest::fixture; -#[allow(unused_imports)] use digest::floats; -#[allow(unused_imports)] -use digest::half_bits; -#[allow(unused_imports)] use digest::measure; -#[allow(unused_imports)] -use digest::ordered; -#[allow(unused_imports)] use digest::prefix; -#[allow(unused_imports)] use digest::read; -#[allow(unused_imports)] use digest::upload; -#[allow(unused_imports)] use digest::write_file; -#[path = "mmq_native_resident_gpu/native_hidden_q8.rs"] mod native_hidden_q8; -#[allow(unused_imports)] use native_hidden_q8::native_hidden_q8; diff --git a/crates/cuda-driver/src/mmq_native_resident_gpu/digest.rs b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs similarity index 100% rename from crates/cuda-driver/src/mmq_native_resident_gpu/digest.rs rename to crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/digest.rs diff --git a/crates/cuda-driver/src/mmq_native_resident_gpu/native_hidden_q8.rs b/crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs similarity index 100% rename from crates/cuda-driver/src/mmq_native_resident_gpu/native_hidden_q8.rs rename to crates/cuda-driver/src/mmq/resident/mmq_native_resident_gpu_tests/native_hidden_q8.rs diff --git a/crates/cuda-driver/src/mmq_resident_gpu.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests.rs similarity index 83% rename from crates/cuda-driver/src/mmq_resident_gpu.rs rename to crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests.rs index 78a86425..47413b31 100644 --- a/crates/cuda-driver/src/mmq_resident_gpu.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests.rs @@ -95,57 +95,26 @@ fn queued_finite_chain_and_bulk_down_packets_exact() { ); } -#[path = "mmq_resident_gpu/owner_proof.rs"] mod owner_proof; -#[allow(unused_imports)] use owner_proof::*; -#[path = "mmq_resident_gpu/queued_proof.rs"] mod queued_proof; -#[allow(unused_imports)] use queued_proof::*; -#[path = "mmq_resident_gpu/digest.rs"] mod digest; -#[allow(unused_imports)] use digest::compare; -#[allow(unused_imports)] -use digest::digest; -#[allow(unused_imports)] use digest::download; -#[allow(unused_imports)] use digest::encoded; -#[allow(unused_imports)] -use digest::field; -#[allow(unused_imports)] use digest::file; -#[allow(unused_imports)] use digest::finite; -#[allow(unused_imports)] use digest::floats; -#[allow(unused_imports)] -use digest::hex; -#[allow(unused_imports)] use digest::integer; -#[allow(unused_imports)] use digest::raw_format; -#[allow(unused_imports)] -use digest::read_regular; -#[allow(unused_imports)] use digest::same; -#[allow(unused_imports)] use digest::upload; -#[path = "mmq_resident_gpu/native_owner.rs"] mod native_owner; -#[allow(unused_imports)] use native_owner::direct; -#[allow(unused_imports)] use native_owner::gather; -#[allow(unused_imports)] use native_owner::native_owner; -#[path = "mmq_resident_gpu/resident_chain.rs"] mod resident_chain; -#[allow(unused_imports)] use resident_chain::chain; -#[allow(unused_imports)] use resident_chain::witness; -#[path = "mmq_resident_gpu/live_packet_alias_drop.rs"] mod live_packet_alias_drop; diff --git a/crates/cuda-driver/src/mmq_resident_gpu/digest.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident_gpu/digest.rs rename to crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/digest.rs diff --git a/crates/cuda-driver/src/mmq_resident_gpu/live_packet_alias_drop.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident_gpu/live_packet_alias_drop.rs rename to crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/live_packet_alias_drop.rs diff --git a/crates/cuda-driver/src/mmq_resident_gpu/native_owner.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident_gpu/native_owner.rs rename to crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/native_owner.rs diff --git a/crates/cuda-driver/src/mmq_resident_gpu/owner_proof.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/owner_proof.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident_gpu/owner_proof.rs rename to crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/owner_proof.rs diff --git a/crates/cuda-driver/src/mmq_resident_gpu/queued_proof.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/queued_proof.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident_gpu/queued_proof.rs rename to crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/queued_proof.rs diff --git a/crates/cuda-driver/src/mmq_resident_gpu/resident_chain.rs b/crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident_gpu/resident_chain.rs rename to crates/cuda-driver/src/mmq/resident/mmq_resident_gpu_tests/resident_chain.rs diff --git a/crates/cuda-driver/src/mmq_resident/mmq_workspace.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs similarity index 78% rename from crates/cuda-driver/src/mmq_resident/mmq_workspace.rs rename to crates/cuda-driver/src/mmq/resident/mmq_workspace.rs index 5e9a2eaa..b8d85a22 100644 --- a/crates/cuda-driver/src/mmq_resident/mmq_workspace.rs +++ b/crates/cuda-driver/src/mmq/resident/mmq_workspace.rs @@ -7,9 +7,6 @@ use super::{ bytes, combine, commands, ffi, native_activation, native_integer, }; -#[path = "mmq_workspace/mmq_workspace_bring_up.rs"] mod mmq_workspace_bring_up; -#[path = "mmq_workspace/mmq_workspace_gate_up_chunk_close.rs"] mod mmq_workspace_gate_up_chunk_close; -#[path = "mmq_workspace/projection_plan.rs"] mod projection_plan; diff --git a/crates/cuda-driver/src/mmq_resident/mmq_workspace/mmq_workspace_bring_up.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident/mmq_workspace/mmq_workspace_bring_up.rs rename to crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_bring_up.rs diff --git a/crates/cuda-driver/src/mmq_resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs rename to crates/cuda-driver/src/mmq/resident/mmq_workspace/mmq_workspace_gate_up_chunk_close.rs diff --git a/crates/cuda-driver/src/mmq_resident/mmq_workspace/projection_plan.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident/mmq_workspace/projection_plan.rs rename to crates/cuda-driver/src/mmq/resident/mmq_workspace/projection_plan.rs diff --git a/crates/cuda-driver/src/mmq_resident/mmq_workspace_drop.rs b/crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs similarity index 100% rename from crates/cuda-driver/src/mmq_resident/mmq_workspace_drop.rs rename to crates/cuda-driver/src/mmq/resident/mmq_workspace_drop.rs diff --git a/crates/cuda-driver/src/mmq_native_activation.rs b/crates/cuda-driver/src/mmq/resident/native_activation.rs similarity index 98% rename from crates/cuda-driver/src/mmq_native_activation.rs rename to crates/cuda-driver/src/mmq/resident/native_activation.rs index 8d4fbe19..b00e6a10 100644 --- a/crates/cuda-driver/src/mmq_native_activation.rs +++ b/crates/cuda-driver/src/mmq/resident/native_activation.rs @@ -2,7 +2,7 @@ use super::{Context, DeviceBuffer, Error, FixedOperation, Layout, QueuedCommand, Result, combine, ffi}; pub(super) const CHARGE: usize = 184320; pub(crate) fn asset() -> Result<&'static [u8]> { - let b = include_bytes!("mmq_native_resident_d4.ptx"); + let b = include_bytes!("../../mmq_native_resident_d4.ptx"); if b.len() != 5200 || b.last() != Some(&0) || !b[..b.len() - 1].is_ascii() diff --git a/crates/cuda-driver/src/mmq_native_down.rs b/crates/cuda-driver/src/mmq/resident/native_down.rs similarity index 100% rename from crates/cuda-driver/src/mmq_native_down.rs rename to crates/cuda-driver/src/mmq/resident/native_down.rs diff --git a/crates/cuda-driver/src/iq3_native_integer_mma.rs b/crates/cuda-driver/src/mmq/resident/native_integer.rs similarity index 98% rename from crates/cuda-driver/src/iq3_native_integer_mma.rs rename to crates/cuda-driver/src/mmq/resident/native_integer.rs index 1469f8f2..521c6115 100644 --- a/crates/cuda-driver/src/iq3_native_integer_mma.rs +++ b/crates/cuda-driver/src/mmq/resident/native_integer.rs @@ -4,7 +4,7 @@ use super::{Context, DeviceBuffer, Error, Layout, QueuedCommand, Result, combine pub(super) const CHARGE: usize = 13_107_200; /// Actual root GPU-hidden NVCC 12.8.93 sm_120 asset; explicit experimental policy. pub(crate) fn asset() -> Result<&'static [u8]> { - let b = include_bytes!("iq3_native_integer_mma.ptx"); + let b = include_bytes!("../../iq3_native_integer_mma.ptx"); if b.len() != 17928 || b.last() != Some(&0) || !b[..b.len() - 1].is_ascii() || b[..b.len() - 1].contains(&0) { return Err(Error::InvalidDriverValue("IQ3 native integer MMA PTX encoding")); } diff --git a/crates/cuda-driver/src/mmq_original_group.rs b/crates/cuda-driver/src/mmq/resident/original_group.rs similarity index 89% rename from crates/cuda-driver/src/mmq_original_group.rs rename to crates/cuda-driver/src/mmq/resident/original_group.rs index 4925d030..aab0a65e 100644 --- a/crates/cuda-driver/src/mmq_original_group.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group.rs @@ -125,44 +125,27 @@ pub struct OriginalMmqOutput<'lease, 'layer, 'ctx> { // Additive literal Original stream/event adapter. Old synchronous APIs above // remain whole-byte unchanged, including their original default finite errors. -#[path = "mmq_original_ring.rs"] mod copy_ring; use copy_ring::GatherDest; pub(crate) use copy_ring::prefetch_point; pub use copy_ring::{OriginalMmqCopySchedule, PrefetchSource, PrefetchTarget, RingExperts}; // Closed global issuer consumer. Old per-layer/synchronous producers unchanged. -#[path = "mmq_original_stream_all.rs"] mod stream_all_mmq; #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] #[allow(unsafe_code)] -#[path = "mmq_original_group_stress_gpu.rs"] mod stress_gpu; -#[path = "mmq_original_group/asset.rs"] mod asset; -#[allow(unused_imports)] pub(crate) use asset::asset; -#[allow(unused_imports)] pub use asset::original_mmq_group_bank_bytes; -#[allow(unused_imports)] -use asset::sizes; -#[path = "mmq_original_group/kind.rs"] mod kind; -#[allow(unused_imports)] use kind::format_index; -#[allow(unused_imports)] use kind::kind; -#[allow(unused_imports)] use kind::layout; -#[allow(unused_imports)] use kind::shared; -#[path = "mmq_original_group/copy_ring_layer.rs"] mod copy_ring_layer; -#[path = "mmq_original_group/mmq_workspace.rs"] mod mmq_workspace; -#[path = "mmq_original_group/original_mmq_layer.rs"] mod original_mmq_layer; -#[path = "mmq_original_group/original_mmq_output.rs"] mod original_mmq_output; diff --git a/crates/cuda-driver/src/mmq_original_group/asset.rs b/crates/cuda-driver/src/mmq/resident/original_group/asset.rs similarity index 97% rename from crates/cuda-driver/src/mmq_original_group/asset.rs rename to crates/cuda-driver/src/mmq/resident/original_group/asset.rs index 8989b0d1..260d185d 100644 --- a/crates/cuda-driver/src/mmq_original_group/asset.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/asset.rs @@ -8,9 +8,9 @@ use super::{ pub(crate) fn asset(kind: u32) -> Result<&'static [u8]> { let bytes: &[u8] = match kind { - 0 => include_bytes!("../mmq_original_group_swiglu.ptx"), - 1 => include_bytes!("../mmq_original_group_mul.ptx"), - 2 => include_bytes!("../mmq_original_group_fixup.ptx"), + 0 => include_bytes!("../../../mmq_original_group_swiglu.ptx"), + 1 => include_bytes!("../../../mmq_original_group_mul.ptx"), + 2 => include_bytes!("../../../mmq_original_group_fixup.ptx"), _ => return Err(Error::InvalidProjectionShape), }; let (size, sha) = SEALED[kind as usize].ok_or(Error::InvalidDriverValue("unsealed Original MMQ group"))?; diff --git a/crates/cuda-driver/src/mmq_original_ring.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring.rs similarity index 93% rename from crates/cuda-driver/src/mmq_original_ring.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring.rs index 4e5c9baf..a581511f 100644 --- a/crates/cuda-driver/src/mmq_original_ring.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring.rs @@ -5,11 +5,9 @@ use crate::ffi::original_enqueue::{Api, Command}; use crate::original_gpu_schedule::{OriginalEventKind, OriginalGpuEvent, OriginalGpuStream, OriginalStreamKind}; use leleka_model_format::qwen4exp::{ResidentExpertBankSpan, TensorRole}; use std::rc::Rc; -#[path = "mmq_original_host_stage.rs"] mod host_stage; use host_stage::{HostStage, Job}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "mmq_original_chunk_stream.rs"] mod chunk_stream; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] pub(crate) use chunk_stream::prefetch_point; @@ -133,28 +131,19 @@ pub(super) struct Ring<'read, 'ctx> { closed: bool, } -#[path = "mmq_original_ring/skip_expert_dma.rs"] mod skip_expert_dma; #[cfg(not(all( feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" )))] -#[allow(unused_imports)] pub(crate) use skip_expert_dma::prefetch_point; -#[allow(unused_imports)] use skip_expert_dma::serialize_ring; -#[allow(unused_imports)] use skip_expert_dma::skip_expert_dma; -#[path = "mmq_original_ring/original_mmq_copy_schedule.rs"] mod original_mmq_copy_schedule; -#[path = "mmq_original_ring/original_mmq_copy_schedule_drop.rs"] mod original_mmq_copy_schedule_drop; -#[path = "mmq_original_ring/ring.rs"] mod ring; -#[path = "mmq_original_ring/ring_drop.rs"] mod ring_drop; -#[path = "mmq_original_ring/ring_prefetch_issue.rs"] mod ring_prefetch_issue; use ring_prefetch_issue::RingPrefetch; pub use ring_prefetch_issue::{PrefetchSource, PrefetchTarget}; diff --git a/crates/cuda-driver/src/mmq_original_chunk_stream.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream.rs similarity index 97% rename from crates/cuda-driver/src/mmq_original_chunk_stream.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream.rs index 83b8ea75..c4e35123 100644 --- a/crates/cuda-driver/src/mmq_original_chunk_stream.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream.rs @@ -86,10 +86,7 @@ pub(super) struct ChunkStream { thread: Option>, } -#[path = "mmq_original_chunk_stream/chunk_issuing.rs"] mod chunk_issuing; -#[allow(unused_imports)] pub(crate) use chunk_issuing::prefetch_point; -#[path = "mmq_original_chunk_stream/chunk_stream.rs"] mod chunk_stream; pub(crate) use chunk_stream::CoreParts; diff --git a/crates/cuda-driver/src/mmq_original_chunk_stream/chunk_issuing.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_issuing.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_chunk_stream/chunk_issuing.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_issuing.rs diff --git a/crates/cuda-driver/src/mmq_original_chunk_stream/chunk_stream.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_chunk_stream/chunk_stream.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/chunk_stream/chunk_stream.rs diff --git a/crates/cuda-driver/src/mmq_original_host_stage.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage.rs similarity index 91% rename from crates/cuda-driver/src/mmq_original_host_stage.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage.rs index 3b3a0b1f..15addee9 100644 --- a/crates/cuda-driver/src/mmq_original_host_stage.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage.rs @@ -76,20 +76,12 @@ pub(super) struct HostStage { } #[cfg(test)] -#[path = "mmq_original_host_stage/tests.rs"] +#[path = "../../../../mmq_original_host_stage/tests.rs"] mod tests; -#[path = "mmq_original_host_stage/verify_enabled.rs"] mod verify_enabled; -#[allow(unused_imports)] -use verify_enabled::apply_priority; -#[allow(unused_imports)] -use verify_enabled::block_bytes; -#[allow(unused_imports)] pub(super) use verify_enabled::layer_priority; -#[allow(unused_imports)] +#[cfg(test)] pub(super) use verify_enabled::scales_finite; -#[allow(unused_imports)] use verify_enabled::verify_enabled; -#[path = "mmq_original_host_stage/host_stage.rs"] mod host_stage; diff --git a/crates/cuda-driver/src/mmq_original_host_stage/host_stage.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_host_stage/host_stage.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/host_stage.rs diff --git a/crates/cuda-driver/src/mmq_original_host_stage/verify_enabled.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs similarity index 99% rename from crates/cuda-driver/src/mmq_original_host_stage/verify_enabled.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs index ca0dbc0a..621f3660 100644 --- a/crates/cuda-driver/src/mmq_original_host_stage/verify_enabled.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/host_stage/verify_enabled.rs @@ -3,8 +3,6 @@ use super::{Arc, Job, NON_FINITE, NORMAL_PRIORITY, Ordering, Shared, thread}; // used only with some cargo features or targets of this crate -#[allow(unused_imports)] -use super::{LAYERS, LOW_PRIORITY}; /// Bring-up: `LELEKA_BRINGUP_TRACE` and `LELEKA_STAGE_VERIFY` compare every staged buffer with its source when its DMA /// is released. diff --git a/crates/cuda-driver/src/mmq_original_ring/original_mmq_copy_schedule.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs similarity index 99% rename from crates/cuda-driver/src/mmq_original_ring/original_mmq_copy_schedule.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs index e3e86d02..e6b95973 100644 --- a/crates/cuda-driver/src/mmq_original_ring/original_mmq_copy_schedule.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule.rs @@ -6,7 +6,6 @@ use super::{ chunk_stream, combine, }; // used only with some cargo features or targets of this crate -#[allow(unused_imports)] use super::ffi; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] diff --git a/crates/cuda-driver/src/mmq_original_ring/stream_start.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule/stream_start.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/stream_start.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule/stream_start.rs diff --git a/crates/cuda-driver/src/mmq_original_ring/original_mmq_copy_schedule_drop.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/original_mmq_copy_schedule_drop.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/original_mmq_copy_schedule_drop.rs diff --git a/crates/cuda-driver/src/mmq_original_ring/ring.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs similarity index 82% rename from crates/cuda-driver/src/mmq_original_ring/ring.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs index bd6c7096..e5b806d2 100644 --- a/crates/cuda-driver/src/mmq_original_ring/ring.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring.rs @@ -8,14 +8,10 @@ use super::{ host_stage, kind, serialize_ring, skip_expert_dma, }; -#[path = "ring/ring_construction.rs"] mod ring_construction; -#[path = "ring/ring_gather_and_finish.rs"] mod ring_gather_and_finish; mod ring_init; -#[path = "ring/ring_prefetch.rs"] mod ring_prefetch; pub(super) use ring_prefetch::profile_prefetch; -#[path = "ring/ring_stage_expert_copies.rs"] mod ring_stage_expert_copies; pub(super) use ring_init::RingPlan; diff --git a/crates/cuda-driver/src/mmq_original_ring/ring/ring_construction.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/ring/ring_construction.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_construction.rs diff --git a/crates/cuda-driver/src/mmq_original_ring/ring/ring_gather_and_finish.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/ring/ring_gather_and_finish.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_gather_and_finish.rs diff --git a/crates/cuda-driver/src/mmq_original_ring/ring_init.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_init.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/ring_init.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_init.rs diff --git a/crates/cuda-driver/src/mmq_original_ring/ring/ring_prefetch.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_prefetch.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/ring/ring_prefetch.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_prefetch.rs diff --git a/crates/cuda-driver/src/mmq_original_ring/ring/ring_stage_expert_copies.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/ring/ring_stage_expert_copies.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring/ring_stage_expert_copies.rs diff --git a/crates/cuda-driver/src/mmq_original_ring/ring_drop.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/ring_drop.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_drop.rs diff --git a/crates/cuda-driver/src/mmq_original_ring/ring_prefetch_issue.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_prefetch_issue.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/ring_prefetch_issue.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/ring_prefetch_issue.rs diff --git a/crates/cuda-driver/src/mmq_original_ring/skip_expert_dma.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_ring/skip_expert_dma.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring/skip_expert_dma.rs diff --git a/crates/cuda-driver/src/mmq_original_group/copy_ring_layer.rs b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring_layer.rs similarity index 99% rename from crates/cuda-driver/src/mmq_original_group/copy_ring_layer.rs rename to crates/cuda-driver/src/mmq/resident/original_group/copy_ring_layer.rs index c02c1be9..c8c2feaa 100644 --- a/crates/cuda-driver/src/mmq_original_group/copy_ring_layer.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/copy_ring_layer.rs @@ -1,6 +1,5 @@ //! Copy-ring execution of an `OriginalMmqLayer`: stage, gather, enqueue, drain (a glob import: at the line limit). -#[allow(unused_imports)] use super::*; impl<'layer, 'ctx> OriginalMmqLayer<'layer, 'ctx> { diff --git a/crates/cuda-driver/src/mmq_original_group/kind.rs b/crates/cuda-driver/src/mmq/resident/original_group/kind.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_group/kind.rs rename to crates/cuda-driver/src/mmq/resident/original_group/kind.rs diff --git a/crates/cuda-driver/src/mmq_original_group/mmq_workspace.rs b/crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_group/mmq_workspace.rs rename to crates/cuda-driver/src/mmq/resident/original_group/mmq_workspace.rs diff --git a/crates/cuda-driver/src/mmq_original_group/original_mmq_layer.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs similarity index 77% rename from crates/cuda-driver/src/mmq_original_group/original_mmq_layer.rs rename to crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs index 64a9cabe..04955e2a 100644 --- a/crates/cuda-driver/src/mmq_original_group/original_mmq_layer.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer.rs @@ -7,9 +7,6 @@ use super::{ STATUS, TMP, WD, WG, WIDTHS, XQ, commands, ffi, format_index, kind, layout, }; -#[path = "original_mmq_layer/finite_and_quantize.rs"] mod finite_and_quantize; -#[path = "original_mmq_layer/group_projection.rs"] mod group_projection; -#[path = "original_mmq_layer/original_mmq_layer_stage_experts.rs"] mod original_mmq_layer_stage_experts; diff --git a/crates/cuda-driver/src/mmq_original_group/original_mmq_layer/finite_and_quantize.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_group/original_mmq_layer/finite_and_quantize.rs rename to crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/finite_and_quantize.rs diff --git a/crates/cuda-driver/src/mmq_original_group/original_mmq_layer/group_projection.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_group/original_mmq_layer/group_projection.rs rename to crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/group_projection.rs diff --git a/crates/cuda-driver/src/mmq_original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs rename to crates/cuda-driver/src/mmq/resident/original_group/original_mmq_layer/original_mmq_layer_stage_experts.rs diff --git a/crates/cuda-driver/src/mmq_original_group/original_mmq_output.rs b/crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_group/original_mmq_output.rs rename to crates/cuda-driver/src/mmq/resident/original_group/original_mmq_output.rs diff --git a/crates/cuda-driver/src/mmq_original_stream_all.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq.rs similarity index 83% rename from crates/cuda-driver/src/mmq_original_stream_all.rs rename to crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq.rs index 0a882aab..4a56efba 100644 --- a/crates/cuda-driver/src/mmq_original_stream_all.rs +++ b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq.rs @@ -29,11 +29,6 @@ struct Producer<'producer, 'layer, 'ctx> { layer_id: u8, } -#[path = "mmq_original_stream_all/group_producer_gather_project.rs"] mod group_producer_gather_project; -#[path = "mmq_original_stream_all/transport.rs"] mod transport; -#[allow(unused_imports)] -use group_producer_gather_project::rows_group_span; -#[path = "mmq_original_stream_all/original_mmq_layer.rs"] mod original_mmq_layer; diff --git a/crates/cuda-driver/src/mmq_original_stream_all/group_producer_gather_project.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_stream_all/group_producer_gather_project.rs rename to crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/group_producer_gather_project.rs diff --git a/crates/cuda-driver/src/mmq_original_stream_all/original_mmq_layer.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_stream_all/original_mmq_layer.rs rename to crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/original_mmq_layer.rs diff --git a/crates/cuda-driver/src/mmq_original_stream_all/transport.rs b/crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_stream_all/transport.rs rename to crates/cuda-driver/src/mmq/resident/original_group/stream_all_mmq/transport.rs diff --git a/crates/cuda-driver/src/mmq_original_group_stress_gpu.rs b/crates/cuda-driver/src/mmq/resident/original_group/stress_gpu.rs similarity index 100% rename from crates/cuda-driver/src/mmq_original_group_stress_gpu.rs rename to crates/cuda-driver/src/mmq/resident/original_group/stress_gpu.rs diff --git a/crates/cuda-driver/src/moe_down_pack_gpu.rs b/crates/cuda-driver/src/moe_down_pack_gpu_tests.rs similarity index 100% rename from crates/cuda-driver/src/moe_down_pack_gpu.rs rename to crates/cuda-driver/src/moe_down_pack_gpu_tests.rs diff --git a/crates/cuda-driver/src/moe_group_projection.rs b/crates/cuda-driver/src/moe_group_projection.rs index d6dce209..20f07f19 100644 --- a/crates/cuda-driver/src/moe_group_projection.rs +++ b/crates/cuda-driver/src/moe_group_projection.rs @@ -4,24 +4,12 @@ use super::{ RoutedGateUpQ8, combine, ffi, projection_shape, }; // used only by the GPU proofs of other cargo feature sets (`expert-tier-probe`) -#[allow(unused_imports)] #[cfg(test)] use super::{ - Bf16ProjectionShape, Cell, DenseFormat, Device, DownColumns, Driver, KV_RESIDENT_DEFAULT_CELLS, - KV_RESIDENT_MIN_CELLS, MAX_CONTEXT_CELLS, OriginalGraphResources, OriginalHostKv, OriginalMtpCapture, - OriginalMtpCoupledPlan, OriginalMtpKvFormat, OriginalMtpKvMode, OriginalMtpKvPlan, OriginalMtpKvStartup, - OriginalMtpLoadPlan, OriginalMtpPlanError, OriginalMtpWeightBankPlan, OriginalSessionBytes, OriginalSessionControl, - PhantomData, Q5KProjectionShape, Q6KProjectionShape, Rc, RefCell, ServingContext, TRAINED_CONTEXT_CELLS, - bringup_trace_enabled, context, + Device, DownColumns, Driver, }; // used only by the GPU proofs of other cargo feature sets (`expert-tier-probe`) -#[allow(unused_imports)] -#[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -use super::{GdnGemm, GrBatchModule}; // used only by the GPU proofs of other cargo feature sets (`expert-tier-probe`) -#[allow(unused_imports)] -#[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -use super::{OriginalNativeHeadGraphResources, OriginalVerifyGraphResources, OriginalVerifyWindowOps}; impl Context<'_> { pub fn project_routed_gate_up_columns( &self, @@ -364,7 +352,6 @@ mod installed_tests { any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" ))] -#[path = "grouped_gu21_gu23_gpu.rs"] mod grouped_gu21_gu23_gpu; #[cfg(all( @@ -373,5 +360,4 @@ mod grouped_gu21_gu23_gpu; any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" ))] -#[path = "grouped_gu21_gu23_nc4_gpu.rs"] mod grouped_gu21_gu23_nc4_gpu; diff --git a/crates/cuda-driver/src/grouped_gu21_gu23_gpu.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu.rs similarity index 96% rename from crates/cuda-driver/src/grouped_gu21_gu23_gpu.rs rename to crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu.rs index 183eeb8c..8128cb16 100644 --- a/crates/cuda-driver/src/grouped_gu21_gu23_gpu.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu.rs @@ -102,11 +102,7 @@ fn original_first_gu21_gu23_full_products_refusals_reset_and_cleanup() { ); } -#[path = "grouped_gu21_gu23_gpu/grouped_numeric_run.rs"] mod grouped_numeric_run; -#[allow(unused_imports)] use grouped_numeric_run::numeric; -#[path = "grouped_gu21_gu23_gpu/guards.rs"] mod guards; -#[allow(unused_imports)] use guards::guards; diff --git a/crates/cuda-driver/src/grouped_gu21_gu23_gpu/grouped_numeric_run.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs similarity index 100% rename from crates/cuda-driver/src/grouped_gu21_gu23_gpu/grouped_numeric_run.rs rename to crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/grouped_numeric_run.rs diff --git a/crates/cuda-driver/src/grouped_gu21_gu23_gpu/guards.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs similarity index 100% rename from crates/cuda-driver/src/grouped_gu21_gu23_gpu/guards.rs rename to crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_gpu/guards.rs diff --git a/crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu.rs similarity index 87% rename from crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu.rs rename to crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu.rs index 7e8f6e4b..46253bea 100644 --- a/crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu.rs +++ b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu.rs @@ -51,21 +51,11 @@ fn original_first_gu21_gu23_nc4_full_products_tails_refusals_reset_and_cleanup() ); } -#[path = "grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs"] mod grouped_upload_run; -#[allow(unused_imports)] -use grouped_upload_run::down_weights; -#[allow(unused_imports)] use grouped_upload_run::gu_weights; -#[allow(unused_imports)] use grouped_upload_run::input; -#[allow(unused_imports)] use grouped_upload_run::numeric; -#[allow(unused_imports)] use grouped_upload_run::read; -#[allow(unused_imports)] use grouped_upload_run::upload; -#[path = "grouped_gu21_gu23_nc4_gpu/guards.rs"] mod guards; -#[allow(unused_imports)] use guards::guards; diff --git a/crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs similarity index 100% rename from crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs rename to crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/grouped_upload_run.rs diff --git a/crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu/guards.rs b/crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs similarity index 100% rename from crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu/guards.rs rename to crates/cuda-driver/src/moe_group_projection/grouped_gu21_gu23_nc4_gpu/guards.rs diff --git a/crates/cuda-driver/src/mtp_dense_kv.rs b/crates/cuda-driver/src/mtp_dense_kv.rs index 4be9b0c3..1caae5d3 100644 --- a/crates/cuda-driver/src/mtp_dense_kv.rs +++ b/crates/cuda-driver/src/mtp_dense_kv.rs @@ -167,11 +167,9 @@ mod tests { } #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "mtp_dense_kv_ring_gpu.rs"] mod gpu_tests; // Separate literal Original INT8 drafter; the historical F16 owner stays unchanged. -#[path = "mtp_original_int8.rs"] mod original_int8; pub use original_int8::MTP_ORIGINAL_WINDOW; pub(crate) use original_int8::session_assets_sealed; diff --git a/crates/cuda-driver/src/mtp_dense_kv_ring_gpu.rs b/crates/cuda-driver/src/mtp_dense_kv/gpu_tests.rs similarity index 100% rename from crates/cuda-driver/src/mtp_dense_kv_ring_gpu.rs rename to crates/cuda-driver/src/mtp_dense_kv/gpu_tests.rs diff --git a/crates/cuda-driver/src/mtp_original_int8.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8.rs similarity index 94% rename from crates/cuda-driver/src/mtp_original_int8.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8.rs index 368b3352..351a4c74 100644 --- a/crates/cuda-driver/src/mtp_original_int8.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8.rs @@ -1,10 +1,8 @@ //! Literal Original MTP INT8 ring and record_forward(full=false) attention tail. //! Input/GR and runtime causal authority are separate genuine producer obligations. //! No F16 ring, whole warm_step, prompt-attention, or host-float readiness substitute. -#[path = "mtp_original_int8_ffi.rs"] #[allow(unsafe_code)] mod abi; -#[path = "mtp_original_ring_state.rs"] mod ring_state; use crate::{Context, DeviceBuffer, Error, NativeBatchWorkspace, Result, combine}; use abi::{Arg, Arguments, LaunchDims, MappedOwner, Module}; @@ -55,13 +53,11 @@ struct Origin; #[derive(Clone)] pub struct MtpInt8OwnerId(Rc); -#[path = "mtp_original_logical_prefix.rs"] mod logical_prefix; pub use logical_prefix::{OriginalMtpSkipPrior, OriginalMtpSkippedPrefix}; // The literal prefill producer is an MTP child because it borrows this // owner's private ring/state types. Its public contracts are re-exported by // the crate integration point below. -#[path = "mtp_original_prefill.rs"] mod prefill; pub(crate) use prefill::session_assets_sealed; pub use prefill::{ @@ -207,21 +203,12 @@ mod pages_tests { } } -#[path = "mtp_original_int8/mtp_int8_owner_id.rs"] mod mtp_int8_owner_id; -#[allow(unused_imports)] use mtp_int8_owner_id::snapshot_memo; -#[path = "mtp_original_int8/physical_ring.rs"] mod physical_ring; -#[allow(unused_imports)] use physical_ring::checked; -#[allow(unused_imports)] use physical_ring::layout; -#[allow(unused_imports)] use physical_ring::rows_range; -#[allow(unused_imports)] use physical_ring::zero_bytes; -#[path = "mtp_original_int8/mtp_original_int8_operations.rs"] mod mtp_original_int8_operations; -#[path = "mtp_original_int8/mtp_original_int8_state_adoption.rs"] mod mtp_original_int8_state_adoption; diff --git a/crates/cuda-driver/src/mtp_original_int8_ffi.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi.rs similarity index 93% rename from crates/cuda-driver/src/mtp_original_int8_ffi.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/abi.rs index 11163e44..66fa5d0a 100644 --- a/crates/cuda-driver/src/mtp_original_int8_ffi.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi.rs @@ -32,7 +32,6 @@ impl LaunchShape { } #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "mtp_original_int8_ffi/driver_backed.rs"] mod driver_backed; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] pub(crate) use driver_backed::Module; @@ -45,7 +44,6 @@ pub(crate) struct Module; const HOST_BYTES: usize = 276_825_088; // Original payload + four256B cursor alignment allowances. #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "mtp_original_int8_ffi/host_enabled.rs"] mod host_enabled; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] pub(crate) use host_enabled::MappedOwner; @@ -56,5 +54,4 @@ pub(crate) use host_enabled::MappedOwner; )))] pub(crate) struct MappedOwner; -#[path = "mtp_original_int8_ffi/arguments.rs"] mod arguments; diff --git a/crates/cuda-driver/src/mtp_original_int8_ffi/arguments.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_int8_ffi/arguments.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/arguments.rs diff --git a/crates/cuda-driver/src/mtp_original_int8_ffi/driver_backed.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/driver_backed.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_int8_ffi/driver_backed.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/driver_backed.rs diff --git a/crates/cuda-driver/src/mtp_original_int8_ffi/host_enabled.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_int8_ffi/host_enabled.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/abi/host_enabled.rs diff --git a/crates/cuda-driver/src/mtp_original_logical_prefix.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/logical_prefix.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_logical_prefix.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/logical_prefix.rs diff --git a/crates/cuda-driver/src/mtp_original_int8/mtp_int8_owner_id.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_int8/mtp_int8_owner_id.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_int8_owner_id.rs diff --git a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations.rs similarity index 74% rename from crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations.rs index 02b38a31..4a90c0ed 100644 --- a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations.rs @@ -11,13 +11,8 @@ use super::{ TAIL_ENTRIES, abi, checked, combine, layout, rows_range, snapshot_memo, zero_bytes, }; -#[path = "mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs"] mod mtp_original_int8_attend_split_k; -#[path = "mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs"] mod mtp_original_int8_kv_only_replay; -#[path = "mtp_original_int8_operations/mtp_original_int8_restore.rs"] mod mtp_original_int8_restore; -#[path = "mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs"] mod mtp_original_int8_ring_bring_up; -#[path = "mtp_original_int8_operations/mtp_original_int8_validate_execute.rs"] mod mtp_original_int8_validate_execute; diff --git a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_attend_split_k.rs diff --git a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_kv_only_replay.rs diff --git a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_restore.rs diff --git a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs similarity index 94% rename from crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs index f1c76369..2eb0cf78 100644 --- a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_ring_bring_up.rs @@ -11,8 +11,8 @@ use super::{ /// The ring's tail and KV PTX images must be sealed (no placeholder artifact). fn kv_assets_sealed() -> Result<()> { for ptx in [ - include_bytes!("../../mtp_original_tail.ptx").as_slice(), - include_bytes!("../../mtp_original_kv.ptx").as_slice(), + include_bytes!("../../../mtp_original_tail.ptx").as_slice(), + include_bytes!("../../../mtp_original_kv.ptx").as_slice(), ] { if ptx.windows(8).any(|w| w == b"UNSEALED") { return Err(Error::UnsupportedQwenOperation); @@ -106,10 +106,11 @@ impl<'ctx> MtpOriginalInt8<'ctx> { } fn load_modules(&mut self) -> Result<()> { self.physical_mut()?.modules[0] = - Some(Module::load(include_bytes!("../../mtp_original_tail.ptx"), TAIL_ENTRIES)?); - self.physical_mut()?.modules[1] = Some(Module::load(include_bytes!("../../mtp_original_kv.ptx"), KV_ENTRIES)?); + Some(Module::load(include_bytes!("../../../mtp_original_tail.ptx"), TAIL_ENTRIES)?); + self.physical_mut()?.modules[1] = + Some(Module::load(include_bytes!("../../../mtp_original_kv.ptx"), KV_ENTRIES)?); self.physical_mut()?.modules[2] = - Some(Module::load(include_bytes!("../../qsa_native_decode.ptx"), ATTN_ENTRIES)?); + Some(Module::load(include_bytes!("../../../qsa_native_decode.ptx"), ATTN_ENTRIES)?); self.map_host() } fn map_host(&mut self) -> Result<()> { diff --git a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_operations/mtp_original_int8_validate_execute.rs diff --git a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_state_adoption.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs similarity index 93% rename from crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_state_adoption.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs index e2deffab..10780a41 100644 --- a/crates/cuda-driver/src/mtp_original_int8/mtp_original_int8_state_adoption.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/mtp_original_int8_state_adoption.rs @@ -15,9 +15,9 @@ impl Drop for MtpOriginalInt8<'_> { /// The tail, KV and QSA PTX images must be sealed (no placeholder artifact). fn original_state_sealed() -> Result<()> { for ptx in [ - include_bytes!("../mtp_original_tail.ptx").as_slice(), - include_bytes!("../mtp_original_kv.ptx").as_slice(), - include_bytes!("../qsa_native_decode.ptx").as_slice(), + include_bytes!("../../mtp_original_tail.ptx").as_slice(), + include_bytes!("../../mtp_original_kv.ptx").as_slice(), + include_bytes!("../../qsa_native_decode.ptx").as_slice(), ] { if ptx.windows(8).any(|w| w == b"UNSEALED") { return Err(Error::UnsupportedQwenOperation); @@ -72,9 +72,9 @@ impl<'ctx> MtpOriginalInt8<'ctx> { } fn load_state_modules(&mut self) -> Result<()> { for (i, (ptx, entries)) in [ - (include_bytes!("../mtp_original_tail.ptx").as_slice(), TAIL_ENTRIES), - (include_bytes!("../mtp_original_kv.ptx").as_slice(), KV_ENTRIES), - (include_bytes!("../qsa_native_decode.ptx").as_slice(), ATTN_ENTRIES), + (include_bytes!("../../mtp_original_tail.ptx").as_slice(), TAIL_ENTRIES), + (include_bytes!("../../mtp_original_kv.ptx").as_slice(), KV_ENTRIES), + (include_bytes!("../../qsa_native_decode.ptx").as_slice(), ATTN_ENTRIES), ] .into_iter() .enumerate() diff --git a/crates/cuda-driver/src/mtp_original_int8/physical_ring.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_int8/physical_ring.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/physical_ring.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill.rs similarity index 93% rename from crates/cuda-driver/src/mtp_original_prefill.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill.rs index cd01fd50..e6840bc7 100644 --- a/crates/cuda-driver/src/mtp_original_prefill.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill.rs @@ -11,7 +11,6 @@ use crate::ffi::BufferHandle; use crate::original_prefill_arena::OriginalPromptSpan; use crate::{OriginalDeviceResidual, OriginalPromptRows}; #[allow(unsafe_code)] -#[path = "mtp_original_prefill_ffi.rs"] mod prefill_abi; use prefill_abi::{Arg as A, Arguments as Args, Geometry as PrefillGeometry, Module as Mod}; use std::ffi::CStr; @@ -37,7 +36,6 @@ const ENTRIES: &[&CStr] = &[ c"mtp_prefill_gr_product_scan", c"mtp_prefill_q8_scan", ]; -#[path = "mtp_original_prefill_symbols.rs"] mod symbols; #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -160,7 +158,6 @@ pub struct OriginalMtpPrefill<'ctx> { failed: bool, } -#[path = "mtp_original_scalar_prefill.rs"] mod scalar; pub(crate) use scalar::session_assets_sealed; pub use scalar::{ @@ -170,17 +167,10 @@ pub use scalar::{ OriginalMtpStepOutput, ScalarDraftKvSources, }; -#[path = "mtp_original_prefill/completed_draft_kv.rs"] mod completed_draft_kv; -#[allow(unused_imports)] use completed_draft_kv::aligned; -#[allow(unused_imports)] use completed_draft_kv::fastdiv; -#[allow(unused_imports)] use completed_draft_kv::q8_bytes; -#[path = "mtp_original_prefill/original_mtp_prefill.rs"] mod original_mtp_prefill; -#[path = "mtp_original_prefill/original_mtp_prefill_drop.rs"] mod original_mtp_prefill_drop; -#[path = "mtp_original_prefill/region.rs"] mod region; diff --git a/crates/cuda-driver/src/mtp_original_prefill/completed_draft_kv.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill/completed_draft_kv.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/completed_draft_kv.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs similarity index 73% rename from crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs index ac1b2c41..4c140c96 100644 --- a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill.rs @@ -10,21 +10,13 @@ use super::{ WIDTHS, combine, fastdiv, q8_bytes, symbols, zero_bytes, }; -#[path = "original_mtp_prefill/block_commands.rs"] mod block_commands; -#[path = "original_mtp_prefill/kernel_commands.rs"] mod kernel_commands; -#[path = "original_mtp_prefill/original_mtp_prefill_close.rs"] mod original_mtp_prefill_close; -#[path = "original_mtp_prefill/projection_commands.rs"] mod projection_commands; -#[path = "original_mtp_prefill/record_operands.rs"] mod record_operands; -#[path = "original_mtp_prefill/record_walk.rs"] mod record_walk; -#[path = "original_mtp_prefill/run_and_settle.rs"] mod run_and_settle; -#[allow(unused_imports)] use record_operands::{ Admit, AppendBlock, Block, Call, GrBufs, KernelAt, KernelShape, PageRuns, ProjectionAddresses, ProjectionDims, Stage, Staged, WEIGHT_EXTENTS, diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/block_commands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/block_commands.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/block_commands.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/block_commands.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/kernel_commands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs similarity index 94% rename from crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/kernel_commands.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs index ab9e16ef..a18fdaec 100644 --- a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/kernel_commands.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/kernel_commands.rs @@ -26,11 +26,11 @@ impl<'ctx> OriginalMtpPrefill<'ctx> { } fn sealed_assets() -> Result<[&'static [u8]; 5]> { let assets = [ - include_bytes!("../../mtp_original_prefill.ptx").as_slice(), - include_bytes!("../../mtp_original_prefill_embedding.ptx").as_slice(), - include_bytes!("../../mtp_original_prefill_quant.ptx").as_slice(), - include_bytes!("../../mtp_original_prefill_mmq.ptx").as_slice(), - include_bytes!("../../mtp_original_prefill_fixup.ptx").as_slice(), + include_bytes!("../../../../mtp_original_prefill.ptx").as_slice(), + include_bytes!("../../../../mtp_original_prefill_embedding.ptx").as_slice(), + include_bytes!("../../../../mtp_original_prefill_quant.ptx").as_slice(), + include_bytes!("../../../../mtp_original_prefill_mmq.ptx").as_slice(), + include_bytes!("../../../../mtp_original_prefill_fixup.ptx").as_slice(), ]; if assets.iter().any(|a| a.windows(8).any(|w| w == b"UNSEALED")) { return Err(Error::UnsupportedQwenOperation); diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/original_mtp_prefill_close.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/original_mtp_prefill_close.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/original_mtp_prefill_close.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/projection_commands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/projection_commands.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/projection_commands.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/record_operands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_operands.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/record_operands.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_operands.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/record_walk.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/record_walk.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/record_walk.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/run_and_settle.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill/run_and_settle.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill/run_and_settle.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill_drop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill_drop.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/original_mtp_prefill_drop.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill_ffi.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/prefill_abi.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill_ffi.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/prefill_abi.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill/region.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill/region.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/region.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar.rs similarity index 90% rename from crates/cuda-driver/src/mtp_original_scalar_prefill.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar.rs index d49b6210..87a199e5 100644 --- a/crates/cuda-driver/src/mtp_original_scalar_prefill.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar.rs @@ -10,20 +10,16 @@ use super::{ TAIL_ENTRIES, abi, aligned, checked, combine, ring_state, zero_bytes, }; #[allow(unsafe_code)] -#[path = "mtp_original_scalar_ffi.rs"] mod scalar_abi; use crate::{OriginalGpuStream, OriginalGraphKey, OriginalGraphRegistry, OriginalGraphResources, OriginalStreamKind}; use abi::LaunchShape; use scalar_abi::{Arg, Arguments, Module}; -#[path = "mtp_original_scalar_weights.rs"] mod retained_weights; pub use retained_weights::OriginalMtpRetainedScalarWeights; #[allow(unsafe_code)] -#[path = "mtp_original_scalar_mapped.rs"] mod mapped_records; use std::cell::RefCell; #[allow(unsafe_code)] -#[path = "mtp_original_physical_layout.rs"] mod physical_layout; struct OriginalLayoutSetup<'ctx> { layout: physical_layout::Layout, @@ -77,7 +73,6 @@ struct Scratch { bytes: usize, } -#[path = "mtp_original_full_forward.rs"] mod full_forward; pub(crate) use full_forward::session_assets_sealed; pub use full_forward::{ @@ -129,16 +124,11 @@ pub struct OriginalMtpScalarPrefill<'ctx> { has_pending: bool, } -#[path = "mtp_original_scalar_graph.rs"] mod graph; #[cfg(test)] -#[path = "mtp_original_scalar_short_gpu.rs"] mod short_prompt_gpu; -#[path = "mtp_original_scalar_prefill/graph_resources_original_graph_resources.rs"] mod graph_resources_original_graph_resources; -#[path = "mtp_original_scalar_prefill/original_mtp_scalar_prefill.rs"] mod original_mtp_scalar_prefill; -#[path = "mtp_original_scalar_prefill/original_mtp_scalar_prefill_drop.rs"] mod original_mtp_scalar_prefill_drop; diff --git a/crates/cuda-driver/src/mtp_original_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward.rs similarity index 91% rename from crates/cuda-driver/src/mtp_original_full_forward.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward.rs index b931bff9..66dc0382 100644 --- a/crates/cuda-driver/src/mtp_original_full_forward.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward.rs @@ -13,15 +13,11 @@ use super::{ #[cfg(test)] use super::TAIL_ENTRIES; #[allow(unsafe_code)] -#[path = "mtp_original_full_ffi.rs"] mod full_abi; use full_abi::{Arg as F, Arguments as FA, Module as FM}; #[allow(unsafe_code)] -#[path = "mtp_original_full_mapped.rs"] mod full_mapped; -#[path = "mtp_original_full_head_dispatch.rs"] mod head_dispatch; -#[path = "mtp_original_full_symbols.rs"] mod symbols; use crate::mtp_dense_kv::original_int8::abi::LaunchShape; use crate::native_head::OriginalMtpNativeEmbedding; @@ -200,17 +196,13 @@ pub struct OriginalMtpStepOutput { pub probability: f32, } -#[path = "mtp_original_full_drafter.rs"] mod full_drafter; -#[path = "mtp_original_full_round.rs"] pub(crate) mod full_round; pub use full_drafter::{CompletedOriginalMtpDraft, OriginalMtpDrafter}; pub use full_round::OriginalMtpDraftProgram; -#[path = "mtp_original_session.rs"] mod session_coupling; pub(crate) use session_coupling::session_assets_sealed; -pub use session_coupling::{OriginalMtpRopeForm, OriginalMtpSessionPlan, OriginalMtpSessionResources}; #[cfg(test)] mod role_map_tests { @@ -324,37 +316,21 @@ mod role_map_tests { } } -#[path = "mtp_original_full_forward/context.rs"] mod context; -#[path = "mtp_original_full_forward/full_owned.rs"] mod full_owned; mod mtp_original_check_batch_program; mod mtp_original_full_init; -#[path = "mtp_original_full_forward/original_mtp_full_forward.rs"] mod original_mtp_full_forward; -#[path = "mtp_original_full_forward/original_mtp_retained_prefix.rs"] mod original_mtp_retained_prefix; -#[path = "mtp_original_full_forward/validate_scalar_prefix.rs"] mod validate_scalar_prefix; -#[allow(unused_imports)] use validate_scalar_prefix::chain_mtp_assets; -#[allow(unused_imports)] use validate_scalar_prefix::daily_mtp; -#[allow(unused_imports)] use validate_scalar_prefix::fixed_entry; -#[allow(unused_imports)] use validate_scalar_prefix::mmvf_block; -#[allow(unused_imports)] use validate_scalar_prefix::push; -#[allow(unused_imports)] use validate_scalar_prefix::validate_scalar_prefix; -#[path = "mtp_original_full_forward/context_original_mtp_shared_layout.rs"] mod context_original_mtp_shared_layout; -#[path = "mtp_original_full_forward/full_forward_prefix_program.rs"] mod full_forward_prefix_program; -#[path = "mtp_original_full_forward/matrix_vector_buffers_and_shape.rs"] mod matrix_vector_buffers_and_shape; -#[path = "mtp_original_full_forward/original_mtp_forward_program.rs"] mod original_mtp_forward_program; -#[path = "mtp_original_full_forward/original_mtp_forward_program_original_graph.rs"] mod original_mtp_forward_program_original_graph; diff --git a/crates/cuda-driver/src/mtp_original_full_forward/context.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/context.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/context_original_mtp_shared_layout.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs similarity index 96% rename from crates/cuda-driver/src/mtp_original_full_forward/context_original_mtp_shared_layout.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs index 7c451e18..61f5b759 100644 --- a/crates/cuda-driver/src/mtp_original_full_forward/context_original_mtp_shared_layout.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/context_original_mtp_shared_layout.rs @@ -47,9 +47,9 @@ fn layout_setup<'ctx>( fn ring_assets_sealed() -> Result<()> { OriginalMtpScalarPrefill::assets_ready()?; for ptx in [ - include_bytes!("../mtp_original_tail.ptx").as_slice(), - include_bytes!("../mtp_original_kv.ptx").as_slice(), - include_bytes!("../qsa_native_decode.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_tail.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_kv.ptx").as_slice(), + include_bytes!("../../../../../qsa_native_decode.ptx").as_slice(), ] { if ptx.windows(8).any(|w| w == b"UNSEALED") { return Err(Error::UnsupportedQwenOperation); diff --git a/crates/cuda-driver/src/mtp_original_full_ffi.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_abi.rs similarity index 98% rename from crates/cuda-driver/src/mtp_original_full_ffi.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_abi.rs index 0fed49e3..7a6ec352 100644 --- a/crates/cuda-driver/src/mtp_original_full_ffi.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_abi.rs @@ -98,7 +98,6 @@ impl Copy2D { } } #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "mtp_original_full_ffi/driver_backed.rs"] mod driver_backed; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] pub(crate) use driver_backed::Module; @@ -149,5 +148,5 @@ impl Module { } } #[cfg(test)] -#[path = "mtp_original_full_ffi/tests.rs"] +#[path = "../../../../../mtp_original_full_ffi/tests.rs"] mod tests; diff --git a/crates/cuda-driver/src/mtp_original_full_ffi/driver_backed.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_abi/driver_backed.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_ffi/driver_backed.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_abi/driver_backed.rs diff --git a/crates/cuda-driver/src/mtp_original_full_drafter.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter.rs similarity index 94% rename from crates/cuda-driver/src/mtp_original_full_drafter.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter.rs index ab40269d..404d903e 100644 --- a/crates/cuda-driver/src/mtp_original_full_drafter.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter.rs @@ -67,7 +67,6 @@ struct AdmittedRound { policy_key: [u32; 23], } -#[path = "original_mtp_round_lifecycle.rs"] mod round_lifecycle; pub struct CompletedOriginalMtpDraft<'ctx> { @@ -97,9 +96,6 @@ pub struct OriginalMtpDrafter<'ctx> { in_flight: Option>, } -#[path = "mtp_original_full_drafter/completed_original_mtp_draft.rs"] mod completed_original_mtp_draft; -#[path = "mtp_original_full_drafter/original_mtp_drafter.rs"] mod original_mtp_drafter; -#[path = "mtp_original_full_drafter/original_mtp_drafter_from_verifier.rs"] mod original_mtp_drafter_from_verifier; diff --git a/crates/cuda-driver/src/mtp_original_full_drafter/completed_original_mtp_draft.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_drafter/completed_original_mtp_draft.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/completed_original_mtp_draft.rs diff --git a/crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs similarity index 72% rename from crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs index ee82c682..6155f154 100644 --- a/crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter.rs @@ -10,15 +10,9 @@ use super::{ Result, RoundMode, SamplerParams, ScalarDraftKvSources, combine, validate_scalar_prefix, }; -#[path = "original_mtp_drafter/original_mtp_drafter_chain_gate.rs"] mod original_mtp_drafter_chain_gate; -#[path = "original_mtp_drafter/original_mtp_drafter_finish_chain.rs"] mod original_mtp_drafter_finish_chain; -#[path = "original_mtp_drafter/original_mtp_drafter_pipelined_chain.rs"] mod original_mtp_drafter_pipelined_chain; -#[path = "original_mtp_drafter/original_mtp_drafter_keep_bank.rs"] mod original_mtp_drafter_keep_bank; -#[path = "original_mtp_drafter/original_mtp_drafter_launch_rounds.rs"] mod original_mtp_drafter_launch_rounds; -#[path = "original_mtp_drafter/original_mtp_drafter_new_draft.rs"] mod original_mtp_drafter_new_draft; diff --git a/crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_chain_gate.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_chain_gate.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_chain_gate.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_chain_gate.rs diff --git a/crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_finish_chain.rs diff --git a/crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_keep_bank.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_keep_bank.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_keep_bank.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_keep_bank.rs diff --git a/crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_launch_rounds.rs diff --git a/crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_new_draft.rs diff --git a/crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_pipelined_chain.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_pipelined_chain.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter/original_mtp_drafter_pipelined_chain.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter/original_mtp_drafter_pipelined_chain.rs diff --git a/crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter_from_verifier.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_drafter/original_mtp_drafter_from_verifier.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/original_mtp_drafter_from_verifier.rs diff --git a/crates/cuda-driver/src/original_mtp_round_lifecycle.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle.rs similarity index 94% rename from crates/cuda-driver/src/original_mtp_round_lifecycle.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle.rs index da815c17..f2cd2830 100644 --- a/crates/cuda-driver/src/original_mtp_round_lifecycle.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle.rs @@ -82,11 +82,7 @@ struct OriginalMtpResumePlan { slots: usize, } -#[path = "original_mtp_round_lifecycle/original_mtp_prefill_plan.rs"] mod original_mtp_prefill_plan; -#[allow(unused_imports)] use original_mtp_prefill_plan::public_step; -#[path = "original_mtp_round_lifecycle/original_mtp_drafter.rs"] mod original_mtp_drafter; -#[path = "original_mtp_round_lifecycle/public_draft_output_copy.rs"] mod public_draft_output_copy; diff --git a/crates/cuda-driver/src/original_mtp_round_lifecycle/original_mtp_drafter.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs similarity index 100% rename from crates/cuda-driver/src/original_mtp_round_lifecycle/original_mtp_drafter.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_drafter.rs diff --git a/crates/cuda-driver/src/original_mtp_round_lifecycle/original_mtp_prefill_plan.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs similarity index 100% rename from crates/cuda-driver/src/original_mtp_round_lifecycle/original_mtp_prefill_plan.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/original_mtp_prefill_plan.rs diff --git a/crates/cuda-driver/src/original_mtp_round_lifecycle/public_draft_output_copy.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs similarity index 100% rename from crates/cuda-driver/src/original_mtp_round_lifecycle/public_draft_output_copy.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_drafter/round_lifecycle/public_draft_output_copy.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs similarity index 85% rename from crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs index 674d951c..77e310db 100644 --- a/crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program.rs @@ -10,7 +10,5 @@ use super::{ ScalarPrefixPlan, TAIL_FLAGS, TailArgs, abi, checked, full_abi, validate_scalar_prefix, }; -#[path = "full_forward_prefix_program/full_forward_program_alias_checks.rs"] mod full_forward_program_alias_checks; -#[path = "full_forward_prefix_program/original_mtp_full_forward.rs"] mod original_mtp_full_forward; diff --git a/crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/full_forward_program_alias_checks.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program/original_mtp_full_forward.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program/prefix_parts.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward/prefix_parts.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program/prefix_parts.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward/prefix_parts.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program/prefix_rows.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward/prefix_rows.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/full_forward_prefix_program/prefix_rows.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_forward_prefix_program/original_mtp_full_forward/prefix_rows.rs diff --git a/crates/cuda-driver/src/mtp_original_full_mapped.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_mapped.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_mapped.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_mapped.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/full_owned.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/full_owned.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_owned.rs diff --git a/crates/cuda-driver/src/mtp_original_full_round.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round.rs similarity index 91% rename from crates/cuda-driver/src/mtp_original_full_round.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round.rs index ba6a3a62..6bef70b6 100644 --- a/crates/cuda-driver/src/mtp_original_full_round.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round.rs @@ -112,23 +112,13 @@ mod stage_fence_tests { } } -#[path = "mtp_original_full_round/staged_source.rs"] mod staged_source; -#[allow(unused_imports)] -use staged_source::mapped_i32; -#[allow(unused_imports)] use staged_source::mtp_select; -#[path = "mtp_original_full_round/post_select.rs"] mod post_select; -#[allow(unused_imports)] use post_select::post_select; -#[path = "mtp_original_full_round/original_mtp_draft_program.rs"] mod original_mtp_draft_program; -#[path = "mtp_original_full_round/put.rs"] mod put; -#[allow(unused_imports)] +#[cfg(test)] use put::copy_rows_then_fence; -#[allow(unused_imports)] use put::overlap; -#[allow(unused_imports)] use put::put; diff --git a/crates/cuda-driver/src/mtp_original_full_round/original_mtp_draft_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs similarity index 99% rename from crates/cuda-driver/src/mtp_original_full_round/original_mtp_draft_program.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs index abe3729d..de25e0c4 100644 --- a/crates/cuda-driver/src/mtp_original_full_round/original_mtp_draft_program.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/original_mtp_draft_program.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalMtpDraftProgram`: `enqueue_commands`, `capture`, `capture_all`, `capture_catchup` and 17 more. //! Split out of `full_round` to keep its files under the line limit. -#[allow(unused_imports)] use super::super::mtp_original_check_batch_program::launch_prefix_command; use super::{ Error, FA, FullCommand, LaunchShape, MTP_ORIGINAL_MAX_CELLS, NativeHeadSelection, OriginalCapture, diff --git a/crates/cuda-driver/src/mtp_original_full_round/post_select.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_round/post_select.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/post_select.rs diff --git a/crates/cuda-driver/src/mtp_original_full_round/put.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_round/put.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/put.rs diff --git a/crates/cuda-driver/src/mtp_original_full_round/staged_source.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_round/staged_source.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/full_round/staged_source.rs diff --git a/crates/cuda-driver/src/mtp_original_full_head_dispatch.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/head_dispatch.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_head_dispatch.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/head_dispatch.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs similarity index 76% rename from crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs index 69831664..4cce1d9e 100644 --- a/crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape.rs @@ -22,11 +22,7 @@ pub(super) struct MatVecShape { rows: usize, } -#[path = "matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs"] mod full_forward_final_gr_stages; -#[path = "matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs"] mod full_forward_finite_tail_mlp_gr; -#[path = "matrix_vector_buffers_and_shape/full_forward_moe_block_plan.rs"] mod full_forward_moe_block_plan; -#[path = "matrix_vector_buffers_and_shape/original_mtp_full_forward.rs"] mod original_mtp_full_forward; diff --git a/crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_final_gr_stages.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_finite_tail_mlp_gr.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape/full_forward_moe_block_plan.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_moe_block_plan.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape/full_forward_moe_block_plan.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/full_forward_moe_block_plan.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/matrix_vector_buffers_and_shape/original_mtp_full_forward.rs diff --git a/crates/cuda-driver/src/mtp_original_check_batch_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/mtp_original_check_batch_program.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_check_batch_program.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/mtp_original_check_batch_program.rs diff --git a/crates/cuda-driver/src/mtp_original_check_batch_program/gpu_tests.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/mtp_original_check_batch_program/gpu_tests.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_check_batch_program/gpu_tests.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/mtp_original_check_batch_program/gpu_tests.rs diff --git a/crates/cuda-driver/src/mtp_original_check_batch_program/tests.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/mtp_original_check_batch_program/tests.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_check_batch_program/tests.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/mtp_original_check_batch_program/tests.rs diff --git a/crates/cuda-driver/src/mtp_original_full_init.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/mtp_original_full_init.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_init.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/mtp_original_full_init.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/original_mtp_forward_program.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/original_mtp_forward_program.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/original_mtp_forward_program_original_graph.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/original_mtp_forward_program_original_graph.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_forward_program_original_graph.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/original_mtp_full_forward.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/original_mtp_full_forward.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_full_forward.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/original_mtp_retained_prefix.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/original_mtp_retained_prefix.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/original_mtp_retained_prefix.rs diff --git a/crates/cuda-driver/src/mtp_original_session.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling.rs similarity index 91% rename from crates/cuda-driver/src/mtp_original_session.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling.rs index 2a91ea6a..ce4d05b2 100644 --- a/crates/cuda-driver/src/mtp_original_session.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling.rs @@ -67,15 +67,9 @@ pub(crate) struct OriginalMtpSessionRopePlan<'ctx> { heads: usize, } -#[path = "mtp_original_session/original_mtp_session_plan.rs"] mod original_mtp_session_plan; -#[path = "mtp_original_session/original_mtp_session_resources.rs"] mod original_mtp_session_resources; -#[allow(unused_imports)] use original_mtp_session_resources::session_legacy_asset; -#[allow(unused_imports)] use original_mtp_session_resources::session_native_asset; -#[path = "mtp_original_session/session_owned_drop.rs"] mod session_owned_drop; -#[allow(unused_imports)] pub(crate) use session_owned_drop::session_assets_sealed; diff --git a/crates/cuda-driver/src/mtp_original_session/original_mtp_session_plan.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_session/original_mtp_session_plan.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_plan.rs diff --git a/crates/cuda-driver/src/mtp_original_session/original_mtp_session_resources.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs similarity index 98% rename from crates/cuda-driver/src/mtp_original_session/original_mtp_session_resources.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs index 8f5aa733..99f994c9 100644 --- a/crates/cuda-driver/src/mtp_original_session/original_mtp_session_resources.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/original_mtp_session_resources.rs @@ -264,13 +264,13 @@ impl<'ctx> OriginalMtpSessionResources<'ctx> { } pub(super) fn session_native_asset() -> Option<&'static [u8]> { crate::sealed_ptx::pinned( - concat!(include_str!("../mtp_original_session_native_rope.ptx"), "\0").as_bytes(), + concat!(include_str!("../../../../../../mtp_original_session_native_rope.ptx"), "\0").as_bytes(), SESSION_NATIVE_ASSET_PIN, ) } pub(super) fn session_legacy_asset() -> Option<&'static [u8]> { crate::sealed_ptx::pinned( - concat!(include_str!("../mtp_original_session_legacy_rope.ptx"), "\0").as_bytes(), + concat!(include_str!("../../../../../../mtp_original_session_legacy_rope.ptx"), "\0").as_bytes(), SESSION_LEGACY_ASSET_PIN, ) } diff --git a/crates/cuda-driver/src/mtp_original_session/session_owned_drop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_session/session_owned_drop.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/session_coupling/session_owned_drop.rs diff --git a/crates/cuda-driver/src/mtp_original_full_symbols.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols.rs similarity index 71% rename from crates/cuda-driver/src/mtp_original_full_symbols.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols.rs index 365339e6..cedc2c48 100644 --- a/crates/cuda-driver/src/mtp_original_full_symbols.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols.rs @@ -1,33 +1,20 @@ use super::CStr; -#[path = "mtp_original_full_symbols/assets_types.rs"] mod assets_types; -#[allow(unused_imports)] pub(super) use assets_types::ASSETS; -#[path = "mtp_original_full_symbols/chain_asset_types.rs"] mod chain_asset_types; -#[allow(unused_imports)] pub(super) use chain_asset_types::CHAIN_ASSET; -#[allow(unused_imports)] -pub(super) use chain_asset_types::CHAIN_QSA_CHUNK; -#[allow(unused_imports)] pub(super) use chain_asset_types::CHAIN_QSA_MERGE_N; -#[allow(unused_imports)] pub(super) use chain_asset_types::CHAIN_ROW_TOP_PROB; -#[allow(unused_imports)] pub(super) use chain_asset_types::CHAIN_SAMPLER_GREEDY; -#[allow(unused_imports)] pub(super) use chain_asset_types::DAILY_ASSET; -#[allow(unused_imports)] pub(super) use chain_asset_types::DAILY_CHUNK; -#[allow(unused_imports)] pub(super) use chain_asset_types::DAILY_MERGE_V2; /// The sealed batched numerical guard (`LELEKA_DRAFT_CHECK_MERGE`); loaded only when the switch is on, so it is not a /// slot of `ASSETS` and moves no index. -#[allow(unused_imports)] pub(super) static CHECK_BATCH: (&[u8], &[&std::ffi::CStr]) = - (include_bytes!("mtp_original_check_batch.ptx"), &[c"mtp_original_check_batch"]); + (include_bytes!("../../../../../mtp_original_check_batch.ptx"), &[c"mtp_original_check_batch"]); /// Length (with the terminal NUL) and sha256 of the body of `mtp_original_check_batch.ptx`, compiled from /// `mtp_original_check_batch.cu` by `scripts/gpu-bringup/compile_assets.py` (nvcc 13.2.86, the plan entry of diff --git a/crates/cuda-driver/src/mtp_original_full_symbols/assets_types.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs similarity index 87% rename from crates/cuda-driver/src/mtp_original_full_symbols/assets_types.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs index 7171ae6a..cab1ee37 100644 --- a/crates/cuda-driver/src/mtp_original_full_symbols/assets_types.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/assets_types.rs @@ -3,9 +3,13 @@ use super::CStr; +/// The sealed PTX of the crate's `src/` directory, six levels above this file: `ptx!("name.ptx")` is its bytes. +#[rustfmt::skip] +macro_rules! ptx { ($name:literal) => { include_bytes!(concat!("../../../../../../", $name)) }; } + pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ ( - include_bytes!("../mtp_original_full_s2.ptx"), + ptx!("mtp_original_full_s2.ptx"), &[ c"mtp_full_group_resident_kernel", c"mtp_full_gu_grouped_kernel", @@ -15,9 +19,9 @@ pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ c"mtp_full_down_grouped_t_kernel", ], ), - (include_bytes!("../mtp_original_full_quant80.ptx"), &[c"mtp_full_quantize_q8_0_scaled_kernel"]), + (ptx!("mtp_original_full_quant80.ptx"), &[c"mtp_full_quantize_q8_0_scaled_kernel"]), ( - include_bytes!("../mtp_original_full_shared.ptx"), + ptx!("mtp_original_full_shared.ptx"), &[ c"mtp_full_native_swiglu_kernel", c"mtp_full_scalar_gate_kernel", @@ -26,18 +30,18 @@ pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ c"mtp_full_moe_combine_kernel", ], ), - (include_bytes!("../mtp_original_full_router.ptx"), &[c"mtp_full_route"]), + (ptx!("mtp_original_full_router.ptx"), &[c"mtp_full_route"]), ( - include_bytes!("../mtp_original_full_router_legacy.ptx"), + ptx!("mtp_original_full_router_legacy.ptx"), &[ c"mtp_full_router_top10_kernel", c"mtp_full_router_top10_fast_kernel", c"mtp_full_router_top10_serial_kernel", ], ), - (include_bytes!("../mtp_original_full_combine.ptx"), &[c"mtp_full_combine"]), + (ptx!("mtp_original_full_combine.ptx"), &[c"mtp_full_combine"]), ( - include_bytes!("../mtp_original_full_bf16.ptx"), + ptx!("mtp_original_full_bf16.ptx"), &[ c"mtp_full_mmvf32", c"mtp_full_mmvf64", @@ -49,13 +53,10 @@ pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ c"mtp_full_mmvf256", ], ), - (include_bytes!("../mtp_original_full_gr_norm.ptx"), &[c"mtp_full_gr_norm"]), + (ptx!("mtp_original_full_gr_norm.ptx"), &[c"mtp_full_gr_norm"]), + (ptx!("mtp_original_full_gr_post.ptx"), &[c"mtp_full_down_silu", c"mtp_full_pre_final", c"mtp_full_native_write"]), ( - include_bytes!("../mtp_original_full_gr_post.ptx"), - &[c"mtp_full_down_silu", c"mtp_full_pre_final", c"mtp_full_native_write"], - ), - ( - include_bytes!("../mtp_original_full_gr_write.ptx"), + ptx!("mtp_original_full_gr_write.ptx"), &[ c"mtp_full_gr_write", c"mtp_full_legacy_norm_true", @@ -68,16 +69,16 @@ pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ ], ), ( - include_bytes!("../mtp_original_full_element.ptx"), + ptx!("mtp_original_full_element.ptx"), &[c"mtp_full_to_bf16", c"mtp_full_copy_from_mapped", c"mtp_full_copy_i32_from_mapped"], ), - (include_bytes!("../mtp_original_full_qsa_gate.ptx"), &[c"mtp_full_gate"]), + (ptx!("mtp_original_full_qsa_gate.ptx"), &[c"mtp_full_gate"]), ( - include_bytes!("../mtp_original_full_verify.ptx"), + ptx!("mtp_original_full_verify.ptx"), &[c"mtp_full_row_top_prob_kernel", c"mtp_full_map_ids_kernel", c"mtp_full_mtp_select_kernel"], ), ( - include_bytes!("../mtp_original_full_head_native.ptx"), + ptx!("mtp_original_full_head_native.ptx"), &[ c"head_quant", c"head_n2_s0", @@ -313,7 +314,7 @@ pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ ], ), ( - include_bytes!("../mtp_original_full_head_iq.ptx"), + ptx!("mtp_original_full_head_iq.ptx"), &[ c"head_i7_old", c"head_i16_old", @@ -351,7 +352,7 @@ pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ ], ), ( - include_bytes!("../mtp_original_full_head_sampler.ptx"), + ptx!("mtp_original_full_head_sampler.ptx"), &[ c"sampler_greedy_kernel", c"sampler_kernel", @@ -360,9 +361,9 @@ pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ c"sampler_split_merge_kernel", ], ), - (include_bytes!("../mtp_original_full_qnorm.ptx"), &[c"mtp_full_qnorm", c"mtp_scalar_rope"]), + (ptx!("mtp_original_full_qnorm.ptx"), &[c"mtp_full_qnorm", c"mtp_scalar_rope"]), ( - include_bytes!("../mtp_original_full_fused_gr.ptx"), + ptx!("mtp_original_full_fused_gr.ptx"), &[ c"mtp_scalar_gr_norm", c"mtp_scalar_gr_split", @@ -372,16 +373,16 @@ pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ c"mtp_scalar_gr_down2560", ], ), - (include_bytes!("../mtp_original_full_checks.ptx"), &[c"mtp_original_finite", c"mtp_original_q8_guard"]), - (include_bytes!("../mtp_original_full_attention.ptx"), &[c"leleka_qsa_decode_chunk", c"leleka_qsa_decode_merge"]), + (ptx!("mtp_original_full_checks.ptx"), &[c"mtp_original_finite", c"mtp_original_q8_guard"]), + (ptx!("mtp_original_full_attention.ptx"), &[c"leleka_qsa_decode_chunk", c"leleka_qsa_decode_merge"]), ( - include_bytes!("../mtp_original_full_coupled.ptx"), + ptx!("mtp_original_full_coupled.ptx"), &[c"sampler_split_part_kernel", c"coupled_stage_kernel", c"coupled_penalize_kernel", c"coupled_merge_kernel"], ), // 21: chain_window.ptx (claude/chain-kernels), loaded only when LELEKA_CHAIN selects a group that launches from it // (`CHAIN_ASSET`); checked against its pin (`original_verify::chain::CHAIN`) before it is handed to the driver. ( - concat!(include_str!("../chain_window.ptx"), "\0").as_bytes(), + concat!(include_str!("../../../../../../chain_window.ptx"), "\0").as_bytes(), &[ c"chain_qsa_decode_chunk", c"chain_qsa_decode_merge_n", @@ -393,7 +394,7 @@ pub(in super::super) const ASSETS: &[(&[u8], &[&CStr])] = &[ // `LELEKA_SM120_ATTN_DAILY_MTP=1` (`DAILY_ASSET`); checked against its pin (`original_verify::sm120::ATTN_DAILY`) // before it is handed to the driver. ( - concat!(include_str!("../sm120_attn_daily.ptx"), "").as_bytes(), + concat!(include_str!("../../../../../../sm120_attn_daily.ptx"), "").as_bytes(), &[c"leleka_qsa_decode_chunk_daily", c"leleka_qsa_decode_merge_v2"], ), ]; diff --git a/crates/cuda-driver/src/mtp_original_full_symbols/chain_asset_types.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_symbols/chain_asset_types.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols/chain_asset_types.rs diff --git a/crates/cuda-driver/src/mtp_original_full_forward/validate_scalar_prefix.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_forward/validate_scalar_prefix.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/validate_scalar_prefix.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_graph.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_graph.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/graph_resources_original_graph_resources.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/graph_resources_original_graph_resources.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/graph_resources_original_graph_resources.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_mapped.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/mapped_records.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_mapped.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/mapped_records.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs similarity index 65% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs index ea1666a8..637539f6 100644 --- a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill.rs @@ -12,24 +12,15 @@ use super::{ ScalarDraftKvSources, Scratch, TAIL_ENTRIES, checked, combine, mapped_records, zero_bytes, }; -#[path = "original_mtp_scalar_prefill/call_admission.rs"] mod call_admission; -#[path = "original_mtp_scalar_prefill/group_capture.rs"] mod group_capture; -#[path = "original_mtp_scalar_prefill/group_loop.rs"] mod group_loop; -#[path = "original_mtp_scalar_prefill/kernel_commands.rs"] mod kernel_commands; -#[path = "original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs"] mod original_mtp_scalar_prefill_admit_new; -#[path = "original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs"] mod original_mtp_scalar_prefill_close; -#[path = "original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs"] mod original_mtp_scalar_prefill_record_gr; -#[path = "original_mtp_scalar_prefill/record_operands.rs"] mod record_operands; -#[allow(unused_imports)] use record_operands::{ - Cap, ExternalOwners, GrRows, GroupIo, GroupSpan, PagePublication, ScalarCall, ScalarGroupSources, ScalarOperands, + Cap, ExternalOwners, GrRows, GroupSpan, PagePublication, ScalarCall, ScalarGroupSources, ScalarOperands, ScalarStaged, }; diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/call_admission.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/call_admission.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/call_admission.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/call_admission.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/group_capture.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/group_capture.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/group_capture.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/group_capture.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/group_loop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/group_loop.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/group_loop.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/group_loop.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/kernel_commands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/kernel_commands.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/kernel_commands.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/kernel_commands.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs similarity index 91% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs index 2263d6e5..ff8dede1 100644 --- a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_admit_new.rs @@ -10,12 +10,12 @@ use super::{ impl<'ctx> OriginalMtpScalarPrefill<'ctx> { pub(in super::super) fn assets_ready() -> Result<()> { let assets = [ - include_bytes!("../../mtp_original_prefill.ptx").as_slice(), - include_bytes!("../../mtp_original_prefill_embedding.ptx").as_slice(), - include_bytes!("../../mtp_original_tail.ptx").as_slice(), - include_bytes!("../../mtp_original_scalar_norm.ptx").as_slice(), - include_bytes!("../../mtp_original_scalar_gr.ptx").as_slice(), - include_bytes!("../../mtp_original_kv.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_prefill.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_prefill_embedding.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_tail.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_scalar_norm.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_scalar_gr.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_kv.ptx").as_slice(), ]; if assets.iter().any(|p| p.windows(8).any(|w| w == b"UNSEALED")) { Err(Error::UnsupportedQwenOperation) @@ -75,12 +75,12 @@ impl<'ctx> OriginalMtpScalarPrefill<'ctx> { /// The six sealed prefill assets, in module-slot order. fn scalar_assets() -> [&'static [u8]; 6] { [ - include_bytes!("../../mtp_original_prefill.ptx").as_slice(), - include_bytes!("../../mtp_original_prefill_embedding.ptx").as_slice(), - include_bytes!("../../mtp_original_tail.ptx").as_slice(), - include_bytes!("../../mtp_original_scalar_norm.ptx").as_slice(), - include_bytes!("../../mtp_original_scalar_gr.ptx").as_slice(), - include_bytes!("../../mtp_original_kv.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_prefill.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_prefill_embedding.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_tail.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_scalar_norm.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_scalar_gr.ptx").as_slice(), + include_bytes!("../../../../../mtp_original_kv.ptx").as_slice(), ] } diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_close.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/original_mtp_scalar_prefill_record_gr.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/record_operands.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/record_operands.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill/record_operands.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill/record_operands.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill_drop.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill_drop.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/original_mtp_scalar_prefill_drop.rs diff --git a/crates/cuda-driver/src/mtp_original_physical_layout.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/physical_layout.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_physical_layout.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/physical_layout.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_weights.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/retained_weights.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_weights.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/retained_weights.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_ffi.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/scalar_abi.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_ffi.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/scalar_abi.rs diff --git a/crates/cuda-driver/src/mtp_original_scalar_short_gpu.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/short_prompt_gpu.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_scalar_short_gpu.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/short_prompt_gpu.rs diff --git a/crates/cuda-driver/src/mtp_original_prefill_symbols.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/symbols.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_prefill_symbols.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/symbols.rs diff --git a/crates/cuda-driver/src/mtp_original_ring_state.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state.rs similarity index 81% rename from crates/cuda-driver/src/mtp_original_ring_state.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state.rs index a079a4c4..f0a15386 100644 --- a/crates/cuda-driver/src/mtp_original_ring_state.rs +++ b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state.rs @@ -35,15 +35,7 @@ pub(super) struct PreparedState<'ctx> { mapped: Option, } -#[path = "mtp_original_ring_state/a16.rs"] mod a16; -#[allow(unused_imports)] -use a16::a16; -#[path = "mtp_original_ring_state/cleanup_fns.rs"] mod cleanup_fns; -#[path = "mtp_original_ring_state/pin_failure.rs"] mod pin_failure; -#[path = "mtp_original_ring_state/selected.rs"] mod selected; -#[allow(unused_imports)] -pub(super) use pin_failure::pin_failure; diff --git a/crates/cuda-driver/src/mtp_original_ring_state/a16.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_ring_state/a16.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/a16.rs diff --git a/crates/cuda-driver/src/mtp_original_ring_state/cleanup_fns.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/cleanup_fns.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_ring_state/cleanup_fns.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/cleanup_fns.rs diff --git a/crates/cuda-driver/src/mtp_original_ring_state/pin_failure.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_ring_state/pin_failure.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/pin_failure.rs diff --git a/crates/cuda-driver/src/mtp_original_ring_state/selected.rs b/crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_ring_state/selected.rs rename to crates/cuda-driver/src/mtp_dense_kv/original_int8/ring_state/selected.rs diff --git a/crates/cuda-driver/src/native_head.rs b/crates/cuda-driver/src/native_head.rs index 206401a9..3e7fb2b5 100644 --- a/crates/cuda-driver/src/native_head.rs +++ b/crates/cuda-driver/src/native_head.rs @@ -1,9 +1,7 @@ //! Literal Original compressed NativeHead/NativeEmbed and verification head banks. //! These are actual numerical owners, never session or accepted-prefix certificates. -#[path = "native_head_ffi.rs"] #[allow(unsafe_code)] mod abi; -#[path = "native_head_mapped.rs"] #[allow(unsafe_code)] mod mapped; use crate::original_gpu_schedule::{OriginalCapture, OriginalGpuStream, OriginalGraphResources, resources}; @@ -15,7 +13,6 @@ use std::{ rc::Rc, }; -#[path = "mtp_original_native_embedding.rs"] pub(crate) mod mtp_embedding; pub use mtp_embedding::OriginalMtpNativeEmbedding; @@ -23,97 +20,56 @@ pub use mtp_embedding::OriginalMtpNativeEmbedding; mod alias_tests; mod native_asset; -#[allow(unused_imports)] use native_asset::address; -#[allow(unused_imports)] use native_asset::admission; -#[allow(unused_imports)] use native_asset::admit; -#[allow(unused_imports)] use native_asset::admit_history_prefix; -#[allow(unused_imports)] use native_asset::cmd; -#[allow(unused_imports)] use native_asset::disjoint; -#[allow(unused_imports)] use native_asset::geometry; -#[allow(unused_imports)] use native_asset::greedy_entry; -#[allow(unused_imports)] use native_asset::iq_asset; -#[allow(unused_imports)] use native_asset::native_asset; -#[allow(unused_imports)] pub use native_asset::native_embed_supported; -#[allow(unused_imports)] pub use native_asset::native_head_row_bytes; -#[allow(unused_imports)] pub use native_asset::native_head_supported; -#[allow(unused_imports)] use native_asset::sampler_asset; -#[allow(unused_imports)] use native_asset::transport; mod head_owned; mod projection_commands; -#[allow(unused_imports)] use projection_commands::projection_commands; mod dispatch; mod original_native_embed; mod original_native_embed_rows_original_graph; mod original_native_head_rows; mod original_native_head_rows_drop_original_graph; -#[allow(unused_imports)] use dispatch::dispatch; mod original_native_head_rows_original_native; -#[allow(unused_imports)] pub(crate) use original_native_head_rows_original_native::head_assets_sealed; mod native_asset_pin_types; -#[allow(unused_imports)] use native_asset_pin_types::EmbedOwned; -#[allow(unused_imports)] use native_asset_pin_types::HeadOwned; -#[allow(unused_imports)] use native_asset_pin_types::IQ_ASSET_PIN; -#[allow(unused_imports)] use native_asset_pin_types::Kernels; -#[allow(unused_imports)] use native_asset_pin_types::NATIVE_ASSET_PIN; -#[allow(unused_imports)] pub use native_asset_pin_types::NativeEmbedFlight; -#[allow(unused_imports)] pub use native_asset_pin_types::NativeHeadDispatch; -#[allow(unused_imports)] pub use native_asset_pin_types::NativeHeadFlight; -#[allow(unused_imports)] pub use native_asset_pin_types::NativeHeadPayload; -#[allow(unused_imports)] pub use native_asset_pin_types::NativeHeadSampling; -#[allow(unused_imports)] pub use native_asset_pin_types::NativeHeadSelection; -#[allow(unused_imports)] pub use native_asset_pin_types::OriginalNativeEmbed; -#[allow(unused_imports)] pub use native_asset_pin_types::OriginalNativeEmbedRows; -#[allow(unused_imports)] pub use native_asset_pin_types::OriginalNativeHead; -#[allow(unused_imports)] pub use native_asset_pin_types::OriginalNativeHeadRows; -#[allow(unused_imports)] use native_asset_pin_types::RESERVE; -#[allow(unused_imports)] use native_asset_pin_types::SAMPLER_ASSET_PIN; -#[allow(unused_imports)] use native_asset_pin_types::SamplingScratch; mod native_entries_types; -#[allow(unused_imports)] use native_entries_types::NATIVE_ENTRIES; mod iq_entries_types; -#[allow(unused_imports)] use iq_entries_types::IQ_ENTRIES; -#[allow(unused_imports)] pub use iq_entries_types::NativeHeadProjectionFlight; -#[allow(unused_imports)] pub use iq_entries_types::OriginalNativeHeadGraphResources; -#[allow(unused_imports)] use iq_entries_types::SAMPLER_ENTRIES; diff --git a/crates/cuda-driver/src/native_head_ffi.rs b/crates/cuda-driver/src/native_head/abi.rs similarity index 100% rename from crates/cuda-driver/src/native_head_ffi.rs rename to crates/cuda-driver/src/native_head/abi.rs diff --git a/crates/cuda-driver/src/native_head_mapped.rs b/crates/cuda-driver/src/native_head/mapped.rs similarity index 100% rename from crates/cuda-driver/src/native_head_mapped.rs rename to crates/cuda-driver/src/native_head/mapped.rs diff --git a/crates/cuda-driver/src/mtp_original_native_embedding.rs b/crates/cuda-driver/src/native_head/mtp_embedding.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_native_embedding.rs rename to crates/cuda-driver/src/native_head/mtp_embedding.rs diff --git a/crates/cuda-driver/src/native_parity.rs b/crates/cuda-driver/src/native_parity.rs index 82d48797..d3679cc3 100644 --- a/crates/cuda-driver/src/native_parity.rs +++ b/crates/cuda-driver/src/native_parity.rs @@ -78,38 +78,22 @@ const ENTRIES: &[&str] = &[ ]; mod sealed_ptx; -#[allow(unused_imports)] use sealed_ptx::address; -#[allow(unused_imports)] use sealed_ptx::bytes_f32; -#[allow(unused_imports)] use sealed_ptx::bytes_i32; -#[allow(unused_imports)] use sealed_ptx::command; -#[allow(unused_imports)] use sealed_ptx::first; -#[allow(unused_imports)] use sealed_ptx::floats; -#[allow(unused_imports)] use sealed_ptx::layout; -#[allow(unused_imports)] use sealed_ptx::message; -#[allow(unused_imports)] pub use sealed_ptx::native_parity_embed_supported; -#[allow(unused_imports)] pub use sealed_ptx::native_parity_iq_supported; -#[allow(unused_imports)] pub use sealed_ptx::native_parity_row_bytes; -#[allow(unused_imports)] use sealed_ptx::sealed_ptx; -#[allow(unused_imports)] use sealed_ptx::split; mod native_parity_expert; mod native_parity_operations; mod parity_session; -#[allow(unused_imports)] use native_parity_expert::down_entry; -#[allow(unused_imports)] use native_parity_expert::gu_entry; -#[allow(unused_imports)] use native_parity_expert::read; diff --git a/crates/cuda-driver/src/native_prompt_device.rs b/crates/cuda-driver/src/native_prompt_device.rs index ec6361ce..b770bd07 100644 --- a/crates/cuda-driver/src/native_prompt_device.rs +++ b/crates/cuda-driver/src/native_prompt_device.rs @@ -9,7 +9,6 @@ use crate::{ }; use std::ffi::CStr; const RESERVE: usize = 128 << 20; -#[path = "native_prompt_device_stage.rs"] mod stage_impl; mod stage_phases; pub use stage_impl::PromptInputStage; @@ -102,25 +101,15 @@ use crate::prefill_stage::fused_scans; mod original_device_block; mod original_ple_history; -#[allow(unused_imports)] use original_ple_history::GrNormRequest; -#[allow(unused_imports)] use original_ple_history::LaunchGeometry; -#[allow(unused_imports)] use original_ple_history::PhaseGuards; -#[allow(unused_imports)] use original_ple_history::ScanExtent; -#[allow(unused_imports)] use original_ple_history::WeightExtent; -#[allow(unused_imports)] use original_ple_history::bytes; -#[allow(unused_imports)] use original_ple_history::encode; -#[allow(unused_imports)] use original_ple_history::kernel; -#[allow(unused_imports)] use original_ple_history::scan_gr; -#[allow(unused_imports)] use original_ple_history::scan_ple; mod original_prompt_device; mod original_prompt_device_drop; diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs index 4db41df7..eb269c85 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_apply_ple.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalPromptDevice`: `apply_ple`. //! Split out of `original_prompt_device` to keep its files under the line limit. -#[allow(unused_imports)] use super::ple_apply_phases::ple_commands; use super::{ NativeBatchWorkspace, OriginalDeviceResidual, OriginalPleHistory, OriginalPromptDevice, PleClosedWeights, Result, diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs index a55af5cb..7c9c4ccb 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_gr_read_plan.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalPromptDevice`: `read_gr_impl`, `gr_read_plan`, `gr_read_spans`. //! Split out of `original_prompt_device` to keep its files under the line limit. -#[allow(unused_imports)] use super::gr_read_phases::{GR_READ_NAMES, GR_READ_ORDER, GrReadPlan}; use super::{ BufferHandle, DeviceBuffer, Error, GrNativeProfile, GrNormRequest, NativeBatchWorkspace, OriginalDeviceGrRead, diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs index 7bc4957e..5e7021da 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_initialize_rows.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalPromptDevice`: `initialize_rows`, `upload_initial`, `settle_upload`, `run`. //! Functions: `stage_rows`. -#[allow(unused_imports)] use super::run_phases::RunBuffers; use super::{ C, Error, NativeBatchWorkspace, OriginalDeviceResidual, OriginalPromptDevice, OriginalPromptRows, PhaseGuards, diff --git a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs index 8b49f5b7..8334c9d3 100644 --- a/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs +++ b/crates/cuda-driver/src/native_prompt_device/original_prompt_device/original_prompt_device_inject_gr.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalPromptDevice`: `inject_gr`, `inject_gr_fused`, `close`. //! Split out of `original_prompt_device` to keep its files under the line limit. -#[allow(unused_imports)] use super::inject_phases::{inject_commands, inject_fused_commands}; use super::{ DeviceBuffer, Error, NativeBatchWorkspace, OriginalDeviceBlock, OriginalDeviceNormedResidual, diff --git a/crates/cuda-driver/src/native_prompt_device_stage.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl.rs similarity index 97% rename from crates/cuda-driver/src/native_prompt_device_stage.rs rename to crates/cuda-driver/src/native_prompt_device/stage_impl.rs index ecdd0910..ea1298f0 100644 --- a/crates/cuda-driver/src/native_prompt_device_stage.rs +++ b/crates/cuda-driver/src/native_prompt_device/stage_impl.rs @@ -48,8 +48,6 @@ impl<'ctx> OriginalPromptDevice<'ctx> { } #[cfg(test)] -#[path = "prefill_stage_gpu.rs"] mod gpu_tests; #[cfg(test)] -#[path = "prefill_stage_gr_gpu.rs"] mod gr_gpu_tests; diff --git a/crates/cuda-driver/src/prefill_stage_gpu.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gpu_tests.rs similarity index 100% rename from crates/cuda-driver/src/prefill_stage_gpu.rs rename to crates/cuda-driver/src/native_prompt_device/stage_impl/gpu_tests.rs diff --git a/crates/cuda-driver/src/prefill_stage_gr_gpu.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests.rs similarity index 62% rename from crates/cuda-driver/src/prefill_stage_gr_gpu.rs rename to crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests.rs index 8a2edaec..0e017e52 100644 --- a/crates/cuda-driver/src/prefill_stage_gr_gpu.rs +++ b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests.rs @@ -4,29 +4,17 @@ use super::*; use crate::ple_batch_ffi::{BatchArg as A, KernelArguments, KernelModule}; -#[path = "prefill_stage_gr_gpu/rng.rs"] mod rng; -#[allow(unused_imports)] use rng::download; -#[allow(unused_imports)] use rng::f32_bytes; -#[allow(unused_imports)] use rng::h; -#[allow(unused_imports)] use rng::run_all; -#[allow(unused_imports)] use rng::upload; -#[path = "prefill_stage_gr_gpu/enable_types.rs"] mod enable_types; -#[allow(unused_imports)] use enable_types::ENABLE; -#[allow(unused_imports)] use enable_types::Launch; -#[allow(unused_imports)] use enable_types::Rng; -#[path = "prefill_stage_gr_gpu/gr_fused_guards_equal.rs"] mod gr_fused_guards_equal; -#[path = "prefill_stage_gr_gpu/gr_kernels_run_near_their.rs"] mod gr_kernels_run_near_their; diff --git a/crates/cuda-driver/src/prefill_stage_gr_gpu/enable_types.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs similarity index 100% rename from crates/cuda-driver/src/prefill_stage_gr_gpu/enable_types.rs rename to crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/enable_types.rs diff --git a/crates/cuda-driver/src/prefill_stage_gr_gpu/gr_fused_guards_equal.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/gr_fused_guards_equal.rs similarity index 100% rename from crates/cuda-driver/src/prefill_stage_gr_gpu/gr_fused_guards_equal.rs rename to crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/gr_fused_guards_equal.rs diff --git a/crates/cuda-driver/src/prefill_stage_gr_gpu/gr_kernels_run_near_their.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/gr_kernels_run_near_their.rs similarity index 100% rename from crates/cuda-driver/src/prefill_stage_gr_gpu/gr_kernels_run_near_their.rs rename to crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/gr_kernels_run_near_their.rs diff --git a/crates/cuda-driver/src/prefill_stage_gr_gpu/rng.rs b/crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs similarity index 100% rename from crates/cuda-driver/src/prefill_stage_gr_gpu/rng.rs rename to crates/cuda-driver/src/native_prompt_device/stage_impl/gr_gpu_tests/rng.rs diff --git a/crates/cuda-driver/src/original_expert_stager.rs b/crates/cuda-driver/src/original_expert_stager.rs index 2394a8af..ef7853b0 100644 --- a/crates/cuda-driver/src/original_expert_stager.rs +++ b/crates/cuda-driver/src/original_expert_stager.rs @@ -100,7 +100,6 @@ pub struct OriginalStagerCompleted<'ctx> { stream: OriginalGpuStream<'ctx>, } -#[path = "original_stream_all.rs"] mod stream_all; pub use stream_all::{ OriginalStreamAll, OriginalStreamAllCompleted, OriginalStreamAllForward, OriginalStreamAllOptions, @@ -124,14 +123,10 @@ mod tests; mod original_stager_options; mod stager_workers; #[cfg(windows)] -#[allow(unused_imports)] use stager_workers::available_memory; #[cfg(unix)] -#[allow(unused_imports)] use stager_workers::available_memory; -#[allow(unused_imports)] use stager_workers::metadata; -#[allow(unused_imports)] use stager_workers::worker; mod context; mod original_expert_stager_lifecycle; diff --git a/crates/cuda-driver/src/original_stream_all.rs b/crates/cuda-driver/src/original_expert_stager/stream_all.rs similarity index 96% rename from crates/cuda-driver/src/original_stream_all.rs rename to crates/cuda-driver/src/original_expert_stager/stream_all.rs index 01321e09..dacea8ea 100644 --- a/crates/cuda-driver/src/original_stream_all.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all.rs @@ -128,9 +128,5 @@ pub(crate) trait OriginalStreamAllGroupProducer<'ctx> { ) -> Result<()>; } -#[path = "original_stream_all/original_stream_all_options.rs"] mod original_stream_all_options; -#[allow(unused_imports)] -use original_stream_all_options::issuer_thread; -#[path = "original_stream_all/original_expert_stager.rs"] mod original_expert_stager; diff --git a/crates/cuda-driver/src/original_stream_all/original_expert_stager.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs similarity index 100% rename from crates/cuda-driver/src/original_stream_all/original_expert_stager.rs rename to crates/cuda-driver/src/original_expert_stager/stream_all/original_expert_stager.rs diff --git a/crates/cuda-driver/src/original_stream_all/original_stream_all_options.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs similarity index 76% rename from crates/cuda-driver/src/original_stream_all/original_stream_all_options.rs rename to crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs index 3f534071..19f156c8 100644 --- a/crates/cuda-driver/src/original_stream_all/original_stream_all_options.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options.rs @@ -9,13 +9,8 @@ use super::{ OriginalStreamPair, Result, SOURCE_CAP, Shared, WORKER_STACK, abi, available_memory, combine, size_of, thread, }; -#[path = "original_stream_all_options/original_stream_all_options_issuer.rs"] mod original_stream_all_options_issuer; -#[allow(unused_imports)] pub(super) use original_stream_all_options_issuer::issuer_thread; -#[path = "original_stream_all_options/original_expert_stager.rs"] mod original_expert_stager; -#[path = "original_stream_all_options/original_stream_all.rs"] mod original_stream_all; -#[path = "original_stream_all_options/stream_phases.rs"] mod stream_phases; diff --git a/crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_expert_stager.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs similarity index 98% rename from crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_expert_stager.rs rename to crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs index 950f7a9b..86bb8d03 100644 --- a/crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_expert_stager.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_expert_stager.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalExpertStager`: `run_stream_all`. //! Split out of `original_stream_all_options` to keep its files under the line limit. -#[allow(unused_imports)] use super::stream_phases::{arm_scope, finish_scope, open_scope, start_or_cleanup}; use super::{ Error, OriginalExpertStager, OriginalPromptRows, OriginalStreamAll, OriginalStreamAllCompleted, diff --git a/crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_stream_all.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs similarity index 99% rename from crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_stream_all.rs rename to crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs index dd71ca58..ef921aee 100644 --- a/crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_stream_all.rs +++ b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all.rs @@ -7,7 +7,6 @@ use super::{ thread, }; -#[path = "original_stream_all/walk.rs"] mod walk; impl OriginalStreamAll<'_, '_, '_, '_> { diff --git a/crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_stream_all/walk.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all/walk.rs similarity index 100% rename from crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_stream_all/walk.rs rename to crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all/walk.rs diff --git a/crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_stream_all_options_issuer.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs similarity index 100% rename from crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_stream_all_options_issuer.rs rename to crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/original_stream_all_options_issuer.rs diff --git a/crates/cuda-driver/src/original_stream_all/original_stream_all_options/stream_phases.rs b/crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/stream_phases.rs similarity index 100% rename from crates/cuda-driver/src/original_stream_all/original_stream_all_options/stream_phases.rs rename to crates/cuda-driver/src/original_expert_stager/stream_all/original_stream_all_options/stream_phases.rs diff --git a/crates/cuda-driver/src/original_file_expert_source.rs b/crates/cuda-driver/src/original_file_expert_source.rs index f6d78040..810a99d2 100644 --- a/crates/cuda-driver/src/original_file_expert_source.rs +++ b/crates/cuda-driver/src/original_file_expert_source.rs @@ -117,18 +117,12 @@ pub(crate) enum OriginalFileStreamSource<'source, 'ctx> { } mod original_resident_options_and_blob; -#[allow(unused_imports)] -use original_resident_options_and_blob::atoi; -#[allow(unused_imports)] use original_resident_options_and_blob::key; -#[allow(unused_imports)] use original_resident_options_and_blob::vec_filled; mod file_expert_source_swap_exchanges; mod original_file_expert_source_operations; #[cfg(windows)] -#[allow(unused_imports)] use file_expert_source_swap_exchanges::available_memory; mod available_memory; #[cfg(unix)] -#[allow(unused_imports)] use available_memory::available_memory; diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/build_phases.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/build_phases.rs index 43544c1b..173e4f61 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/build_phases.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/build_phases.rs @@ -1,6 +1,5 @@ //! STRA-338 size: the phases of `OriginalFileExpertSource::build_cache_complement`, extracted in call order. -#[allow(unused_imports)] use super::fill_workers::{run_fill_workers, straddling_cut}; use super::{ Context, EXPERTS, Error, GIB, LAYERS, META_CAP, N, NONE, OriginalExpertCache, OriginalFileExpertSource, diff --git a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs index a5ae47f1..c5e5b0c1 100644 --- a/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs +++ b/crates/cuda-driver/src/original_file_expert_source/original_file_expert_source_operations/file_expert_source_cache_complement.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalFileExpertSource`: `build_cache_complement`. //! Split out of `original_file_expert_source_methods` to keep its files under the line limit. -#[allow(unused_imports)] use super::build_phases::{ArenaFillPlan, alloc_failed, discard_arena, leak_arena, poison_parts}; use super::{Error, OriginalExpertCache, OriginalFileExpertSource, OriginalResidentOptions, Result, combine}; diff --git a/crates/cuda-driver/src/original_gpu_schedule.rs b/crates/cuda-driver/src/original_gpu_schedule.rs index b931580a..59eb4e86 100644 --- a/crates/cuda-driver/src/original_gpu_schedule.rs +++ b/crates/cuda-driver/src/original_gpu_schedule.rs @@ -1,7 +1,6 @@ //! Original CUDA scheduling owners. Capture resources are real owned/borrowed //! producers, retained through every replay and through uncertain retirement. //! No public raw stream, graph, event, kernel address or readiness constructor. -#[path = "original_gpu_schedule_ffi.rs"] mod abi; use crate::{Context, Error, Result, combine}; use std::{ @@ -47,7 +46,6 @@ pub trait OriginalGraphResources: resources::Sealed { } } -#[path = "mtp_original_full_graph.rs"] mod mtp_full_graph; /// `CUDA_ERROR_OUT_OF_MEMORY` of the driver API. Not sticky: the context is intact after it. const CUDA_ERROR_OUT_OF_MEMORY: i32 = 2; @@ -148,11 +146,9 @@ pub struct OriginalGraphRegistry<'ctx, R: OriginalGraphResources> { } #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "original_gpu_head_bridge.rs"] mod native_head_bridge; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "original_gpu_verify_bridge.rs"] mod verifier_bridge; /// Operator timing of `capture_owned` (host ms spent capturing, then instantiating + uploading), summed per thread @@ -212,29 +208,19 @@ mod oom_tests { } mod transport; -#[allow(unused_imports)] use transport::call; -#[allow(unused_imports)] use transport::call_unless; -#[allow(unused_imports)] use transport::healthy; -#[allow(unused_imports)] use transport::injected_window_oom; -#[allow(unused_imports)] pub(crate) use transport::is_graph_out_of_memory; -#[allow(unused_imports)] use transport::poison; -#[allow(unused_imports)] +#[cfg(test)] use transport::poisons; -#[allow(unused_imports)] use transport::transport; mod original_gpu_stream; mod set_side_streams_wanted; -#[allow(unused_imports)] use set_side_streams_wanted::drop_side; -#[allow(unused_imports)] use set_side_streams_wanted::make_side; -#[allow(unused_imports)] pub(crate) use set_side_streams_wanted::set_side_streams_wanted; mod original_gpu_graph; mod original_graph_key; diff --git a/crates/cuda-driver/src/original_gpu_schedule_ffi.rs b/crates/cuda-driver/src/original_gpu_schedule/abi.rs similarity index 85% rename from crates/cuda-driver/src/original_gpu_schedule_ffi.rs rename to crates/cuda-driver/src/original_gpu_schedule/abi.rs index 58653c56..854dfbd9 100644 --- a/crates/cuda-driver/src/original_gpu_schedule_ffi.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi.rs @@ -1,7 +1,6 @@ //! Private CUDA Driver ABI, matching Original runtime stream/event/graph calls. use crate::{Error, Result}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "original_gpu_schedule_ffi/platform.rs"] mod platform; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] pub(crate) use platform::Api; @@ -12,5 +11,4 @@ pub(crate) use platform::Api; )))] pub(crate) struct Api; -#[path = "original_gpu_schedule_ffi/api.rs"] mod api; diff --git a/crates/cuda-driver/src/original_gpu_schedule_ffi/api.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/api.rs similarity index 100% rename from crates/cuda-driver/src/original_gpu_schedule_ffi/api.rs rename to crates/cuda-driver/src/original_gpu_schedule/abi/api.rs diff --git a/crates/cuda-driver/src/original_gpu_schedule_ffi/platform.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs similarity index 93% rename from crates/cuda-driver/src/original_gpu_schedule_ffi/platform.rs rename to crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs index 2bf1ff75..3c773a2b 100644 --- a/crates/cuda-driver/src/original_gpu_schedule_ffi/platform.rs +++ b/crates/cuda-driver/src/original_gpu_schedule/abi/platform.rs @@ -72,19 +72,12 @@ pub(crate) struct Api { write_refused: std::sync::atomic::AtomicBool, } -#[path = "platform/library_drop.rs"] mod library_drop; #[cfg(target_os = "linux")] -#[allow(unused_imports)] use library_drop::callback_warmup_enabled; -#[allow(unused_imports)] use library_drop::check; #[cfg(target_os = "linux")] -#[allow(unused_imports)] use library_drop::noop_host_fn; -#[allow(unused_imports)] use library_drop::raise_after_copies; -#[path = "platform/api.rs"] mod api; -#[path = "platform/async_copies_and_flag_writes.rs"] mod async_copies_and_flag_writes; diff --git a/crates/cuda-driver/src/original_gpu_schedule_ffi/platform/api.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs similarity index 100% rename from crates/cuda-driver/src/original_gpu_schedule_ffi/platform/api.rs rename to crates/cuda-driver/src/original_gpu_schedule/abi/platform/api.rs diff --git a/crates/cuda-driver/src/original_gpu_schedule_ffi/platform/async_copies_and_flag_writes.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs similarity index 100% rename from crates/cuda-driver/src/original_gpu_schedule_ffi/platform/async_copies_and_flag_writes.rs rename to crates/cuda-driver/src/original_gpu_schedule/abi/platform/async_copies_and_flag_writes.rs diff --git a/crates/cuda-driver/src/original_gpu_schedule_ffi/platform/library_drop.rs b/crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs similarity index 100% rename from crates/cuda-driver/src/original_gpu_schedule_ffi/platform/library_drop.rs rename to crates/cuda-driver/src/original_gpu_schedule/abi/platform/library_drop.rs diff --git a/crates/cuda-driver/src/mtp_original_full_graph.rs b/crates/cuda-driver/src/original_gpu_schedule/mtp_full_graph.rs similarity index 100% rename from crates/cuda-driver/src/mtp_original_full_graph.rs rename to crates/cuda-driver/src/original_gpu_schedule/mtp_full_graph.rs diff --git a/crates/cuda-driver/src/original_gpu_head_bridge.rs b/crates/cuda-driver/src/original_gpu_schedule/native_head_bridge.rs similarity index 100% rename from crates/cuda-driver/src/original_gpu_head_bridge.rs rename to crates/cuda-driver/src/original_gpu_schedule/native_head_bridge.rs diff --git a/crates/cuda-driver/src/original_gpu_verify_bridge.rs b/crates/cuda-driver/src/original_gpu_schedule/verifier_bridge.rs similarity index 100% rename from crates/cuda-driver/src/original_gpu_verify_bridge.rs rename to crates/cuda-driver/src/original_gpu_schedule/verifier_bridge.rs diff --git a/crates/cuda-driver/src/original_moe_prompt_device.rs b/crates/cuda-driver/src/original_moe_prompt_device.rs index 09a5c02e..710f87c2 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device.rs @@ -128,17 +128,11 @@ struct GemmSize { } mod blank; -#[allow(unused_imports)] use blank::blank; -#[allow(unused_imports)] use blank::common; -#[allow(unused_imports)] use blank::dequant_index; -#[allow(unused_imports)] use blank::gemm; -#[allow(unused_imports)] use blank::kernel; -#[allow(unused_imports)] use blank::phase; mod original_moe_prompt_device_drop; mod original_moe_prompt_device_operations; diff --git a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs index a76deaae..0b1cd43b 100644 --- a/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs +++ b/crates/cuda-driver/src/original_moe_prompt_device/original_moe_prompt_device_operations/original_moe_prompt_device_prepare.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalMoePromptDevice`: `prepare`, `close`. //! Split out of `original_moe_prompt_device_methods` to keep its files under the line limit. -#[allow(unused_imports)] use super::prepare_phases::{MOE_NAMES, route_plan}; use super::{ DeviceBuffer, Error, NativeBatchWorkspace, OriginalDeviceGrRead, OriginalMoePromptDevice, OriginalMoePromptLayer, diff --git a/crates/cuda-driver/src/original_mtp_actor.rs b/crates/cuda-driver/src/original_mtp_actor.rs index 28f5c61e..46d2e892 100644 --- a/crates/cuda-driver/src/original_mtp_actor.rs +++ b/crates/cuda-driver/src/original_mtp_actor.rs @@ -22,7 +22,6 @@ //! state. This is not a numerical, serving or device-completion certificate. #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "original_mtp_actor_loaded.rs"] mod loaded; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] pub use loaded::{OriginalMtpActor, OriginalMtpLoadEvidence, OriginalMtpLoadMeter, OriginalMtpLoadedParts}; diff --git a/crates/cuda-driver/src/original_mtp_actor_loaded.rs b/crates/cuda-driver/src/original_mtp_actor/loaded.rs similarity index 93% rename from crates/cuda-driver/src/original_mtp_actor_loaded.rs rename to crates/cuda-driver/src/original_mtp_actor/loaded.rs index 8c071127..193eb754 100644 --- a/crates/cuda-driver/src/original_mtp_actor_loaded.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded.rs @@ -75,13 +75,8 @@ pub struct OriginalMtpActor<'ctx> { draft_vocabulary: Option, } -#[path = "original_mtp_actor_loaded/inconsistent.rs"] mod inconsistent; -#[allow(unused_imports)] use inconsistent::inconsistent; -#[allow(unused_imports)] use inconsistent::mismatch; -#[path = "original_mtp_actor_loaded/original_mtp_actor.rs"] mod original_mtp_actor; -#[path = "original_mtp_actor_loaded/original_mtp_actor_drop.rs"] mod original_mtp_actor_drop; diff --git a/crates/cuda-driver/src/original_mtp_actor_loaded/inconsistent.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs similarity index 100% rename from crates/cuda-driver/src/original_mtp_actor_loaded/inconsistent.rs rename to crates/cuda-driver/src/original_mtp_actor/loaded/inconsistent.rs diff --git a/crates/cuda-driver/src/original_mtp_actor_loaded/original_mtp_actor.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs similarity index 87% rename from crates/cuda-driver/src/original_mtp_actor_loaded/original_mtp_actor.rs rename to crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs index 9e19983b..5b811546 100644 --- a/crates/cuda-driver/src/original_mtp_actor_loaded/original_mtp_actor.rs +++ b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor.rs @@ -10,7 +10,5 @@ use super::{ setup_disposition, }; -#[path = "original_mtp_actor/draft_rounds.rs"] mod draft_rounds; -#[path = "original_mtp_actor/original_mtp_actor_adopt_loaded.rs"] mod original_mtp_actor_adopt_loaded; diff --git a/crates/cuda-driver/src/original_mtp_actor_loaded/original_mtp_actor/draft_rounds.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/draft_rounds.rs similarity index 100% rename from crates/cuda-driver/src/original_mtp_actor_loaded/original_mtp_actor/draft_rounds.rs rename to crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/draft_rounds.rs diff --git a/crates/cuda-driver/src/original_mtp_actor_loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs similarity index 100% rename from crates/cuda-driver/src/original_mtp_actor_loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs rename to crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor/original_mtp_actor_adopt_loaded.rs diff --git a/crates/cuda-driver/src/original_mtp_actor_loaded/original_mtp_actor_drop.rs b/crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs similarity index 100% rename from crates/cuda-driver/src/original_mtp_actor_loaded/original_mtp_actor_drop.rs rename to crates/cuda-driver/src/original_mtp_actor/loaded/original_mtp_actor_drop.rs diff --git a/crates/cuda-driver/src/original_mtp_bank.rs b/crates/cuda-driver/src/original_mtp_bank.rs index 68178e74..aea028e7 100644 --- a/crates/cuda-driver/src/original_mtp_bank.rs +++ b/crates/cuda-driver/src/original_mtp_bank.rs @@ -305,5 +305,4 @@ pub fn original_mtp_draft_vocab_bytes(directory: &Path) -> Option { } #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "original_mtp_bank_gpu.rs"] mod gpu_tests; diff --git a/crates/cuda-driver/src/original_mtp_bank_gpu.rs b/crates/cuda-driver/src/original_mtp_bank/gpu_tests.rs similarity index 99% rename from crates/cuda-driver/src/original_mtp_bank_gpu.rs rename to crates/cuda-driver/src/original_mtp_bank/gpu_tests.rs index 14708338..8bd7840e 100644 --- a/crates/cuda-driver/src/original_mtp_bank_gpu.rs +++ b/crates/cuda-driver/src/original_mtp_bank/gpu_tests.rs @@ -117,7 +117,7 @@ fn bank_budget_refusal(tight: &Context<'_>, dir: &TempDir, experts: &[u8]) { #[test] #[ignore = "Root-only: needs a CUDA device"] fn draft_head_gather_matches_a_host_gather_for_each_kernel_width() { - use crate::original_mtp_coupled::subset_inverse; + assert_eq!(std::env::var(ENABLE).ok().as_deref(), Some("yes")); let driver = Driver::load().expect("driver"); let device = driver.device(0).expect("device"); diff --git a/crates/cuda-driver/src/original_mtp_rt.rs b/crates/cuda-driver/src/original_mtp_rt.rs index 32918425..d0ac9d04 100644 --- a/crates/cuda-driver/src/original_mtp_rt.rs +++ b/crates/cuda-driver/src/original_mtp_rt.rs @@ -201,39 +201,21 @@ pub(crate) mod fixtures { mod tests; mod rt_error; -#[allow(unused_imports)] -use rt_error::digits; -#[allow(unused_imports)] use rt_error::open_regular; -#[allow(unused_imports)] use rt_error::zeroed; mod read_index; -#[allow(unused_imports)] pub(crate) use read_index::draft_vocab_path; -#[allow(unused_imports)] pub(crate) use read_index::expert_bank_bytes; -#[allow(unused_imports)] pub(crate) use read_index::expert_scales_finite; -#[allow(unused_imports)] -use read_index::observed_default_bytes; -#[allow(unused_imports)] pub(crate) use read_index::observed_draft_vocab_bytes; -#[allow(unused_imports)] +#[cfg(test)] pub(crate) use read_index::observed_draft_vocab_bytes_with; -#[allow(unused_imports)] -use read_index::read_default_draft_vocab; -#[allow(unused_imports)] pub(crate) use read_index::read_dense; -#[allow(unused_imports)] pub(crate) use read_index::read_draft_vocab; #[cfg(test)] -#[allow(unused_imports)] pub(crate) use read_index::read_draft_vocab_with; -#[allow(unused_imports)] pub(crate) use read_index::read_index; -#[allow(unused_imports)] +#[cfg(test)] pub(crate) use read_index::read_selected_draft_vocab; -#[allow(unused_imports)] pub(crate) use read_index::stream_experts; -#[allow(unused_imports)] pub(crate) use read_index::validate_subset; diff --git a/crates/cuda-driver/src/original_mtp_rt/tests.rs b/crates/cuda-driver/src/original_mtp_rt/tests.rs index c4eba4d3..012e1b49 100644 --- a/crates/cuda-driver/src/original_mtp_rt/tests.rs +++ b/crates/cuda-driver/src/original_mtp_rt/tests.rs @@ -15,7 +15,5 @@ const REQUIRED: &[&str] = &[ "mlp.shared_expert.down_proj.weight", ]; -#[path = "tests/expert_stream_error_paths_use.rs"] mod expert_stream_error_paths_use; -#[path = "tests/parses_getline_loop_and_skips.rs"] mod parses_getline_loop_and_skips; diff --git a/crates/cuda-driver/src/original_mtp_rt/tests/expert_stream_error_paths_use.rs b/crates/cuda-driver/src/original_mtp_rt/tests/expert_stream_error_paths_use.rs index b1d86f97..54ceaa66 100644 --- a/crates/cuda-driver/src/original_mtp_rt/tests/expert_stream_error_paths_use.rs +++ b/crates/cuda-driver/src/original_mtp_rt/tests/expert_stream_error_paths_use.rs @@ -2,7 +2,6 @@ //! expert_stream_error_paths_use_original_order_and_text, expert_scale_scan_handles_chunk_boundaries_inside_blobs, //! draft_vocab_follows_the_original_size_filter. -#[allow(unused_imports)] use super::*; #[test] diff --git a/crates/cuda-driver/src/original_mtp_rt/tests/parses_getline_loop_and_skips.rs b/crates/cuda-driver/src/original_mtp_rt/tests/parses_getline_loop_and_skips.rs index e5c824ff..ab8cbdac 100644 --- a/crates/cuda-driver/src/original_mtp_rt/tests/parses_getline_loop_and_skips.rs +++ b/crates/cuda-driver/src/original_mtp_rt/tests/parses_getline_loop_and_skips.rs @@ -2,7 +2,6 @@ //! malformed_index_lines_carry_the_original_message, extent_validation_is_exact_and_bounded, //! required_names_are_checked_in_source_order_by_kind .... -#[allow(unused_imports)] use super::*; #[test] diff --git a/crates/cuda-driver/src/original_sampler.rs b/crates/cuda-driver/src/original_sampler.rs index c5c862bf..a7ac4b0f 100644 --- a/crates/cuda-driver/src/original_sampler.rs +++ b/crates/cuda-driver/src/original_sampler.rs @@ -74,9 +74,7 @@ pub struct OriginalSampler<'ctx> { } mod asset; -#[allow(unused_imports)] use asset::asset; mod original_sampler_drop; mod original_sampler_operations; -#[allow(unused_imports)] pub(crate) use original_sampler_drop::sampler_asset_sealed; diff --git a/crates/cuda-driver/src/original_session_state.rs b/crates/cuda-driver/src/original_session_state.rs index ca919f25..5847168a 100644 --- a/crates/cuda-driver/src/original_session_state.rs +++ b/crates/cuda-driver/src/original_session_state.rs @@ -2,18 +2,12 @@ //! Carved spans are offsets in one retained ACTUAL whole arena, never device //! allocations, initialized QSA products, current-row or session certificates. //! Root must supply the actual QSA mapped-staging/table-builder/registry adapters. -#[path = "original_session_rope.rs"] mod rope; -pub(crate) use rope::{OriginalRopeScaling, OriginalRopeScalingType, OriginalRopeTable, OriginalRopeUpload}; +pub(crate) use rope::{OriginalRopeScaling, OriginalRopeTable}; #[allow(dead_code)] -#[path = "original_conversation_state.rs"] mod conversation; -#[path = "original_session_qsa_init.rs"] mod qsa_init; use crate::{Context, DeviceBuffer, Error, Result, combine}; -#[allow(unused_imports)] -pub(crate) use conversation::OriginalConversationAccess; -#[allow(unused_imports)] pub use conversation::{ OriginalGeometryFacts, OriginalHostKv, OriginalIdxKind, OriginalKvLayer, OriginalKvPool, OriginalQsaFacts, OriginalRegion, OriginalSessionBytes, OriginalSessionControl, OriginalSessionFacts, @@ -160,27 +154,15 @@ pub(crate) struct OriginalSessionState<'ctx> { } mod add; -#[allow(unused_imports)] use add::add; -#[allow(unused_imports)] use add::align; -#[allow(unused_imports)] use add::mul; -#[allow(unused_imports)] use add::parts; -#[allow(unused_imports)] use add::product; -#[allow(unused_imports)] -use add::q8k; -#[allow(unused_imports)] use add::sum; -#[allow(unused_imports)] use add::sum16; mod qsa_price; -#[allow(unused_imports)] use qsa_price::qsa_carve; -#[allow(unused_imports)] use qsa_price::qsa_price; -#[allow(unused_imports)] pub(crate) use qsa_price::session_bytes; mod original_session_layout; diff --git a/crates/cuda-driver/src/original_conversation_state.rs b/crates/cuda-driver/src/original_session_state/conversation.rs similarity index 99% rename from crates/cuda-driver/src/original_conversation_state.rs rename to crates/cuda-driver/src/original_session_state/conversation.rs index a8a74a08..4cd952f5 100644 --- a/crates/cuda-driver/src/original_conversation_state.rs +++ b/crates/cuda-driver/src/original_session_state/conversation.rs @@ -392,5 +392,5 @@ impl<'ctx> OriginalSessionState<'ctx> { } #[cfg(test)] -#[path = "original_conversation_state/tests.rs"] +#[path = "../original_conversation_state/tests.rs"] mod tests; diff --git a/crates/cuda-driver/src/original_session_qsa_init.rs b/crates/cuda-driver/src/original_session_state/qsa_init.rs similarity index 100% rename from crates/cuda-driver/src/original_session_qsa_init.rs rename to crates/cuda-driver/src/original_session_state/qsa_init.rs diff --git a/crates/cuda-driver/src/original_session_rope.rs b/crates/cuda-driver/src/original_session_state/rope.rs similarity index 100% rename from crates/cuda-driver/src/original_session_rope.rs rename to crates/cuda-driver/src/original_session_state/rope.rs diff --git a/crates/cuda-driver/src/original_verify.rs b/crates/cuda-driver/src/original_verify.rs index 90baea3b..11dcbe6b 100644 --- a/crates/cuda-driver/src/original_verify.rs +++ b/crates/cuda-driver/src/original_verify.rs @@ -1,54 +1,32 @@ //! Original Verifier physical arena, retained GDN operands and accepted-prefix //! commit. Numerical owners only: the runtime must bind genuine current session //! lineage before each window and publication. No prompt-GEMM fallback. -#[path = "original_verify_ffi.rs"] #[allow(unsafe_code)] pub(crate) mod abi; -#[path = "original_verify_window_chain.rs"] pub(crate) mod chain; -#[path = "original_verify_diag.rs"] #[allow(unsafe_code)] mod diag; -#[path = "original_verify/original_verify_window_combine_head.rs"] pub(crate) mod combine_head; -#[path = "original_verify/original_verify_window_down.rs"] pub(crate) mod down; -#[path = "original_verify_window_draft.rs"] pub(crate) mod draft; -#[path = "original_verify/original_verify_window_ffn.rs"] pub(crate) mod ffn; pub(crate) mod finite_verdict; -#[path = "original_verify/original_verify_window_gdn_fused.rs"] pub(crate) mod gdn_fused; -#[path = "original_verify_window_gr.rs"] pub(crate) mod gr; -#[path = "original_verify_window_kernels.rs"] pub(crate) mod kernels; -#[path = "original_verify_layout.rs"] mod layout; -#[path = "original_verify_logits.rs"] mod logits; -#[path = "original_verify_mapped.rs"] #[allow(unsafe_code)] mod mapped; -#[path = "original_verify_window_moe.rs"] pub(crate) mod moe; -#[path = "original_verify_window_planner.rs"] pub(crate) mod planner; -#[path = "original_verify_profile.rs"] mod profile; -#[path = "original_verify_window_proj.rs"] pub(crate) mod proj; -#[path = "original_verify_window_qsa.rs"] pub(crate) mod qsa; -#[path = "original_verify_window_sm120.rs"] pub(crate) mod sm120; #[cfg(test)] -#[path = "original_verify_window_gpu.rs"] mod window_gpu; -#[path = "original_verify_window_plan.rs"] pub(crate) mod window_plan; -#[path = "original_verify_window_record.rs"] pub(crate) mod window_record; use crate::original_gpu_schedule::{OriginalCapture, OriginalGraphResources, resources}; use crate::{Context, DeviceBuffer, DeviceRef, Error, Result, combine}; @@ -219,15 +197,12 @@ pub struct OriginalVerifyResources<'ctx> { qsa: Rc>, head: crate::OriginalNativeHeadRows<'ctx>, } -#[path = "original_verify_gpu_plan.rs"] mod gpu_plan; -#[path = "original_verify_schedule.rs"] mod schedule; pub use gpu_plan::{MAX_PCIE_FETCHES, OriginalVerifyGpuPlan, OriginalVerifyPcieSource}; #[cfg(any(test, feature = "expert-tier-probe"))] -#[path = "original_verify_expert_probe.rs"] mod expert_probe; -#[cfg(any(test, feature = "expert-tier-probe"))] +#[cfg(feature = "expert-tier-probe")] pub use expert_probe::{OriginalExpertTierProbe, expert_probe_geometry}; pub use schedule::{ OriginalVerifier, OriginalVerifyCpuRows, OriginalVerifyCpuSink, OriginalVerifyWindowResult, @@ -236,7 +211,6 @@ pub use schedule::{ mod original_verify_rearm; pub use original_verify_rearm::OriginalVerifyRearm; use original_verify_rearm::StagedWindow; -#[path = "original_verify_window_ops.rs"] mod window_ops; pub use gr::{ HcHalfBuffers, HcLayerBuffers, HcOutputBuffers, OriginalVerifyGrBinding, PLE_SCRATCH_BYTES, PleBuffers, @@ -257,30 +231,15 @@ pub use window_plan::{PlanLayout, WINDOW_LAYERS}; pub use window_record::{ExpertTier, HcHalf, Projection, QuantSource, Rows, WindowOps, WindowPolicy, record_window}; mod share_window_modules; -#[allow(unused_imports)] -use share_window_modules::admission; -#[allow(unused_imports)] use share_window_modules::admit; -#[allow(unused_imports)] use share_window_modules::check_canonical_lengths; -#[allow(unused_imports)] use share_window_modules::check_commands; -#[allow(unused_imports)] use share_window_modules::command; -#[allow(unused_imports)] pub(crate) use share_window_modules::gather_rows_module; -#[allow(unused_imports)] use share_window_modules::handle; -#[allow(unused_imports)] use share_window_modules::poison; -#[allow(unused_imports)] use share_window_modules::sealed_asset; -#[allow(unused_imports)] -use share_window_modules::share_window_modules; -#[allow(unused_imports)] use share_window_modules::transport; -#[allow(unused_imports)] use share_window_modules::zero; mod original_verify_gdn_journal; -#[allow(unused_imports)] pub(crate) use original_verify_gdn_journal::verify_assets_sealed; diff --git a/crates/cuda-driver/src/original_verify_ffi.rs b/crates/cuda-driver/src/original_verify/abi.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_ffi.rs rename to crates/cuda-driver/src/original_verify/abi.rs diff --git a/crates/cuda-driver/src/original_verify_window_chain.rs b/crates/cuda-driver/src/original_verify/chain.rs similarity index 96% rename from crates/cuda-driver/src/original_verify_window_chain.rs rename to crates/cuda-driver/src/original_verify/chain.rs index f7dc86ff..761dca95 100644 --- a/crates/cuda-driver/src/original_verify_window_chain.rs +++ b/crates/cuda-driver/src/original_verify/chain.rs @@ -39,7 +39,7 @@ pub(crate) const E_QSA_MERGE_N: &str = "chain_qsa_decode_merge_n"; /// Sealed by `scripts/gpu-bringup/seal_pins.py` (extra-seal-plan.json, group chain-window). pub(crate) static CHAIN: AssetSpec = AssetSpec { name: "chain_window.ptx", - ptx: concat!(include_str!("chain_window.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../chain_window.ptx"), "\0").as_bytes(), sha: [ 163, 171, 220, 65, 134, 182, 109, 81, 168, 12, 142, 245, 47, 99, 111, 24, 147, 162, 19, 107, 136, 124, 214, 84, 135, 134, 254, 162, 121, 239, 113, 186, @@ -283,16 +283,16 @@ mod tests { #[test] fn the_swiglu_quant_fusion_divides_like_the_pair_it_replaces() { parity_of( - include_str!("chain_window.ptx"), - &String::from_utf8_lossy(include_bytes!("mtp_original_full_head_iq.ptx")), + include_str!("../chain_window.ptx"), + &String::from_utf8_lossy(include_bytes!("../mtp_original_full_head_iq.ptx")), ); } #[test] fn the_swiglu_quant_fusion_divides_like_the_pair_it_replaces_on_the_sm86_seal() { parity_of( - include_str!("../ptx-sm86/chain_window.ptx"), - &String::from_utf8_lossy(include_bytes!("../ptx-sm86/mtp_original_full_head_iq.ptx")), + include_str!("../../ptx-sm86/chain_window.ptx"), + &String::from_utf8_lossy(include_bytes!("../../ptx-sm86/mtp_original_full_head_iq.ptx")), ); } @@ -301,12 +301,12 @@ mod tests { // the fast-math quantizer copy (native_head_iq, `--use_fast_math`) is a different flavour: this check must // tell them apart let fast = numeric_ops(entry_body( - &String::from_utf8_lossy(include_bytes!("native_head_iq.ptx")), + &String::from_utf8_lossy(include_bytes!("../native_head_iq.ptx")), "quantize_q8_1_kernel", )); assert!(fast.contains_key("div.approx.ftz.f32"), "{fast:?}"); let precise = numeric_ops(entry_body( - &String::from_utf8_lossy(include_bytes!("mtp_original_full_head_iq.ptx")), + &String::from_utf8_lossy(include_bytes!("../mtp_original_full_head_iq.ptx")), "quantize_q8_1_kernel", )); assert!(precise.contains_key("div.rn.f32") && !precise.contains_key("div.approx.ftz.f32")); diff --git a/crates/cuda-driver/src/original_verify/original_verify_window_combine_head.rs b/crates/cuda-driver/src/original_verify/combine_head.rs similarity index 100% rename from crates/cuda-driver/src/original_verify/original_verify_window_combine_head.rs rename to crates/cuda-driver/src/original_verify/combine_head.rs diff --git a/crates/cuda-driver/src/original_verify_diag.rs b/crates/cuda-driver/src/original_verify/diag.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_diag.rs rename to crates/cuda-driver/src/original_verify/diag.rs diff --git a/crates/cuda-driver/src/original_verify/original_verify_window_down.rs b/crates/cuda-driver/src/original_verify/down.rs similarity index 100% rename from crates/cuda-driver/src/original_verify/original_verify_window_down.rs rename to crates/cuda-driver/src/original_verify/down.rs diff --git a/crates/cuda-driver/src/original_verify_window_draft.rs b/crates/cuda-driver/src/original_verify/draft.rs similarity index 95% rename from crates/cuda-driver/src/original_verify_window_draft.rs rename to crates/cuda-driver/src/original_verify/draft.rs index 33f3477f..d4cb66f8 100644 --- a/crates/cuda-driver/src/original_verify_window_draft.rs +++ b/crates/cuda-driver/src/original_verify/draft.rs @@ -15,7 +15,7 @@ pub(crate) const E_QSA: &str = "draft_commit_qsa_layers"; /// group draft-round). pub(crate) static DRAFT_COMMIT: AssetSpec = AssetSpec { name: "draft_commit.ptx", - ptx: concat!(include_str!("draft_commit.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../draft_commit.ptx"), "\0").as_bytes(), sha: [ 42, 84, 134, 220, 68, 111, 65, 245, 130, 212, 5, 3, 242, 10, 36, 211, 62, 194, 218, 187, 182, 163, 8, 18, 113, 83, 194, 204, 47, 192, 99, 150, @@ -27,7 +27,7 @@ pub(crate) static DRAFT_COMMIT: AssetSpec = AssetSpec { /// `draft_commit_qsa.cu` (QSA layers, fast math like the Original's `original_verify_qsa.ptx`), sealed the same way. pub(crate) static DRAFT_COMMIT_QSA: AssetSpec = AssetSpec { name: "draft_commit_qsa.ptx", - ptx: concat!(include_str!("draft_commit_qsa.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../draft_commit_qsa.ptx"), "\0").as_bytes(), sha: [ 223, 201, 194, 216, 75, 207, 191, 33, 97, 151, 192, 218, 191, 162, 203, 165, 182, 75, 182, 169, 170, 199, 204, 83, 70, 33, 188, 104, 184, 119, 48, 157, diff --git a/crates/cuda-driver/src/original_verify_expert_probe.rs b/crates/cuda-driver/src/original_verify/expert_probe.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_expert_probe.rs rename to crates/cuda-driver/src/original_verify/expert_probe.rs diff --git a/crates/cuda-driver/src/original_verify/original_verify_window_ffn.rs b/crates/cuda-driver/src/original_verify/ffn.rs similarity index 100% rename from crates/cuda-driver/src/original_verify/original_verify_window_ffn.rs rename to crates/cuda-driver/src/original_verify/ffn.rs diff --git a/crates/cuda-driver/src/original_verify/original_verify_window_gdn_fused.rs b/crates/cuda-driver/src/original_verify/gdn_fused.rs similarity index 100% rename from crates/cuda-driver/src/original_verify/original_verify_window_gdn_fused.rs rename to crates/cuda-driver/src/original_verify/gdn_fused.rs diff --git a/crates/cuda-driver/src/original_verify_gpu_plan.rs b/crates/cuda-driver/src/original_verify/gpu_plan.rs similarity index 86% rename from crates/cuda-driver/src/original_verify_gpu_plan.rs rename to crates/cuda-driver/src/original_verify/gpu_plan.rs index c2877be5..62a44d32 100644 --- a/crates/cuda-driver/src/original_verify_gpu_plan.rs +++ b/crates/cuda-driver/src/original_verify/gpu_plan.rs @@ -45,28 +45,19 @@ pub struct OriginalVerifyPcieSource<'s, 'ctx> { any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" ))] -#[path = "original_pcie_copy_gpu_smoke.rs"] mod pcie_copy_smoke; #[cfg(test)] -#[path = "original_verify_gpu_plan/tests.rs"] +#[path = "../original_verify_gpu_plan/tests.rs"] mod tests; -#[path = "original_verify_gpu_plan/original_verify_gpu_plan_encoding.rs"] mod original_verify_gpu_plan_encoding; -#[allow(unused_imports)] use original_verify_gpu_plan_encoding::span_layer; -#[allow(unused_imports)] pub(crate) use original_verify_gpu_plan_encoding::{PlanEntryShape, encode_plan_block}; -#[path = "original_verify_gpu_plan/cpu_sink_publish_gpu_plan.rs"] mod cpu_sink_publish_gpu_plan; -#[path = "original_verify_gpu_plan/plan_phases.rs"] mod plan_phases; -#[path = "original_verify_gpu_plan/plan_tier_tally.rs"] mod plan_tier_tally; -#[allow(unused_imports)] +#[cfg(test)] pub(crate) use cpu_sink_publish_gpu_plan::dma_options; -#[path = "original_verify_gpu_plan/dma_options_for.rs"] mod dma_options_for; -#[allow(unused_imports)] use dma_options_for::dma_options_for; diff --git a/crates/cuda-driver/src/original_verify_gpu_plan/cpu_sink_publish_gpu_plan.rs b/crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_gpu_plan/cpu_sink_publish_gpu_plan.rs rename to crates/cuda-driver/src/original_verify/gpu_plan/cpu_sink_publish_gpu_plan.rs diff --git a/crates/cuda-driver/src/original_verify_gpu_plan/dma_options_for.rs b/crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_gpu_plan/dma_options_for.rs rename to crates/cuda-driver/src/original_verify/gpu_plan/dma_options_for.rs diff --git a/crates/cuda-driver/src/original_verify_gpu_plan/original_verify_gpu_plan_encoding.rs b/crates/cuda-driver/src/original_verify/gpu_plan/original_verify_gpu_plan_encoding.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_gpu_plan/original_verify_gpu_plan_encoding.rs rename to crates/cuda-driver/src/original_verify/gpu_plan/original_verify_gpu_plan_encoding.rs diff --git a/crates/cuda-driver/src/original_pcie_copy_gpu_smoke.rs b/crates/cuda-driver/src/original_verify/gpu_plan/pcie_copy_smoke.rs similarity index 100% rename from crates/cuda-driver/src/original_pcie_copy_gpu_smoke.rs rename to crates/cuda-driver/src/original_verify/gpu_plan/pcie_copy_smoke.rs diff --git a/crates/cuda-driver/src/original_verify_gpu_plan/plan_phases.rs b/crates/cuda-driver/src/original_verify/gpu_plan/plan_phases.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_gpu_plan/plan_phases.rs rename to crates/cuda-driver/src/original_verify/gpu_plan/plan_phases.rs diff --git a/crates/cuda-driver/src/original_verify_gpu_plan/plan_tier_tally.rs b/crates/cuda-driver/src/original_verify/gpu_plan/plan_tier_tally.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_gpu_plan/plan_tier_tally.rs rename to crates/cuda-driver/src/original_verify/gpu_plan/plan_tier_tally.rs diff --git a/crates/cuda-driver/src/original_verify_window_gr.rs b/crates/cuda-driver/src/original_verify/gr.rs similarity index 93% rename from crates/cuda-driver/src/original_verify_window_gr.rs rename to crates/cuda-driver/src/original_verify/gr.rs index a4d11499..8c4baddd 100644 --- a/crates/cuda-driver/src/original_verify_window_gr.rs +++ b/crates/cuda-driver/src/original_verify/gr.rs @@ -74,7 +74,7 @@ const E_DOWN2560: &str = "mtp_scalar_gr_down2560"; pub(crate) static GR_FUSED: AssetSpec = AssetSpec { name: "mtp_original_full_fused_gr.ptx", - ptx: include_bytes!("mtp_original_full_fused_gr.ptx"), + ptx: include_bytes!("../mtp_original_full_fused_gr.ptx"), sha: [ 172, 84, 0, 167, 151, 43, 63, 36, 38, 72, 194, 222, 113, 239, 79, 23, 132, 102, 211, 139, 19, 146, 168, 58, 149, 145, 179, 178, 78, 146, 197, 155, @@ -84,7 +84,7 @@ pub(crate) static GR_FUSED: AssetSpec = AssetSpec { }; pub(crate) static GR_NORM: AssetSpec = AssetSpec { name: "mtp_original_full_gr_norm.ptx", - ptx: include_bytes!("mtp_original_full_gr_norm.ptx"), + ptx: include_bytes!("../mtp_original_full_gr_norm.ptx"), sha: [ 6, 214, 23, 123, 72, 44, 182, 116, 19, 198, 89, 106, 2, 145, 180, 218, 177, 133, 3, 50, 22, 74, 146, 18, 175, 246, 123, 158, 253, 242, 17, 32, @@ -94,7 +94,7 @@ pub(crate) static GR_NORM: AssetSpec = AssetSpec { }; pub(crate) static GR_POST: AssetSpec = AssetSpec { name: "mtp_original_full_gr_post.ptx", - ptx: include_bytes!("mtp_original_full_gr_post.ptx"), + ptx: include_bytes!("../mtp_original_full_gr_post.ptx"), sha: [ 155, 71, 156, 15, 65, 42, 224, 7, 115, 129, 92, 154, 109, 137, 215, 244, 195, 247, 169, 240, 246, 145, 135, 109, 232, 5, 235, 56, 23, 141, 151, 144, @@ -104,7 +104,7 @@ pub(crate) static GR_POST: AssetSpec = AssetSpec { }; pub(crate) static PLE_BATCH: AssetSpec = AssetSpec { name: "ple_native_batch.ptx", - ptx: concat!(include_str!("ple_native_batch.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../ple_native_batch.ptx"), "\0").as_bytes(), sha: [ 95, 165, 201, 48, 244, 12, 180, 157, 158, 121, 163, 94, 25, 17, 198, 133, 129, 249, 44, 9, 119, 80, 239, 242, 140, 36, 94, 40, 112, 150, 74, 64, @@ -327,51 +327,30 @@ pub struct OriginalVerifyGrBinding<'ctx> { } #[cfg(test)] -#[path = "original_verify_window_gr/tests.rs"] +#[path = "../original_verify_window_gr/tests.rs"] mod tests; -#[path = "original_verify_window_gr/assets.rs"] mod assets; -#[allow(unused_imports)] pub(crate) use assets::assets; -#[allow(unused_imports)] use assets::check_geometry; -#[allow(unused_imports)] use assets::check_rows; -#[allow(unused_imports)] use assets::chunk_words; -#[allow(unused_imports)] use assets::multi_words; -#[allow(unused_imports)] use assets::refuse; -#[allow(unused_imports)] use assets::row_span; -#[allow(unused_imports)] pub(crate) use assets::shared_attributes; -#[allow(unused_imports)] pub(crate) use assets::tiled_down_geometry; -#[path = "original_verify_window_gr/fused_down.rs"] pub(crate) mod fused_down; -#[path = "original_verify_window_gr/head_chain.rs"] pub(crate) mod head_chain; -#[path = "original_verify_window_gr/plan_hc_read.rs"] mod plan_hc_read; pub(crate) use fused_down::plan_hc_read_launches; -#[allow(unused_imports)] pub(crate) use plan_hc_read::plan_final_write; -#[allow(unused_imports)] pub(crate) use plan_hc_read::plan_hc_read; -#[allow(unused_imports)] pub(crate) use plan_hc_read::plan_head_mix; -#[allow(unused_imports)] use plan_hc_read::write_row; -#[path = "original_verify_window_gr/plan_head_mix_multi.rs"] mod plan_head_mix_multi; -#[allow(unused_imports)] pub(crate) use plan_head_mix_multi::plan_head_mix_multi; -#[path = "original_verify_window_gr/plan_ple_row.rs"] mod plan_ple_row; -#[allow(unused_imports)] pub(crate) use plan_ple_row::plan_ple_layer1; -#[allow(unused_imports)] +#[cfg(test)] pub(crate) use plan_ple_row::plan_ple_row; diff --git a/crates/cuda-driver/src/original_verify_window_gr/assets.rs b/crates/cuda-driver/src/original_verify/gr/assets.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gr/assets.rs rename to crates/cuda-driver/src/original_verify/gr/assets.rs diff --git a/crates/cuda-driver/src/original_verify_window_gr/fused_down.rs b/crates/cuda-driver/src/original_verify/gr/fused_down.rs similarity index 98% rename from crates/cuda-driver/src/original_verify_window_gr/fused_down.rs rename to crates/cuda-driver/src/original_verify/gr/fused_down.rs index ec2192b5..2bf5d0f9 100644 --- a/crates/cuda-driver/src/original_verify_window_gr/fused_down.rs +++ b/crates/cuda-driver/src/original_verify/gr/fused_down.rs @@ -29,7 +29,7 @@ pub(crate) const E_GR_DOWN_FUSED: &str = "leleka_gr_down_fused_t2w8"; /// (extra-seal-plan.json, group sm120-decode). pub(crate) static GR_DOWN_FUSED: AssetSpec = AssetSpec { name: "sm120_gr_down_fused.ptx", - ptx: concat!(include_str!("../sm120_gr_down_fused.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../../sm120_gr_down_fused.ptx"), "\0").as_bytes(), sha: [ 199, 142, 148, 149, 154, 181, 122, 105, 95, 156, 68, 210, 189, 80, 52, 231, 101, 198, 246, 184, 110, 221, 185, 78, 195, 163, 231, 255, 127, 207, 23, 127, diff --git a/crates/cuda-driver/src/original_verify_window_gr/head_chain.rs b/crates/cuda-driver/src/original_verify/gr/head_chain.rs similarity index 99% rename from crates/cuda-driver/src/original_verify_window_gr/head_chain.rs rename to crates/cuda-driver/src/original_verify/gr/head_chain.rs index 98520b93..4bbaf39f 100644 --- a/crates/cuda-driver/src/original_verify_window_gr/head_chain.rs +++ b/crates/cuda-driver/src/original_verify/gr/head_chain.rs @@ -36,7 +36,7 @@ const NORM_THREADS: u32 = 1024; /// `sm120-decode`). pub(crate) static HEAD_CHAIN: AssetSpec = AssetSpec { name: "sm120_head_chain.ptx", - ptx: concat!(include_str!("../sm120_head_chain.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../../sm120_head_chain.ptx"), "\0").as_bytes(), sha: [ 108, 159, 128, 249, 97, 125, 144, 237, 99, 113, 100, 98, 16, 147, 170, 163, 30, 214, 120, 146, 251, 203, 3, 73, 31, 110, 176, 118, 251, 64, 94, 168, diff --git a/crates/cuda-driver/src/original_verify_window_gr/plan_hc_read.rs b/crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gr/plan_hc_read.rs rename to crates/cuda-driver/src/original_verify/gr/plan_hc_read.rs diff --git a/crates/cuda-driver/src/original_verify_window_gr/plan_head_mix_multi.rs b/crates/cuda-driver/src/original_verify/gr/plan_head_mix_multi.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gr/plan_head_mix_multi.rs rename to crates/cuda-driver/src/original_verify/gr/plan_head_mix_multi.rs diff --git a/crates/cuda-driver/src/original_verify_window_gr/plan_ple_row.rs b/crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gr/plan_ple_row.rs rename to crates/cuda-driver/src/original_verify/gr/plan_ple_row.rs diff --git a/crates/cuda-driver/src/original_verify_window_kernels.rs b/crates/cuda-driver/src/original_verify/kernels.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_kernels.rs rename to crates/cuda-driver/src/original_verify/kernels.rs diff --git a/crates/cuda-driver/src/original_verify_layout.rs b/crates/cuda-driver/src/original_verify/layout.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_layout.rs rename to crates/cuda-driver/src/original_verify/layout.rs diff --git a/crates/cuda-driver/src/original_verify_logits.rs b/crates/cuda-driver/src/original_verify/logits.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_logits.rs rename to crates/cuda-driver/src/original_verify/logits.rs diff --git a/crates/cuda-driver/src/original_verify_mapped.rs b/crates/cuda-driver/src/original_verify/mapped.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_mapped.rs rename to crates/cuda-driver/src/original_verify/mapped.rs diff --git a/crates/cuda-driver/src/original_verify_window_moe.rs b/crates/cuda-driver/src/original_verify/moe.rs similarity index 92% rename from crates/cuda-driver/src/original_verify_window_moe.rs rename to crates/cuda-driver/src/original_verify/moe.rs index 38bd890e..09afae70 100644 --- a/crates/cuda-driver/src/original_verify_window_moe.rs +++ b/crates/cuda-driver/src/original_verify/moe.rs @@ -55,7 +55,7 @@ const E_TO_BF16: &str = /// `elementwise.cu` (`f32_to_bf16_bulk`). pub(crate) static ELEMENT: AssetSpec = AssetSpec { name: "mtp_original_full_element.ptx", - ptx: include_bytes!("mtp_original_full_element.ptx"), + ptx: include_bytes!("../mtp_original_full_element.ptx"), sha: [ 143, 223, 223, 142, 246, 22, 105, 140, 18, 48, 31, 125, 244, 113, 111, 192, 34, 191, 52, 180, 25, 9, 158, 76, 151, 39, 41, 146, 11, 213, 244, 167, @@ -68,7 +68,7 @@ const E_ROUTE: &str = "mtp_full_route"; /// `native_router.cu` (`native_router_top10(_multi)`). pub(crate) static ROUTER: AssetSpec = AssetSpec { name: "mtp_original_full_router.ptx", - ptx: include_bytes!("mtp_original_full_router.ptx"), + ptx: include_bytes!("../mtp_original_full_router.ptx"), sha: [ 190, 110, 60, 145, 228, 246, 131, 20, 100, 245, 153, 55, 135, 240, 191, 249, 105, 188, 93, 40, 57, 95, 36, 34, 107, 136, 103, 107, 48, 105, 168, 203, @@ -84,7 +84,7 @@ const E_ROUTER_TOP10: &str = concat!( /// `router_top10.cu` (`router_top10`, the generic router when the native one is off). pub(crate) static ROUTER_LEGACY: AssetSpec = AssetSpec { name: "mtp_original_full_router_legacy.ptx", - ptx: include_bytes!("mtp_original_full_router_legacy.ptx"), + ptx: include_bytes!("../mtp_original_full_router_legacy.ptx"), sha: [ 165, 132, 18, 36, 151, 87, 204, 53, 30, 184, 51, 46, 128, 126, 121, 241, 179, 218, 88, 101, 87, 77, 15, 183, 23, 158, 245, 88, 223, 112, 175, 36, @@ -112,7 +112,7 @@ const E_MOE_COMBINE: &str = concat!( /// `shared_expert.cu` (the Original TU: `shared_expert_multi`'s kernels and `moe_combine`). pub(crate) static SHARED: AssetSpec = AssetSpec { name: "mtp_original_full_shared.ptx", - ptx: include_bytes!("mtp_original_full_shared.ptx"), + ptx: include_bytes!("../mtp_original_full_shared.ptx"), sha: [ 179, 111, 67, 38, 146, 228, 63, 121, 72, 162, 83, 140, 34, 202, 181, 94, 246, 124, 98, 91, 141, 68, 97, 198, 124, 162, 162, 117, 25, 185, 224, 240, @@ -135,7 +135,7 @@ const E_QUANTIZE_Q8_1: &str = concat!( /// this name or union the entry lists of both specs). pub(crate) static HEAD_IQ_EXPERT: AssetSpec = AssetSpec { name: "mtp_original_full_head_iq.ptx#window-moe", - ptx: include_bytes!("mtp_original_full_head_iq.ptx"), + ptx: include_bytes!("../mtp_original_full_head_iq.ptx"), sha: [ 229, 116, 82, 204, 172, 119, 42, 138, 138, 119, 37, 59, 198, 201, 100, 235, 183, 188, 97, 253, 178, 233, 117, 39, 169, 119, 95, 140, 207, 60, 59, 159, @@ -149,7 +149,7 @@ const E_ADD_HITS: &str = /// `s2_expert_grouped.cu` (`moe_hit_add`). pub(crate) static S2_HITS: AssetSpec = AssetSpec { name: "mtp_original_full_s2.ptx", - ptx: include_bytes!("mtp_original_full_s2.ptx"), + ptx: include_bytes!("../mtp_original_full_s2.ptx"), sha: [ 251, 185, 23, 213, 144, 234, 128, 51, 138, 123, 223, 7, 178, 202, 109, 69, 143, 167, 39, 99, 186, 39, 158, 87, 107, 204, 30, 236, 136, 54, 253, 85, @@ -162,7 +162,7 @@ const E_COMBINE: &str = "mtp_full_combine"; /// `native_moe.cu` (`native_moe_combine(_multi)`). pub(crate) static COMBINE: AssetSpec = AssetSpec { name: "mtp_original_full_combine.ptx", - ptx: include_bytes!("mtp_original_full_combine.ptx"), + ptx: include_bytes!("../mtp_original_full_combine.ptx"), sha: [ 34, 83, 254, 45, 100, 19, 80, 244, 68, 90, 10, 105, 196, 160, 252, 34, 184, 92, 47, 255, 202, 124, 189, 83, 111, 254, 93, 41, 18, 248, 31, 183, @@ -216,7 +216,7 @@ const EXPERT_ENTRIES: &[&str] = &[ /// PTX compiled with nvcc 13.2.86 and sealed on 2026-10-15). pub(crate) static EXPERTS: AssetSpec = AssetSpec { name: "original_verify_window_moe_experts.ptx", - ptx: include_bytes!("original_verify_window_moe_experts.ptx"), + ptx: include_bytes!("../original_verify_window_moe_experts.ptx"), sha: [ 36, 210, 140, 205, 156, 58, 91, 190, 219, 235, 147, 59, 79, 235, 55, 111, 132, 10, 116, 226, 26, 68, 130, 23, 72, 140, 6, 238, 35, 130, 17, 87, @@ -233,7 +233,7 @@ pub(crate) static EXPERTS: AssetSpec = AssetSpec { /// sm_120, sm_86 companion in `sm86_table`), launched only by windows recorded with `pcie_mode` 2. pub(crate) static PCIE: AssetSpec = AssetSpec { name: "original_verify_window_pcie.ptx", - ptx: include_bytes!("original_verify_window_pcie.ptx"), + ptx: include_bytes!("../original_verify_window_pcie.ptx"), sha: [ 203, 235, 50, 63, 118, 71, 104, 47, 238, 158, 211, 241, 47, 183, 183, 165, 179, 235, 25, 47, 33, 102, 198, 236, 150, 184, 29, 85, 195, 186, 185, 209, @@ -246,7 +246,7 @@ pub(crate) static PCIE: AssetSpec = AssetSpec { /// loads in flight per thread. Loaded and launched only when `LELEKA_PCIE_KERNEL` names one (no sm_86 companion yet). pub(crate) static PCIE_FAST: AssetSpec = AssetSpec { name: "original_verify_window_pcie_fast.ptx", - ptx: include_bytes!("original_verify_window_pcie_fast.ptx"), + ptx: include_bytes!("../original_verify_window_pcie_fast.ptx"), sha: [ 116, 7, 133, 159, 141, 136, 129, 102, 63, 58, 100, 110, 190, 40, 140, 49, 19, 140, 206, 50, 39, 193, 197, 217, 226, 229, 146, 100, 142, 215, 122, 234, @@ -345,56 +345,32 @@ pub struct OriginalVerifyMoeBinding<'ctx> { } #[cfg(test)] -#[path = "original_verify_window_moe/tests.rs"] +#[path = "../original_verify_window_moe/tests.rs"] mod tests; -#[path = "original_verify_window_moe/pcie_fast_kernel.rs"] mod pcie_fast_kernel; -#[allow(unused_imports)] use pcie_fast_kernel::align256; -#[allow(unused_imports)] pub(crate) use pcie_fast_kernel::assets; -#[allow(unused_imports)] use pcie_fast_kernel::check_rows; -#[allow(unused_imports)] +#[cfg(test)] use pcie_fast_kernel::d_qk; -#[allow(unused_imports)] +#[cfg(test)] use pcie_fast_kernel::expert_blob; -#[allow(unused_imports)] use pcie_fast_kernel::f32s; -#[allow(unused_imports)] +#[cfg(test)] use pcie_fast_kernel::gu_qk; -#[allow(unused_imports)] use pcie_fast_kernel::items; -#[allow(unused_imports)] pub(crate) use pcie_fast_kernel::pcie_fast_kernel; -#[allow(unused_imports)] use pcie_fast_kernel::plan_word; -#[allow(unused_imports)] pub(crate) use pcie_fast_kernel::shared_attributes; -#[path = "original_verify_window_moe/plan_f32_to_bf16.rs"] mod plan_f32_to_bf16; -#[allow(unused_imports)] pub(crate) use plan_f32_to_bf16::BatchedRows; -#[allow(unused_imports)] pub(crate) use plan_f32_to_bf16::expert_scratch; -#[allow(unused_imports)] -use plan_f32_to_bf16::plan_f32_to_bf16; -#[allow(unused_imports)] pub(crate) use plan_f32_to_bf16::plan_quantize_expert_input; -#[allow(unused_imports)] -use plan_f32_to_bf16::plan_route; -#[allow(unused_imports)] pub(crate) use plan_f32_to_bf16::plan_router; -#[allow(unused_imports)] pub(crate) use plan_f32_to_bf16::plan_shared_expert; -#[path = "original_verify_window_moe/plan_expert_groups.rs"] mod plan_expert_groups; -#[allow(unused_imports)] pub(crate) use plan_expert_groups::ExpertGroupSite; -#[allow(unused_imports)] pub(crate) use plan_expert_groups::plan_combine; -#[allow(unused_imports)] pub(crate) use plan_expert_groups::plan_expert_groups; -#[allow(unused_imports)] pub(crate) use plan_expert_groups::plan_hit_add; diff --git a/crates/cuda-driver/src/original_verify_window_moe/pcie_fast_kernel.rs b/crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_moe/pcie_fast_kernel.rs rename to crates/cuda-driver/src/original_verify/moe/pcie_fast_kernel.rs diff --git a/crates/cuda-driver/src/original_verify_window_moe/plan_expert_groups.rs b/crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_moe/plan_expert_groups.rs rename to crates/cuda-driver/src/original_verify/moe/plan_expert_groups.rs diff --git a/crates/cuda-driver/src/original_verify_window_moe/plan_f32_to_bf16.rs b/crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_moe/plan_f32_to_bf16.rs rename to crates/cuda-driver/src/original_verify/moe/plan_f32_to_bf16.rs diff --git a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs index 32e83ce6..aaa686fc 100644 --- a/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs +++ b/crates/cuda-driver/src/original_verify/original_verify_gdn_journal.rs @@ -14,5 +14,4 @@ mod verify_gdn_fused_step; mod verify_gdn_journal_ladder_logits_scan; mod verify_gdn_journal_stage_and_commit; mod verify_gdn_journal_window_launches; -#[allow(unused_imports)] pub(crate) use original_verify_window::verify_assets_sealed; diff --git a/crates/cuda-driver/src/original_verify_window_planner.rs b/crates/cuda-driver/src/original_verify/planner.rs similarity index 99% rename from crates/cuda-driver/src/original_verify_window_planner.rs rename to crates/cuda-driver/src/original_verify/planner.rs index 8ac5572c..6d907d38 100644 --- a/crates/cuda-driver/src/original_verify_window_planner.rs +++ b/crates/cuda-driver/src/original_verify/planner.rs @@ -205,5 +205,5 @@ impl<'p> Planner<'p> { } #[cfg(test)] -#[path = "original_verify_window_planner/tests.rs"] +#[path = "../original_verify_window_planner/tests.rs"] mod tests; diff --git a/crates/cuda-driver/src/original_verify_profile.rs b/crates/cuda-driver/src/original_verify/profile.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_profile.rs rename to crates/cuda-driver/src/original_verify/profile.rs diff --git a/crates/cuda-driver/src/original_verify_window_proj.rs b/crates/cuda-driver/src/original_verify/proj.rs similarity index 64% rename from crates/cuda-driver/src/original_verify_window_proj.rs rename to crates/cuda-driver/src/original_verify/proj.rs index 51d4ef43..3708732c 100644 --- a/crates/cuda-driver/src/original_verify_window_proj.rs +++ b/crates/cuda-driver/src/original_verify/proj.rs @@ -18,83 +18,39 @@ use crate::native_head::native_head_row_bytes; use crate::{Context, DeviceRef}; use crate::{Error, NativeHeadDispatch, Result}; -#[path = "mtp_original_full_head_dispatch.rs"] +#[path = "../mtp_dense_kv/original_int8/prefill/scalar/full_forward/head_dispatch.rs"] mod head_dispatch; #[cfg(test)] -#[path = "original_verify_window_proj/tests.rs"] +#[path = "../original_verify_window_proj/tests.rs"] mod tests; -#[path = "original_verify_window_proj/q8_1_row_bytes.rs"] mod q8_1_row_bytes; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::is_iq_kind; -#[allow(unused_imports)] +#[cfg(test)] pub(crate) use q8_1_row_bytes::mmvf_block_size; -#[allow(unused_imports)] -pub(crate) use q8_1_row_bytes::mmvq_asset; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::mmvq_assets; -#[allow(unused_imports)] -use q8_1_row_bytes::multi_entry; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::native_matrix_bytes; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::plan_bf16_gemv; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::plan_mmvq; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::plan_quantize_q8_1; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::plan_window_mmvq; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::plan_window_quantize; -#[allow(unused_imports)] -use q8_1_row_bytes::projection_first_row; -#[allow(unused_imports)] -use q8_1_row_bytes::projection_shape; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::q8_1_row_bytes; -#[allow(unused_imports)] -use q8_1_row_bytes::quant_source_span; -#[allow(unused_imports)] -pub(crate) use q8_1_row_bytes::quant_source_width; -#[allow(unused_imports)] -use q8_1_row_bytes::single_entry; -#[allow(unused_imports)] pub(crate) use q8_1_row_bytes::{Bf16GemvExtents, MmvqExtents, StridedRows, WindowProjectionSite}; -#[path = "original_verify_window_proj/admit_matrix.rs"] mod admit_matrix; -#[allow(unused_imports)] -use admit_matrix::admit_matrix; -#[path = "original_verify_window_proj/head_native_entries_types.rs"] mod head_native_entries_types; -#[allow(unused_imports)] use head_native_entries_types::HEAD_NATIVE_ENTRIES; -#[path = "original_verify_window_proj/head_iq_entries_types.rs"] mod head_iq_entries_types; -#[allow(unused_imports)] pub(crate) use head_iq_entries_types::BF16; -#[allow(unused_imports)] use head_iq_entries_types::BF16_ENTRIES; -#[allow(unused_imports)] pub(crate) use head_iq_entries_types::GdnProjectionAddrs; -#[allow(unused_imports)] pub(crate) use head_iq_entries_types::HEAD_IQ; -#[allow(unused_imports)] -use head_iq_entries_types::HEAD_IQ_ENTRIES; -#[allow(unused_imports)] pub(crate) use head_iq_entries_types::HEAD_NATIVE; -#[allow(unused_imports)] pub(crate) use head_iq_entries_types::NativeWeight; -#[allow(unused_imports)] pub use head_iq_entries_types::OriginalVerifyGdnProjections; -#[allow(unused_imports)] pub use head_iq_entries_types::OriginalVerifyNativeMatrix; -#[allow(unused_imports)] pub use head_iq_entries_types::OriginalVerifyProjBinding; -#[allow(unused_imports)] pub use head_iq_entries_types::OriginalVerifyQsaProjections; -#[allow(unused_imports)] pub(crate) use head_iq_entries_types::QsaProjectionAddrs; diff --git a/crates/cuda-driver/src/original_verify_window_proj/admit_matrix.rs b/crates/cuda-driver/src/original_verify/proj/admit_matrix.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_proj/admit_matrix.rs rename to crates/cuda-driver/src/original_verify/proj/admit_matrix.rs diff --git a/crates/cuda-driver/src/original_verify_window_proj/head_iq_entries_types.rs b/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs similarity index 97% rename from crates/cuda-driver/src/original_verify_window_proj/head_iq_entries_types.rs rename to crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs index 8b78b3a3..8f2cd43f 100644 --- a/crates/cuda-driver/src/original_verify_window_proj/head_iq_entries_types.rs +++ b/crates/cuda-driver/src/original_verify/proj/head_iq_entries_types.rs @@ -113,7 +113,7 @@ pub(super) const BF16_ENTRIES: &[&str] = &[ pub(crate) static HEAD_NATIVE: AssetSpec = AssetSpec { name: "mtp_original_full_head_native.ptx", - ptx: include_bytes!("../mtp_original_full_head_native.ptx"), + ptx: include_bytes!("../../mtp_original_full_head_native.ptx"), sha: [ 248, 32, 158, 28, 159, 191, 151, 139, 197, 123, 96, 176, 181, 246, 237, 202, 177, 144, 94, 73, 164, 171, 58, 169, 130, 96, 78, 62, 104, 15, 164, 55, @@ -123,7 +123,7 @@ pub(crate) static HEAD_NATIVE: AssetSpec = AssetSpec { }; pub(crate) static HEAD_IQ: AssetSpec = AssetSpec { name: "mtp_original_full_head_iq.ptx", - ptx: include_bytes!("../mtp_original_full_head_iq.ptx"), + ptx: include_bytes!("../../mtp_original_full_head_iq.ptx"), sha: [ 229, 116, 82, 204, 172, 119, 42, 138, 138, 119, 37, 59, 198, 201, 100, 235, 183, 188, 97, 253, 178, 233, 117, 39, 169, 119, 95, 140, 207, 60, 59, 159, @@ -133,7 +133,7 @@ pub(crate) static HEAD_IQ: AssetSpec = AssetSpec { }; pub(crate) static BF16: AssetSpec = AssetSpec { name: "mtp_original_full_bf16.ptx", - ptx: include_bytes!("../mtp_original_full_bf16.ptx"), + ptx: include_bytes!("../../mtp_original_full_bf16.ptx"), sha: [ 161, 109, 252, 252, 154, 73, 204, 171, 37, 216, 3, 2, 147, 213, 130, 111, 143, 117, 226, 134, 143, 174, 27, 108, 76, 239, 112, 107, 109, 252, 61, 8, diff --git a/crates/cuda-driver/src/original_verify_window_proj/head_native_entries_types.rs b/crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_proj/head_native_entries_types.rs rename to crates/cuda-driver/src/original_verify/proj/head_native_entries_types.rs diff --git a/crates/cuda-driver/src/original_verify_window_proj/q8_1_row_bytes.rs b/crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_proj/q8_1_row_bytes.rs rename to crates/cuda-driver/src/original_verify/proj/q8_1_row_bytes.rs diff --git a/crates/cuda-driver/src/original_verify_window_qsa.rs b/crates/cuda-driver/src/original_verify/qsa.rs similarity index 94% rename from crates/cuda-driver/src/original_verify_window_qsa.rs rename to crates/cuda-driver/src/original_verify/qsa.rs index e4ad99fd..59e52c26 100644 --- a/crates/cuda-driver/src/original_verify_window_qsa.rs +++ b/crates/cuda-driver/src/original_verify/qsa.rs @@ -51,7 +51,7 @@ const GATE_ENTRIES: &[&str] = &["verify_window_qsa_gate"]; /// Literal Original `native_qsa::norm<256>` and `native_rope::apply`, `--use_fast_math`. pub(crate) static DECODE_POSTOPS: AssetSpec = AssetSpec { name: "qsa_decode_postops.ptx", - ptx: include_bytes!("qsa_decode_postops.ptx"), + ptx: include_bytes!("../qsa_decode_postops.ptx"), sha: [ 253, 118, 230, 248, 69, 87, 215, 242, 166, 42, 197, 110, 22, 213, 228, 247, 136, 98, 231, 86, 239, 152, 82, 176, 77, 89, 25, 153, 33, 58, 81, 25, @@ -62,7 +62,7 @@ pub(crate) static DECODE_POSTOPS: AssetSpec = AssetSpec { /// `qsa_split_q`: the q half of `qfull` (the q/gate split copy). pub(crate) static SPLIT: AssetSpec = AssetSpec { name: "qsa_prompt_postops.ptx", - ptx: include_bytes!("qsa_prompt_postops.ptx"), + ptx: include_bytes!("../qsa_prompt_postops.ptx"), sha: [ 72, 106, 115, 176, 107, 58, 52, 242, 152, 245, 126, 146, 194, 12, 200, 57, 77, 197, 157, 123, 216, 75, 92, 204, 248, 218, 83, 170, 80, 129, 172, 159, @@ -73,7 +73,7 @@ pub(crate) static SPLIT: AssetSpec = AssetSpec { /// Original `kv_append_q8_kernel` (precise flags). pub(crate) static KV_APPEND: AssetSpec = AssetSpec { name: "mtp_original_kv.ptx", - ptx: include_bytes!("mtp_original_kv.ptx"), + ptx: include_bytes!("../mtp_original_kv.ptx"), sha: [ 224, 193, 255, 16, 211, 212, 188, 248, 253, 51, 105, 113, 48, 121, 178, 50, 230, 44, 219, 44, 58, 52, 95, 174, 196, 157, 30, 102, 118, 63, 145, 31, @@ -84,7 +84,7 @@ pub(crate) static KV_APPEND: AssetSpec = AssetSpec { /// Original `block_scores_multi_kernel` / `block_scores_kernel` / `block_topk_kernel`. pub(crate) static SELECT: AssetSpec = AssetSpec { name: "qsa_prompt_select.ptx", - ptx: include_bytes!("qsa_prompt_select.ptx"), + ptx: include_bytes!("../qsa_prompt_select.ptx"), sha: [ 30, 53, 81, 71, 68, 33, 98, 41, 176, 207, 251, 79, 69, 210, 241, 63, 37, 203, 149, 243, 119, 163, 12, 28, 1, 37, 67, 219, 245, 58, 28, 45, @@ -95,7 +95,7 @@ pub(crate) static SELECT: AssetSpec = AssetSpec { /// Original `kv_stream.cu` `resolve_kernel` + `copy_kernel`. pub(crate) static RESOLVER: AssetSpec = AssetSpec { name: "qsa_prompt_resolver.ptx", - ptx: include_bytes!("qsa_prompt_resolver.ptx"), + ptx: include_bytes!("../qsa_prompt_resolver.ptx"), sha: [ 141, 62, 203, 174, 203, 242, 132, 69, 186, 100, 72, 91, 223, 243, 217, 26, 33, 216, 123, 133, 213, 147, 154, 1, 82, 239, 47, 36, 20, 72, 14, 34, @@ -106,7 +106,7 @@ pub(crate) static RESOLVER: AssetSpec = AssetSpec { /// Original `attn_chunk_kernel<1>` + `attn_merge_kernel` (batched form). pub(crate) static ATTENTION: AssetSpec = AssetSpec { name: "mtp_original_full_attention.ptx", - ptx: include_bytes!("mtp_original_full_attention.ptx"), + ptx: include_bytes!("../mtp_original_full_attention.ptx"), sha: [ 63, 178, 53, 202, 64, 93, 36, 195, 184, 208, 236, 70, 97, 29, 157, 100, 1, 3, 183, 26, 101, 133, 153, 35, 25, 79, 2, 240, 107, 72, 47, 108, @@ -118,7 +118,7 @@ pub(crate) static ATTENTION: AssetSpec = AssetSpec { /// 2026-10-15. pub(crate) static GATE: AssetSpec = AssetSpec { name: "original_verify_window_qsa_gate.ptx", - ptx: include_bytes!("original_verify_window_qsa_gate.ptx"), + ptx: include_bytes!("../original_verify_window_qsa_gate.ptx"), sha: [ 16, 128, 124, 76, 98, 216, 191, 75, 231, 92, 251, 26, 80, 119, 252, 62, 0, 220, 143, 64, 234, 102, 155, 34, 220, 255, 123, 120, 83, 171, 121, 73, @@ -285,28 +285,17 @@ struct Span { } #[cfg(test)] -#[path = "original_verify_window_qsa/tests.rs"] +#[path = "../original_verify_window_qsa/tests.rs"] mod tests; -#[path = "original_verify_window_qsa/assets.rs"] mod assets; -#[allow(unused_imports)] pub(crate) use assets::assets; -#[allow(unused_imports)] pub(crate) use assets::cluster_assets; -#[allow(unused_imports)] pub(crate) use assets::daily_assets; -#[allow(unused_imports)] use assets::declared_i32; -#[allow(unused_imports)] use assets::grid_u32; -#[allow(unused_imports)] use assets::max_blocks; -#[allow(unused_imports)] use assets::scratch_floats; -#[allow(unused_imports)] pub(crate) use assets::shared_attributes; -#[path = "original_verify_window_qsa/fused_prelude.rs"] pub(crate) mod fused_prelude; -#[path = "original_verify_window_qsa/qsa_window.rs"] mod qsa_window; diff --git a/crates/cuda-driver/src/original_verify_window_qsa/assets.rs b/crates/cuda-driver/src/original_verify/qsa/assets.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_qsa/assets.rs rename to crates/cuda-driver/src/original_verify/qsa/assets.rs diff --git a/crates/cuda-driver/src/original_verify_window_qsa/fused_prelude.rs b/crates/cuda-driver/src/original_verify/qsa/fused_prelude.rs similarity index 96% rename from crates/cuda-driver/src/original_verify_window_qsa/fused_prelude.rs rename to crates/cuda-driver/src/original_verify/qsa/fused_prelude.rs index fd7b79c9..b644467d 100644 --- a/crates/cuda-driver/src/original_verify_window_qsa/fused_prelude.rs +++ b/crates/cuda-driver/src/original_verify/qsa/fused_prelude.rs @@ -27,7 +27,7 @@ pub(crate) const E_INDEX_ROWS: &str = "leleka_verify_qsa_index_rows"; /// a pin does not match its bytes. pub(crate) static KV_ROWS: AssetSpec = AssetSpec { name: "original_verify_window_qsa_kv_rows.ptx", - ptx: concat!(include_str!("../original_verify_window_qsa_kv_rows.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../../original_verify_window_qsa_kv_rows.ptx"), "\0").as_bytes(), sha: [ 217, 24, 52, 136, 189, 9, 207, 86, 34, 6, 137, 55, 116, 152, 82, 81, 123, 82, 109, 46, 201, 207, 91, 113, 81, 42, 29, 254, 208, 161, 219, 133, @@ -40,7 +40,7 @@ pub(crate) static KV_ROWS: AssetSpec = AssetSpec { /// `KV_ROWS`. pub(crate) static INDEX_ROWS: AssetSpec = AssetSpec { name: "original_verify_window_qsa_index_rows.ptx", - ptx: concat!(include_str!("../original_verify_window_qsa_index_rows.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../../original_verify_window_qsa_index_rows.ptx"), "\0").as_bytes(), sha: [ 113, 219, 156, 79, 31, 64, 14, 200, 110, 124, 241, 140, 177, 124, 53, 4, 138, 238, 50, 70, 215, 152, 40, 219, 112, 252, 43, 86, 45, 44, 213, 125, @@ -202,5 +202,5 @@ pub(crate) fn index_dim_supported(index_dim: usize) -> bool { } #[cfg(test)] -#[path = "fused_prelude/tests.rs"] +#[path = "../../original_verify_window_qsa/fused_prelude/tests.rs"] mod tests; diff --git a/crates/cuda-driver/src/original_verify_window_qsa/qsa_window.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs similarity index 83% rename from crates/cuda-driver/src/original_verify_window_qsa/qsa_window.rs rename to crates/cuda-driver/src/original_verify/qsa/qsa_window.rs index d8073764..39d1eeed 100644 --- a/crates/cuda-driver/src/original_verify_window_qsa/qsa_window.rs +++ b/crates/cuda-driver/src/original_verify/qsa/qsa_window.rs @@ -9,9 +9,6 @@ use super::{ plan_bf16_gemv, rope_abi, scratch_floats, }; -#[path = "qsa_window/qsa_window_prelude_rows.rs"] mod qsa_window_prelude_rows; -#[path = "qsa_window/qsa_window_query_key_paths.rs"] mod qsa_window_query_key_paths; -#[path = "qsa_window/qsa_window_select_and_attend.rs"] mod qsa_window_select_and_attend; diff --git a/crates/cuda-driver/src/original_verify_window_qsa/qsa_window/qsa_window_prelude_rows.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_prelude_rows.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_qsa/qsa_window/qsa_window_prelude_rows.rs rename to crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_prelude_rows.rs diff --git a/crates/cuda-driver/src/original_verify_window_qsa/qsa_window/qsa_window_query_key_paths.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_qsa/qsa_window/qsa_window_query_key_paths.rs rename to crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_query_key_paths.rs diff --git a/crates/cuda-driver/src/original_verify_window_qsa/qsa_window/qsa_window_select_and_attend.rs b/crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_qsa/qsa_window/qsa_window_select_and_attend.rs rename to crates/cuda-driver/src/original_verify/qsa/qsa_window/qsa_window_select_and_attend.rs diff --git a/crates/cuda-driver/src/original_verify_schedule.rs b/crates/cuda-driver/src/original_verify/schedule.rs similarity index 89% rename from crates/cuda-driver/src/original_verify_schedule.rs rename to crates/cuda-driver/src/original_verify/schedule.rs index 8e1471b4..f0790d37 100644 --- a/crates/cuda-driver/src/original_verify_schedule.rs +++ b/crates/cuda-driver/src/original_verify/schedule.rs @@ -77,17 +77,10 @@ pub struct OriginalVerifier<'ctx, R: OriginalVerifyGraphResources<'ctx> + Origin test_stall: u64, } -#[path = "original_verify_schedule/commit_sync_forced.rs"] mod commit_sync_forced; -#[allow(unused_imports)] use commit_sync_forced::commit_sync_forced; -#[path = "original_verify_schedule/original_verifier.rs"] mod original_verifier; -#[path = "original_verify_schedule/verifier_commit_window_lifecycle.rs"] mod verifier_commit_window_lifecycle; -#[path = "original_verify_schedule/verifier_logits_diagnostics_close.rs"] mod verifier_logits_diagnostics_close; -#[path = "original_verify_schedule/verifier_park_rearm.rs"] mod verifier_park_rearm; -#[path = "original_verify_schedule/window_phases.rs"] mod window_phases; diff --git a/crates/cuda-driver/src/original_verify_schedule/commit_sync_forced.rs b/crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_schedule/commit_sync_forced.rs rename to crates/cuda-driver/src/original_verify/schedule/commit_sync_forced.rs diff --git a/crates/cuda-driver/src/original_verify_schedule/original_verifier.rs b/crates/cuda-driver/src/original_verify/schedule/original_verifier.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_schedule/original_verifier.rs rename to crates/cuda-driver/src/original_verify/schedule/original_verifier.rs diff --git a/crates/cuda-driver/src/original_verify_schedule/verifier_commit_window_lifecycle.rs b/crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_schedule/verifier_commit_window_lifecycle.rs rename to crates/cuda-driver/src/original_verify/schedule/verifier_commit_window_lifecycle.rs diff --git a/crates/cuda-driver/src/original_verify_schedule/verifier_logits_diagnostics_close.rs b/crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_schedule/verifier_logits_diagnostics_close.rs rename to crates/cuda-driver/src/original_verify/schedule/verifier_logits_diagnostics_close.rs diff --git a/crates/cuda-driver/src/original_verify_schedule/verifier_park_rearm.rs b/crates/cuda-driver/src/original_verify/schedule/verifier_park_rearm.rs similarity index 98% rename from crates/cuda-driver/src/original_verify_schedule/verifier_park_rearm.rs rename to crates/cuda-driver/src/original_verify/schedule/verifier_park_rearm.rs index 633d517e..d1926552 100644 --- a/crates/cuda-driver/src/original_verify_schedule/verifier_park_rearm.rs +++ b/crates/cuda-driver/src/original_verify/schedule/verifier_park_rearm.rs @@ -112,5 +112,5 @@ impl<'ctx, R: OriginalVerifyGraphResources<'ctx> + OriginalNativeHeadGraphResour } #[cfg(test)] -#[path = "park_rearm_tests.rs"] +#[path = "../../original_verify_schedule/park_rearm_tests.rs"] mod tests; diff --git a/crates/cuda-driver/src/original_verify_schedule/window_phases.rs b/crates/cuda-driver/src/original_verify/schedule/window_phases.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_schedule/window_phases.rs rename to crates/cuda-driver/src/original_verify/schedule/window_phases.rs diff --git a/crates/cuda-driver/src/original_verify/share_window_modules.rs b/crates/cuda-driver/src/original_verify/share_window_modules.rs index 632527de..47a365c8 100644 --- a/crates/cuda-driver/src/original_verify/share_window_modules.rs +++ b/crates/cuda-driver/src/original_verify/share_window_modules.rs @@ -10,29 +10,17 @@ use super::{ }; mod verify_bank_and_canonical_gdn_open; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::admission; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::admit; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::check_canonical_lengths; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::check_commands; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::command; -#[allow(unused_imports)] pub(crate) use verify_bank_and_canonical_gdn_open::gather_rows_module; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::handle; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::poison; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::sealed_asset; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::share_window_modules; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::transport; -#[allow(unused_imports)] pub(super) use verify_bank_and_canonical_gdn_open::zero; mod original_verify_bank; mod physical; diff --git a/crates/cuda-driver/src/original_verify_window_sm120.rs b/crates/cuda-driver/src/original_verify/sm120.rs similarity index 99% rename from crates/cuda-driver/src/original_verify_window_sm120.rs rename to crates/cuda-driver/src/original_verify/sm120.rs index 37421f05..816d371d 100644 --- a/crates/cuda-driver/src/original_verify_window_sm120.rs +++ b/crates/cuda-driver/src/original_verify/sm120.rs @@ -32,7 +32,7 @@ pub(crate) const E_ATTN_MERGE_V2: &str = "leleka_qsa_decode_merge_v2"; /// `sm120_attn_daily.cu`, sealed by `scripts/gpu-bringup/seal_pins.py` (extra-seal-plan.json, group sm120-decode). pub(crate) static ATTN_DAILY: AssetSpec = AssetSpec { name: "sm120_attn_daily.ptx", - ptx: concat!(include_str!("sm120_attn_daily.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../sm120_attn_daily.ptx"), "\0").as_bytes(), sha: [ 73, 254, 226, 193, 238, 114, 44, 253, 105, 185, 137, 63, 194, 92, 42, 62, 145, 177, 230, 181, 184, 134, 234, 111, 57, 33, 127, 124, 167, 213, 98, 213, @@ -55,7 +55,7 @@ pub(crate) const GU_SWIGLU_TYPES: [u32; 6] = [16, 17, 18, 21, 22, 23]; /// `sm120_gu_swiglu.cu`, sealed by `scripts/gpu-bringup/seal_pins.py` (extra-seal-plan.json, group sm120-decode). pub(crate) static GU_SWIGLU: AssetSpec = AssetSpec { name: "sm120_gu_swiglu.ptx", - ptx: concat!(include_str!("sm120_gu_swiglu.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../sm120_gu_swiglu.ptx"), "\0").as_bytes(), sha: [ 107, 0, 213, 80, 35, 131, 13, 91, 78, 112, 245, 194, 119, 44, 69, 22, 61, 118, 18, 91, 59, 9, 185, 31, 8, 119, 145, 191, 64, 140, 101, 123, diff --git a/crates/cuda-driver/src/original_verify_window_gpu.rs b/crates/cuda-driver/src/original_verify/window_gpu.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gpu.rs rename to crates/cuda-driver/src/original_verify/window_gpu.rs diff --git a/crates/cuda-driver/src/original_verify_window_ops.rs b/crates/cuda-driver/src/original_verify/window_ops.rs similarity index 89% rename from crates/cuda-driver/src/original_verify_window_ops.rs rename to crates/cuda-driver/src/original_verify/window_ops.rs index 0d056b03..7b57ba95 100644 --- a/crates/cuda-driver/src/original_verify_window_ops.rs +++ b/crates/cuda-driver/src/original_verify/window_ops.rs @@ -99,34 +99,23 @@ pub(crate) struct OriginalVerifyWindowOps<'c, 's, 'ctx> { } #[cfg(test)] -#[path = "original_verify_window_ops/tests.rs"] +#[path = "../original_verify_window_ops/tests.rs"] mod tests; -#[path = "original_verify_window_ops/all_window_assets.rs"] mod all_window_assets; -#[allow(unused_imports)] +#[cfg(test)] pub(super) use all_window_assets::all_window_assets; -#[allow(unused_imports)] +#[cfg(test)] use all_window_assets::unsealed_keys; -#[allow(unused_imports)] pub use all_window_assets::unsealed_window_assets; -#[path = "original_verify_window_ops/gdn_stages.rs"] mod gdn_stages; -#[path = "original_verify_window_ops/hits_combine.rs"] mod hits_combine; -#[path = "original_verify_window_ops/original_verifier.rs"] mod original_verifier; -#[path = "original_verify_window_ops/window_launches.rs"] mod window_launches; -#[path = "original_verify_window_ops/qsa_prelude_ops.rs"] mod qsa_prelude_ops; -#[path = "original_verify_window_ops/side_qsa_branches.rs"] mod side_qsa_branches; -#[path = "original_verify_window_ops/side_shared_expert.rs"] mod side_shared_expert; -#[path = "original_verify_window_ops/window_ops_kernels_and_pcie_plan.rs"] mod window_ops_kernels_and_pcie_plan; -#[path = "original_verify_window_ops/wait_rows.rs"] mod wait_rows; -#[allow(unused_imports)] +#[cfg(test)] pub(crate) use original_verifier::graph_oom_at; diff --git a/crates/cuda-driver/src/original_verify_window_ops/all_window_assets.rs b/crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_ops/all_window_assets.rs rename to crates/cuda-driver/src/original_verify/window_ops/all_window_assets.rs diff --git a/crates/cuda-driver/src/original_verify_window_ops/gdn_stages.rs b/crates/cuda-driver/src/original_verify/window_ops/gdn_stages.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_ops/gdn_stages.rs rename to crates/cuda-driver/src/original_verify/window_ops/gdn_stages.rs diff --git a/crates/cuda-driver/src/original_verify_window_ops/hits_combine.rs b/crates/cuda-driver/src/original_verify/window_ops/hits_combine.rs similarity index 94% rename from crates/cuda-driver/src/original_verify_window_ops/hits_combine.rs rename to crates/cuda-driver/src/original_verify/window_ops/hits_combine.rs index 6a73d72a..1a621029 100644 --- a/crates/cuda-driver/src/original_verify_window_ops/hits_combine.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/hits_combine.rs @@ -9,13 +9,14 @@ //! it needs no other switch. When the shape does not fit the vector kernel (k != 10, `n_embd % 4 != 0`, an unaligned //! row, the legacy double-precision combine) the method records the two launches it replaces, `add_hits` then the //! combine the planner would have chosen, so the hit rows are added in every case. -#[path = "hits_combine/plan_hits_combine.rs"] mod plan_hits_combine; use super::{AssetSpec, Launch, OriginalVerifyWindowOps, Planner, Result, Rows, ffn}; #[cfg(test)] use super::{A, Error}; -pub(crate) use plan_hits_combine::{E_COMBINE_HITS, HITS_COMBINE}; +pub(crate) use plan_hits_combine::HITS_COMBINE; +#[cfg(test)] +use plan_hits_combine::E_COMBINE_HITS; use plan_hits_combine::{HitsCombineSite, plan_hits_combine}; /// The assets the window preloads before capture for the FFN switches: the folded combine when it is on. @@ -49,5 +50,5 @@ impl OriginalVerifyWindowOps<'_, '_, '_> { } #[cfg(test)] -#[path = "hits_combine/tests.rs"] +#[path = "../../original_verify_window_ops/hits_combine/tests.rs"] mod tests; diff --git a/crates/cuda-driver/src/original_verify_window_ops/hits_combine/plan_hits_combine.rs b/crates/cuda-driver/src/original_verify/window_ops/hits_combine/plan_hits_combine.rs similarity index 98% rename from crates/cuda-driver/src/original_verify_window_ops/hits_combine/plan_hits_combine.rs rename to crates/cuda-driver/src/original_verify/window_ops/hits_combine/plan_hits_combine.rs index 36c886cd..6a245483 100644 --- a/crates/cuda-driver/src/original_verify_window_ops/hits_combine/plan_hits_combine.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/hits_combine/plan_hits_combine.rs @@ -21,7 +21,7 @@ const VECTOR_ALIGN: u64 = 16; /// `scripts/gpu-bringup/extra-seal-plan.json` (group `sm120-decode`). pub(crate) static HITS_COMBINE: AssetSpec = AssetSpec { name: "sm120_combine_hits.ptx", - ptx: concat!(include_str!("../../sm120_combine_hits.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../../../sm120_combine_hits.ptx"), "\0").as_bytes(), sha: [ 167, 221, 5, 153, 20, 187, 51, 255, 103, 227, 166, 6, 169, 179, 141, 180, 228, 225, 133, 121, 209, 86, 86, 50, 6, 143, 132, 170, 183, 52, 112, 247, diff --git a/crates/cuda-driver/src/original_verify_window_ops/original_verifier.rs b/crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_ops/original_verifier.rs rename to crates/cuda-driver/src/original_verify/window_ops/original_verifier.rs diff --git a/crates/cuda-driver/src/original_verify_window_ops/qsa_prelude_ops.rs b/crates/cuda-driver/src/original_verify/window_ops/qsa_prelude_ops.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_ops/qsa_prelude_ops.rs rename to crates/cuda-driver/src/original_verify/window_ops/qsa_prelude_ops.rs diff --git a/crates/cuda-driver/src/original_verify_window_ops/side_qsa_branches.rs b/crates/cuda-driver/src/original_verify/window_ops/side_qsa_branches.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_ops/side_qsa_branches.rs rename to crates/cuda-driver/src/original_verify/window_ops/side_qsa_branches.rs diff --git a/crates/cuda-driver/src/original_verify_window_ops/side_shared_expert.rs b/crates/cuda-driver/src/original_verify/window_ops/side_shared_expert.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_ops/side_shared_expert.rs rename to crates/cuda-driver/src/original_verify/window_ops/side_shared_expert.rs diff --git a/crates/cuda-driver/src/original_verify_window_ops/wait_rows.rs b/crates/cuda-driver/src/original_verify/window_ops/wait_rows.rs similarity index 97% rename from crates/cuda-driver/src/original_verify_window_ops/wait_rows.rs rename to crates/cuda-driver/src/original_verify/window_ops/wait_rows.rs index 58467ef7..8cf898e1 100644 --- a/crates/cuda-driver/src/original_verify_window_ops/wait_rows.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/wait_rows.rs @@ -30,7 +30,7 @@ const NEEDS_ROWS_KERNEL: &str = /// `scripts/gpu-bringup/extra-seal-plan.json` (group `sm120-decode`). pub(crate) static WAIT_COPY_ROWS: AssetSpec = AssetSpec { name: "sm120_wait_copy_rows.ptx", - ptx: concat!(include_str!("../sm120_wait_copy_rows.ptx"), "\0").as_bytes(), + ptx: concat!(include_str!("../../sm120_wait_copy_rows.ptx"), "\0").as_bytes(), sha: [ 248, 179, 63, 32, 217, 130, 188, 199, 138, 72, 18, 113, 46, 109, 236, 252, 206, 222, 204, 192, 196, 252, 209, 143, 153, 7, 79, 143, 182, 106, 7, 0, @@ -124,5 +124,5 @@ impl OriginalVerifyWindowOps<'_, '_, '_> { } #[cfg(test)] -#[path = "wait_rows/tests.rs"] +#[path = "../../original_verify_window_ops/wait_rows/tests.rs"] mod tests; diff --git a/crates/cuda-driver/src/original_verify_window_ops/window_launches.rs b/crates/cuda-driver/src/original_verify/window_ops/window_launches.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_ops/window_launches.rs rename to crates/cuda-driver/src/original_verify/window_ops/window_launches.rs diff --git a/crates/cuda-driver/src/original_verify_window_ops/window_ops_kernels_and_pcie_plan.rs b/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs similarity index 99% rename from crates/cuda-driver/src/original_verify_window_ops/window_ops_kernels_and_pcie_plan.rs rename to crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs index 97eca746..e4e15ee6 100644 --- a/crates/cuda-driver/src/original_verify_window_ops/window_ops_kernels_and_pcie_plan.rs +++ b/crates/cuda-driver/src/original_verify/window_ops/window_ops_kernels_and_pcie_plan.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalVerifyWindowOps`: `capture_finite_verdict`, `plan_copy_addresses`, `wait_plan_glue`, `copy_hi... //! Implements `WindowOps for OriginalVerifyWindowOps`. Functions: `pcie_fetch_launch`, `pcie_rebase_command`. -#[allow(unused_imports)] use super::side_qsa_branches::QsaSideLayer; use super::{ A, Arg, Command, Error, ExpertTier, HcHalf, Launch, LaunchExtent, OriginalVerifyGraphResources, diff --git a/crates/cuda-driver/src/original_verify_window_plan.rs b/crates/cuda-driver/src/original_verify/window_plan.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_plan.rs rename to crates/cuda-driver/src/original_verify/window_plan.rs diff --git a/crates/cuda-driver/src/original_verify_window_record.rs b/crates/cuda-driver/src/original_verify/window_record.rs similarity index 99% rename from crates/cuda-driver/src/original_verify_window_record.rs rename to crates/cuda-driver/src/original_verify/window_record.rs index c2c5b0fa..9e0267e3 100644 --- a/crates/cuda-driver/src/original_verify_window_record.rs +++ b/crates/cuda-driver/src/original_verify/window_record.rs @@ -396,5 +396,5 @@ fn post_combine(ops: &mut O, policy: &WindowPolicy, l: usize, rows } #[cfg(test)] -#[path = "original_verify_window_record/tests.rs"] +#[path = "../original_verify_window_record/tests.rs"] mod tests; diff --git a/crates/cuda-driver/src/original_verify_window_gr/tests/fused_down_launches.rs b/crates/cuda-driver/src/original_verify_window_gr/fused_down_launches.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gr/tests/fused_down_launches.rs rename to crates/cuda-driver/src/original_verify_window_gr/fused_down_launches.rs diff --git a/crates/cuda-driver/src/original_verify_window_gr/tests/head_chain_launches.rs b/crates/cuda-driver/src/original_verify_window_gr/head_chain_launches.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gr/tests/head_chain_launches.rs rename to crates/cuda-driver/src/original_verify_window_gr/head_chain_launches.rs diff --git a/crates/cuda-driver/src/original_verify_window_gr/tests/head_mix_is_the_native.rs b/crates/cuda-driver/src/original_verify_window_gr/head_mix_is_the_native.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gr/tests/head_mix_is_the_native.rs rename to crates/cuda-driver/src/original_verify_window_gr/head_mix_is_the_native.rs diff --git a/crates/cuda-driver/src/original_verify_window_gr/tests/head_mix_multi.rs b/crates/cuda-driver/src/original_verify_window_gr/head_mix_multi.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gr/tests/head_mix_multi.rs rename to crates/cuda-driver/src/original_verify_window_gr/head_mix_multi.rs diff --git a/crates/cuda-driver/src/original_verify_window_gr/tests.rs b/crates/cuda-driver/src/original_verify_window_gr/tests.rs index 1cd127e0..22c6cd31 100644 --- a/crates/cuda-driver/src/original_verify_window_gr/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_gr/tests.rs @@ -58,13 +58,8 @@ fn ple_addrs(key: PleKey) -> PleAddrs { } } -#[path = "tests/fused_down_launches.rs"] mod fused_down_launches; -#[path = "tests/head_chain_launches.rs"] mod head_chain_launches; -#[path = "tests/head_mix_is_the_native.rs"] mod head_mix_is_the_native; -#[path = "tests/head_mix_multi.rs"] mod head_mix_multi; -#[path = "tests/tiled_down_projection_covers.rs"] mod tiled_down_projection_covers; diff --git a/crates/cuda-driver/src/original_verify_window_gr/tests/tiled_down_projection_covers.rs b/crates/cuda-driver/src/original_verify_window_gr/tiled_down_projection_covers.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_gr/tests/tiled_down_projection_covers.rs rename to crates/cuda-driver/src/original_verify_window_gr/tiled_down_projection_covers.rs diff --git a/crates/cuda-driver/src/original_verify_window_moe/tests/alternative_pcie_staging_copy.rs b/crates/cuda-driver/src/original_verify_window_moe/alternative_pcie_staging_copy.rs similarity index 99% rename from crates/cuda-driver/src/original_verify_window_moe/tests/alternative_pcie_staging_copy.rs rename to crates/cuda-driver/src/original_verify_window_moe/alternative_pcie_staging_copy.rs index f0eb7a80..09fc81d4 100644 --- a/crates/cuda-driver/src/original_verify_window_moe/tests/alternative_pcie_staging_copy.rs +++ b/crates/cuda-driver/src/original_verify_window_moe/alternative_pcie_staging_copy.rs @@ -74,10 +74,10 @@ fn assert_expert_format_qk(iq: &str) { #[test] fn expert_entries_match_the_cu_source_and_the_original_format_lists() { - let cu = include_str!("../../original_verify_window_moe_experts.cu"); + let cu = include_str!("../original_verify_window_moe_experts.cu"); assert!(cu.contains("window_moe_gu_##T") && cu.contains("window_moe_down_##T")); assert!(cu.contains("STRATA_GU_FMTS(STRATA_WINDOW_GU)") && cu.contains("STRATA_D_FMTS(STRATA_WINDOW_DOWN)")); - let iq = include_str!("../../mtp_original_full_head_iq.cu"); + let iq = include_str!("../mtp_original_full_head_iq.cu"); assert_expert_entry_tables(iq); // the Original's per-type values-per-block (Fmt::qk) used by native_expert_supported assert_expert_format_qk(iq); diff --git a/crates/cuda-driver/src/original_verify_window_moe/tests/down_sub16_plan.rs b/crates/cuda-driver/src/original_verify_window_moe/down_sub16_plan.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_moe/tests/down_sub16_plan.rs rename to crates/cuda-driver/src/original_verify_window_moe/down_sub16_plan.rs diff --git a/crates/cuda-driver/src/original_verify_window_moe/tests/hit_add_scans_the_cpu.rs b/crates/cuda-driver/src/original_verify_window_moe/hit_add_scans_the_cpu.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_moe/tests/hit_add_scans_the_cpu.rs rename to crates/cuda-driver/src/original_verify_window_moe/hit_add_scans_the_cpu.rs diff --git a/crates/cuda-driver/src/original_verify_window_moe/tests/shared_gate_without_native_bf16.rs b/crates/cuda-driver/src/original_verify_window_moe/shared_gate_without_native_bf16.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_moe/tests/shared_gate_without_native_bf16.rs rename to crates/cuda-driver/src/original_verify_window_moe/shared_gate_without_native_bf16.rs diff --git a/crates/cuda-driver/src/original_verify_window_moe/tests.rs b/crates/cuda-driver/src/original_verify_window_moe/tests.rs index 88f4cf07..a40b5bed 100644 --- a/crates/cuda-driver/src/original_verify_window_moe/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_moe/tests.rs @@ -68,11 +68,7 @@ fn assert_abi(launches: &[Launch]) { } } -#[path = "tests/alternative_pcie_staging_copy.rs"] mod alternative_pcie_staging_copy; -#[path = "tests/down_sub16_plan.rs"] mod down_sub16_plan; -#[path = "tests/hit_add_scans_the_cpu.rs"] mod hit_add_scans_the_cpu; -#[path = "tests/shared_gate_without_native_bf16.rs"] mod shared_gate_without_native_bf16; diff --git a/crates/cuda-driver/src/original_verify_window_planner/tests/combine_head_switches.rs b/crates/cuda-driver/src/original_verify_window_planner/combine_head_switches.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_planner/tests/combine_head_switches.rs rename to crates/cuda-driver/src/original_verify_window_planner/combine_head_switches.rs diff --git a/crates/cuda-driver/src/original_verify_window_planner/tests/every_window_size_and_group.rs b/crates/cuda-driver/src/original_verify_window_planner/every_window_size_and_group.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_planner/tests/every_window_size_and_group.rs rename to crates/cuda-driver/src/original_verify_window_planner/every_window_size_and_group.rs diff --git a/crates/cuda-driver/src/original_verify_window_planner/tests/fused_gr_down.rs b/crates/cuda-driver/src/original_verify_window_planner/fused_gr_down.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_planner/tests/fused_gr_down.rs rename to crates/cuda-driver/src/original_verify_window_planner/fused_gr_down.rs diff --git a/crates/cuda-driver/src/original_verify_window_planner/tests/fused_qsa_prelude.rs b/crates/cuda-driver/src/original_verify_window_planner/fused_qsa_prelude.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_planner/tests/fused_qsa_prelude.rs rename to crates/cuda-driver/src/original_verify_window_planner/fused_qsa_prelude.rs diff --git a/crates/cuda-driver/src/original_verify_window_planner/tests/head_chain_batch.rs b/crates/cuda-driver/src/original_verify_window_planner/head_chain_batch.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_planner/tests/head_chain_batch.rs rename to crates/cuda-driver/src/original_verify_window_planner/head_chain_batch.rs diff --git a/crates/cuda-driver/src/original_verify_window_planner/tests.rs b/crates/cuda-driver/src/original_verify_window_planner/tests.rs index 22070b12..0bc5d7b1 100644 --- a/crates/cuda-driver/src/original_verify_window_planner/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_planner/tests.rs @@ -339,13 +339,8 @@ fn names(log: &[String]) -> Vec<&str> { log.iter().map(String::as_str).collect() } -#[path = "tests/combine_head_switches.rs"] mod combine_head_switches; -#[path = "tests/every_window_size_and_group.rs"] mod every_window_size_and_group; -#[path = "tests/fused_gr_down.rs"] mod fused_gr_down; -#[path = "tests/fused_qsa_prelude.rs"] mod fused_qsa_prelude; -#[path = "tests/head_chain_batch.rs"] mod head_chain_batch; diff --git a/crates/cuda-driver/src/original_verify_window_qsa/tests/q_path_per_token_splits.rs b/crates/cuda-driver/src/original_verify_window_qsa/q_path_per_token_splits.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_qsa/tests/q_path_per_token_splits.rs rename to crates/cuda-driver/src/original_verify_window_qsa/q_path_per_token_splits.rs diff --git a/crates/cuda-driver/src/original_verify_window_qsa/tests/sealed_assets_are_pinned.rs b/crates/cuda-driver/src/original_verify_window_qsa/sealed_assets_are_pinned.rs similarity index 98% rename from crates/cuda-driver/src/original_verify_window_qsa/tests/sealed_assets_are_pinned.rs rename to crates/cuda-driver/src/original_verify_window_qsa/sealed_assets_are_pinned.rs index c0e8909d..5de32c38 100644 --- a/crates/cuda-driver/src/original_verify_window_qsa/tests/sealed_assets_are_pinned.rs +++ b/crates/cuda-driver/src/original_verify_window_qsa/sealed_assets_are_pinned.rs @@ -25,14 +25,14 @@ fn the_new_gate_asset_is_sealed_with_a_matching_source() { // Sealed with nvcc 13.2.86 on 2026-10-15; structure and pin only (no numerical claim). GATE.assert_sealed_and_fail_closed(); assert_eq!(GATE.ptx.iter().filter(|&&b| b == 0).count(), 1); - let source = include_str!("../../original_verify_window_qsa_gate.cu"); + let source = include_str!("../original_verify_window_qsa_gate.cu"); for e in GATE.entries { assert!(source.contains(&format!("extern \"C\" __global__ void {e}(")), "{e}"); } // the body is the Original `gate`: second half of each [head][2][head_dim] row assert!(source.contains("q_full[head * 2 * head_dim + head_dim + channel]")); assert!(source.contains("1.0f / (1.0f + expf(-raw))")); - assert!(include_str!("../../../../../docs/cuda-seal-plan-additions-window.json").contains("--use_fast_math")); + assert!(include_str!("../../../../docs/cuda-seal-plan-additions-window.json").contains("--use_fast_math")); } #[test] diff --git a/crates/cuda-driver/src/original_verify_window_qsa/tests.rs b/crates/cuda-driver/src/original_verify_window_qsa/tests.rs index c5d18da4..66b53468 100644 --- a/crates/cuda-driver/src/original_verify_window_qsa/tests.rs +++ b/crates/cuda-driver/src/original_verify_window_qsa/tests.rs @@ -62,9 +62,6 @@ fn rope_param_count() -> usize { } } -#[path = "tests/q_path_per_token_splits.rs"] mod q_path_per_token_splits; -#[path = "tests/sealed_assets_are_pinned.rs"] mod sealed_assets_are_pinned; -#[path = "tests/weight_sizes_are_the_original.rs"] mod weight_sizes_are_the_original; diff --git a/crates/cuda-driver/src/original_verify_window_qsa/tests/weight_sizes_are_the_original.rs b/crates/cuda-driver/src/original_verify_window_qsa/weight_sizes_are_the_original.rs similarity index 100% rename from crates/cuda-driver/src/original_verify_window_qsa/tests/weight_sizes_are_the_original.rs rename to crates/cuda-driver/src/original_verify_window_qsa/weight_sizes_are_the_original.rs diff --git a/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs b/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs index a3f05f75..3351a5ff 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs @@ -81,11 +81,7 @@ pub(crate) struct KernelModule { unload: Destroy, } -#[path = "driver_backed/library.rs"] mod library; -#[allow(unused_imports)] use library::check; -#[path = "driver_backed/blas.rs"] mod blas; -#[path = "driver_backed/kernel_module_launch_and_close.rs"] mod kernel_module_launch_and_close; diff --git a/crates/cuda-driver/src/ple_batch_queue.rs b/crates/cuda-driver/src/ple_batch_queue.rs index 6449ccdd..5c872422 100644 --- a/crates/cuda-driver/src/ple_batch_queue.rs +++ b/crates/cuda-driver/src/ple_batch_queue.rs @@ -81,21 +81,13 @@ enum Command { } mod assets; -#[allow(unused_imports)] use assets::assets; mod ple_batch_queue_drop; mod ple_batch_queue_operations; -#[allow(unused_imports)] use ple_batch_queue_drop::ScanExtent; -#[allow(unused_imports)] use ple_batch_queue_drop::decode; -#[allow(unused_imports)] use ple_batch_queue_drop::float_owner; -#[allow(unused_imports)] use ple_batch_queue_drop::float_staging; -#[allow(unused_imports)] use ple_batch_queue_drop::push; -#[allow(unused_imports)] use ple_batch_queue_drop::scan; -#[allow(unused_imports)] use ple_batch_queue_drop::staging; diff --git a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs index f7008397..a60cac91 100644 --- a/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs +++ b/crates/cuda-driver/src/ple_batch_queue/ple_batch_queue_operations/ple_batch_queue_compose.rs @@ -1,8 +1,6 @@ //! Methods of `PleBatchQueue`: `compose`. //! Split out of `ple_batch_queue_methods` to keep its files under the line limit. -#[allow(unused_imports)] -use super::compose_phases::BatchHost; use super::{NativeBatchWorkspace, PleBatchCompletion, PleBatchQueue, PleBatchSources, PleClosedWeights, Result}; impl<'ctx> PleBatchQueue<'ctx> { diff --git a/crates/cuda-driver/src/ple_value_full_gpu.rs b/crates/cuda-driver/src/ple_value_full_gpu_tests.rs similarity index 100% rename from crates/cuda-driver/src/ple_value_full_gpu.rs rename to crates/cuda-driver/src/ple_value_full_gpu_tests.rs diff --git a/crates/cuda-driver/src/qsa_late.rs b/crates/cuda-driver/src/qsa_late.rs index df4b2313..c060a944 100644 --- a/crates/cuda-driver/src/qsa_late.rs +++ b/crates/cuda-driver/src/qsa_late.rs @@ -141,5 +141,4 @@ mod tests { } #[cfg(test)] -#[path = "qsa_late_gpu.rs"] mod gpu_tests; diff --git a/crates/cuda-driver/src/qsa_late_gpu.rs b/crates/cuda-driver/src/qsa_late/gpu_tests.rs similarity index 79% rename from crates/cuda-driver/src/qsa_late_gpu.rs rename to crates/cuda-driver/src/qsa_late/gpu_tests.rs index 6e1f2985..8ace773d 100644 --- a/crates/cuda-driver/src/qsa_late_gpu.rs +++ b/crates/cuda-driver/src/qsa_late/gpu_tests.rs @@ -29,9 +29,10 @@ fn selection_kernels_equal_the_originals_at_long_positions() { with_gpu(|context, stream, max_blocks| { let guard = context.enter().expect("enter"); let select = - KernelModule::load(include_bytes!("qsa_prompt_select.ptx"), &[c"qsa_topk_ref"]).expect("select module"); + KernelModule::load(include_bytes!("../qsa_prompt_select.ptx"), &[c"qsa_topk_ref"]).expect("select module"); let index = - KernelModule::load(include_bytes!("qsa_prompt_indexer.ptx"), &[c"qsa_score_scan"]).expect("index module"); + KernelModule::load(include_bytes!("../qsa_prompt_indexer.ptx"), &[c"qsa_score_scan"]) + .expect("index module"); let late = KernelModule::load(PTX, ENTRIES).expect("late module"); guard.finish().expect("finish"); let mut rng = Rng(0x243f6a8885a308d3); @@ -79,7 +80,7 @@ fn topk_variants_equal_the_original_and_are_timed() { with_gpu(|context, stream, max_blocks| { let guard = context.enter().expect("enter"); let select = - KernelModule::load(include_bytes!("qsa_prompt_select.ptx"), &[c"qsa_topk_ref"]).expect("select module"); + KernelModule::load(include_bytes!("../qsa_prompt_select.ptx"), &[c"qsa_topk_ref"]).expect("select module"); let late = KernelModule::load(PTX, ENTRIES).expect("late module"); let cluster = KernelModule::load(crate::qsa_cluster::PTX, crate::qsa_cluster::ENTRIES).expect("cluster module"); guard.finish().expect("finish"); @@ -103,7 +104,7 @@ fn decode_scores_are_timed_next_to_the_topk() { with_gpu(|context, stream, max_blocks| { let guard = context.enter().expect("enter"); let select = - KernelModule::load(include_bytes!("qsa_prompt_select.ptx"), &[c"qsa_decode_scores", c"qsa_topk_ref"]) + KernelModule::load(include_bytes!("../qsa_prompt_select.ptx"), &[c"qsa_decode_scores", c"qsa_topk_ref"]) .expect("select module"); guard.finish().expect("finish"); let mut rng = Rng(0x1234_5678_9abc_def1); @@ -113,51 +114,19 @@ fn decode_scores_are_timed_next_to_the_topk() { }); } -#[path = "qsa_late_gpu/rng.rs"] mod rng; -#[allow(unused_imports)] use rng::download; -#[allow(unused_imports)] use rng::f32_raw; -#[allow(unused_imports)] use rng::handle; -#[allow(unused_imports)] -use rng::scan_flags_match_original; -#[allow(unused_imports)] -use rng::scores_with_variant; -#[allow(unused_imports)] use rng::selection_case; -#[allow(unused_imports)] -use rng::selection_scores; -#[allow(unused_imports)] use rng::step_bytes; -#[allow(unused_imports)] use rng::topk_args; -#[allow(unused_imports)] -use rng::topk_matches_original; -#[allow(unused_imports)] use rng::upload; -#[allow(unused_imports)] use rng::with_gpu; -#[path = "qsa_late_gpu/scan_both.rs"] mod scan_both; -#[allow(unused_imports)] use scan_both::bench_case; -#[allow(unused_imports)] use scan_both::bench_cases; -#[allow(unused_imports)] -use scan_both::bench_scores; -#[allow(unused_imports)] use scan_both::decode_inputs; -#[allow(unused_imports)] use scan_both::scan_both; -#[allow(unused_imports)] -use scan_both::time_variant; -#[allow(unused_imports)] -use scan_both::topk_variants; -#[path = "qsa_late_gpu/time_scores_and_topk.rs"] mod time_scores_and_topk; -#[allow(unused_imports)] use time_scores_and_topk::time_scores_and_topk; -#[allow(unused_imports)] -use time_scores_and_topk::time_warm; diff --git a/crates/cuda-driver/src/qsa_late_gpu/rng.rs b/crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs similarity index 100% rename from crates/cuda-driver/src/qsa_late_gpu/rng.rs rename to crates/cuda-driver/src/qsa_late/gpu_tests/rng.rs diff --git a/crates/cuda-driver/src/qsa_late_gpu/scan_both.rs b/crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs similarity index 100% rename from crates/cuda-driver/src/qsa_late_gpu/scan_both.rs rename to crates/cuda-driver/src/qsa_late/gpu_tests/scan_both.rs diff --git a/crates/cuda-driver/src/qsa_late_gpu/time_scores_and_topk.rs b/crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs similarity index 100% rename from crates/cuda-driver/src/qsa_late_gpu/time_scores_and_topk.rs rename to crates/cuda-driver/src/qsa_late/gpu_tests/time_scores_and_topk.rs diff --git a/crates/cuda-driver/src/qsa_native_batch.rs b/crates/cuda-driver/src/qsa_native_batch.rs index df368b03..d4a7df4a 100644 --- a/crates/cuda-driver/src/qsa_native_batch.rs +++ b/crates/cuda-driver/src/qsa_native_batch.rs @@ -58,6 +58,4 @@ pub struct QsaNativeBatchWorkspace<'ctx> { } mod qsa_native_kind; -#[allow(unused_imports)] -use qsa_native_kind::encoded; mod native_projections; diff --git a/crates/cuda-driver/src/qsa_native_decode.rs b/crates/cuda-driver/src/qsa_native_decode.rs index 1019fb71..bf35964c 100644 --- a/crates/cuda-driver/src/qsa_native_decode.rs +++ b/crates/cuda-driver/src/qsa_native_decode.rs @@ -365,6 +365,5 @@ fn load_decode_module(c: &Context<'_>) -> Result { } } -#[path = "qsa_resident_decode.rs"] mod resident_decode; pub use resident_decode::OriginalQsaResidentDecodeCompletion; diff --git a/crates/cuda-driver/src/qsa_resident_decode.rs b/crates/cuda-driver/src/qsa_native_decode/resident_decode.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_decode.rs rename to crates/cuda-driver/src/qsa_native_decode/resident_decode.rs diff --git a/crates/cuda-driver/src/qsa_prompt_attention.rs b/crates/cuda-driver/src/qsa_prompt_attention.rs index 71802e12..c6c5a977 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention.rs @@ -42,10 +42,8 @@ pub struct QsaPromptAttentionCompletion<'loan, 'ctx> { t: usize, } -#[path = "qsa_prompt_device_attention.rs"] mod device_attention; -#[path = "qsa_resident_attention.rs"] mod resident_attention; pub(crate) use resident_attention::OriginalQsaAttendedKv; @@ -54,5 +52,4 @@ pub use resident_attention::OriginalQsaResidentAttention; mod attention_kernel_plan_and_passes; mod qsa_attention_inputs; mod qsa_prompt_attention_drop; -#[allow(unused_imports)] pub(crate) use qsa_prompt_attention_drop::guard_grid; diff --git a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs index 26f178be..9270213a 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/attention_kernel_plan_and_passes.rs @@ -52,7 +52,5 @@ pub(super) type Runner<'ctx> = fn( mod attention_passes; mod prompt_attention_owner; mod reject_mutual_alias; -#[allow(unused_imports)] pub(super) use reject_mutual_alias::admit_budget; -#[allow(unused_imports)] use reject_mutual_alias::reject_mutual_alias; diff --git a/crates/cuda-driver/src/qsa_prompt_device_attention.rs b/crates/cuda-driver/src/qsa_prompt_attention/device_attention.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_device_attention.rs rename to crates/cuda-driver/src/qsa_prompt_attention/device_attention.rs diff --git a/crates/cuda-driver/src/qsa_resident_attention.rs b/crates/cuda-driver/src/qsa_prompt_attention/resident_attention.rs similarity index 99% rename from crates/cuda-driver/src/qsa_resident_attention.rs rename to crates/cuda-driver/src/qsa_prompt_attention/resident_attention.rs index e8313eb4..58907c12 100644 --- a/crates/cuda-driver/src/qsa_resident_attention.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention/resident_attention.rs @@ -208,7 +208,7 @@ fn load_resident_module(c: &Context<'_>) -> Result { e })?; let load = Module::load( - include_bytes!("qsa_prompt_attention.ptx"), + include_bytes!("../qsa_prompt_attention.ptx"), &[c"leleka_qsa_prompt_guard", c"leleka_qsa_prompt_attn", c"leleka_qsa_prompt_output_guard"], ); let pop = g.finish(); diff --git a/crates/cuda-driver/src/qsa_prompt_index.rs b/crates/cuda-driver/src/qsa_prompt_index.rs index 47b1838b..b1ade19e 100644 --- a/crates/cuda-driver/src/qsa_prompt_index.rs +++ b/crates/cuda-driver/src/qsa_prompt_index.rs @@ -50,37 +50,30 @@ pub struct QsaPromptSelection<'lease, 'ctx> { } mod index_rows; -#[allow(unused_imports)] use index_rows::SelectRequest; pub(crate) use index_rows::{ArenaRows, IndexProgramSpans}; pub use index_rows::{QsaChunkRows, QsaIndexPrior}; -#[path = "qsa_prompt_device_index.rs"] mod device_index; -#[path = "qsa_prompt_device.rs"] mod prompt_device; pub(crate) use prompt_device::kv_stage_spans_of; pub use prompt_device::{ OriginalQsaDeviceSelection, OriginalQsaPromptDevice, OriginalQsaPromptWeights, QsaChunkPrior, QsaKvAppendTarget, }; -#[path = "qsa_resident_index.rs"] mod resident_index; pub use resident_index::{ OriginalQsaIndexBatch, OriginalQsaIndexCheckpoint, OriginalQsaResidentIndex, ResidentContinuation, }; -#[path = "qsa_resident_index_program.rs"] mod resident_program; -#[path = "qsa_resident_transfer.rs"] #[allow(unsafe_code)] pub(crate) mod resident_transfer; pub use prompt_device::{ OriginalQsaResidentAppendTarget, OriginalQsaResidentPromptDevice, OriginalQsaResidentSelection, }; -#[path = "qsa_resident_scalar_index.rs"] mod resident_scalar_index; pub use resident_scalar_index::{OriginalQsaResidentScalarIndex, OriginalQsaResidentScalarSelection, ScalarStepRows}; @@ -88,11 +81,8 @@ pub use resident_scalar_index::{OriginalQsaResidentScalarIndex, OriginalQsaResid pub use resident_index::verification_commit::{OriginalQsaOwners, OriginalVerifyQsaJournal, OriginalVerifyRope}; mod max_blocks; -#[allow(unused_imports)] use max_blocks::encode; -#[allow(unused_imports)] use max_blocks::max_blocks; -#[allow(unused_imports)] use max_blocks::sizes; mod append_select; mod index_run; diff --git a/crates/cuda-driver/src/qsa_prompt_device_index.rs b/crates/cuda-driver/src/qsa_prompt_index/device_index.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_device_index.rs rename to crates/cuda-driver/src/qsa_prompt_index/device_index.rs diff --git a/crates/cuda-driver/src/qsa_prompt_device.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device.rs similarity index 86% rename from crates/cuda-driver/src/qsa_prompt_device.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device.rs index 1c8e3df6..53473e7f 100644 --- a/crates/cuda-driver/src/qsa_prompt_device.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device.rs @@ -13,7 +13,7 @@ use crate::{ QsaNativePacking, QsaNativeWeight, QsaPromptAttention, QsaPromptKv, QsaPromptStage, }; const SCRATCH: usize = 64 << 20; -const GATE_PTX: &[u8] = concat!(include_str!("qsa_prompt_device_gate.ptx"), "\0").as_bytes(); +const GATE_PTX: &[u8] = concat!(include_str!("../qsa_prompt_device_gate.ptx"), "\0").as_bytes(); const GATE_SHA: [u8; 32] = [ 0x69, 0xf0, 0x3b, 0xe1, 0x7d, 0xb1, 0x7a, 0xba, 0x2f, 0x82, 0x8c, 0xf4, 0x37, 0x91, 0x0a, 0x4d, 0xb6, 0x63, 0x23, 0x97, 0x3d, 0xaa, 0x8b, 0x1a, 0x45, 0x9c, 0x24, 0x18, 0xf9, 0x11, 0x45, 0xd4, @@ -68,30 +68,19 @@ pub struct OriginalQsaDeviceSelection<'lease, 'arena, 'loan, 'ctx> { state: QsaPromptIndexState, } -#[path = "qsa_resident_device.rs"] mod resident_device; pub(crate) use resident_device::kv_stage_spans_of; pub use resident_device::{ OriginalQsaResidentAppendTarget, OriginalQsaResidentPromptDevice, OriginalQsaResidentSelection, }; -#[path = "qsa_prompt_device/context.rs"] mod context; -#[allow(unused_imports)] use context::arena_span; -#[allow(unused_imports)] use context::common; -#[allow(unused_imports)] use context::native_block; -#[allow(unused_imports)] use context::native_entry; -#[path = "qsa_prompt_device/device_phases.rs"] mod device_phases; -#[path = "qsa_prompt_device/device_prepare.rs"] mod device_prepare; -#[path = "qsa_prompt_device/original_qsa_prompt_device.rs"] mod original_qsa_prompt_device; -#[path = "qsa_prompt_device/project_phases.rs"] mod project_phases; -#[path = "qsa_prompt_device/selection_completion.rs"] mod selection_completion; diff --git a/crates/cuda-driver/src/qsa_prompt_device/context.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_device/context.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/context.rs diff --git a/crates/cuda-driver/src/qsa_prompt_device/device_phases.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_phases.rs similarity index 98% rename from crates/cuda-driver/src/qsa_prompt_device/device_phases.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_phases.rs index 35a2c440..e7bdd0be 100644 --- a/crates/cuda-driver/src/qsa_prompt_device/device_phases.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_phases.rs @@ -52,7 +52,7 @@ fn load_dequant() -> Result { return KernelModule::load(crate::prefill_stage::PTX, crate::prefill_stage::ENTRIES); } KernelModule::load( - concat!(include_str!("../offline_native_dequant_f16.ptx"), "\0").as_bytes(), + concat!(include_str!("../../offline_native_dequant_f16.ptx"), "\0").as_bytes(), &[ c"leleka_native_dequant_f16_q4_k", c"leleka_native_dequant_f16_q5_k", @@ -134,7 +134,7 @@ impl<'ctx> OriginalQsaPromptDevice<'ctx> { Some(Module::load(INDEX, SELECT, POSTOPS, DECODE_POSTOPS)?); self.dequant = Some(load_dequant()?); self.pack = Some(KernelModule::load( - concat!(include_str!("../qsa_native_batch.ptx"), "\0").as_bytes(), + concat!(include_str!("../../qsa_native_batch.ptx"), "\0").as_bytes(), &[c"qsa_pack", c"qsa_gate_pack", c"qsa_scan_half"], )?); self.gate = Some(KernelModule::load(GATE_PTX, &[c"qsa_prompt_device_gate"])?); diff --git a/crates/cuda-driver/src/qsa_prompt_device/device_prepare.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs similarity index 99% rename from crates/cuda-driver/src/qsa_prompt_device/device_prepare.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs index 9f1531a0..fa131b98 100644 --- a/crates/cuda-driver/src/qsa_prompt_device/device_prepare.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/device_prepare.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalQsaPromptDevice`: `project`, `prepare`, `close`. //! Split out of `prompt_device` to keep its files under the line limit. -#[allow(unused_imports)] use super::project_phases::{ProjectArgs, Projection}; use super::{ ArenaRows, Error, IndexProgramSpans, NativeBatchWorkspace, OriginalDeviceGrRead, OriginalQsaDeviceSelection, diff --git a/crates/cuda-driver/src/qsa_prompt_device/original_qsa_prompt_device.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs similarity index 99% rename from crates/cuda-driver/src/qsa_prompt_device/original_qsa_prompt_device.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs index a5f8ce8c..c2c08673 100644 --- a/crates/cuda-driver/src/qsa_prompt_device/original_qsa_prompt_device.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/original_qsa_prompt_device.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalQsaPromptDevice`: `device_bytes`, `new`, `is_failed`, `allocated_bytes` and 2 more. //! Split out of `prompt_device` to keep its files under the line limit. -#[allow(unused_imports)] use super::device_phases::{check_assets, index_for}; use super::{ Context, DeviceBuffer, Error, NativeBatchWorkspace, OriginalDeviceGrRead, OriginalQsaPromptDevice, diff --git a/crates/cuda-driver/src/qsa_prompt_device/project_phases.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/project_phases.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_device/project_phases.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/project_phases.rs diff --git a/crates/cuda-driver/src/qsa_resident_device.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device.rs similarity index 89% rename from crates/cuda-driver/src/qsa_resident_device.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device.rs index 44ee17ea..ff6e66a1 100644 --- a/crates/cuda-driver/src/qsa_resident_device.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device.rs @@ -31,11 +31,7 @@ pub struct OriginalQsaResidentPromptDevice<'ctx> { inner: OriginalQsaPromptDevice<'ctx>, } -#[path = "qsa_resident_device/original_qsa_prompt_device.rs"] mod original_qsa_prompt_device; -#[allow(unused_imports)] pub(crate) use original_qsa_prompt_device::kv_stage_spans_of; -#[path = "qsa_resident_device/qsa_prompt_device_resident_bring_up.rs"] mod qsa_prompt_device_resident_bring_up; -#[path = "qsa_resident_device/qsa_resident_prompt_device_prepare.rs"] mod qsa_resident_prompt_device_prepare; diff --git a/crates/cuda-driver/src/qsa_resident_device/original_qsa_prompt_device.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_device/original_qsa_prompt_device.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/original_qsa_prompt_device.rs diff --git a/crates/cuda-driver/src/qsa_resident_device/qsa_prompt_device_resident_bring_up.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs similarity index 96% rename from crates/cuda-driver/src/qsa_resident_device/qsa_prompt_device_resident_bring_up.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs index 4e7c19c0..b0db41c3 100644 --- a/crates/cuda-driver/src/qsa_resident_device/qsa_prompt_device_resident_bring_up.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_prompt_device_resident_bring_up.rs @@ -116,7 +116,7 @@ impl<'ctx> OriginalQsaPromptDevice<'ctx> { Some(Module::load(INDEX, SELECT, POSTOPS, DECODE_POSTOPS)?); self.dequant = Some(Self::load_dequant()?); self.pack = Some(KernelModule::load( - concat!(include_str!("../qsa_native_batch.ptx"), "\0").as_bytes(), + concat!(include_str!("../../../qsa_native_batch.ptx"), "\0").as_bytes(), &[c"qsa_pack", c"qsa_gate_pack", c"qsa_scan_half"], )?); self.gate = Some(KernelModule::load(GATE_PTX, &[c"qsa_prompt_device_gate"])?); @@ -127,7 +127,7 @@ impl<'ctx> OriginalQsaPromptDevice<'ctx> { return KernelModule::load(crate::prefill_stage::PTX, crate::prefill_stage::ENTRIES); } KernelModule::load( - concat!(include_str!("../offline_native_dequant_f16.ptx"), "\0").as_bytes(), + concat!(include_str!("../../../offline_native_dequant_f16.ptx"), "\0").as_bytes(), &[ c"leleka_native_dequant_f16_q4_k", c"leleka_native_dequant_f16_q5_k", diff --git a/crates/cuda-driver/src/qsa_resident_device/qsa_resident_prompt_device_prepare.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_device/qsa_resident_prompt_device_prepare.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/resident_device/qsa_resident_prompt_device_prepare.rs diff --git a/crates/cuda-driver/src/qsa_prompt_device/selection_completion.rs b/crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_device/selection_completion.rs rename to crates/cuda-driver/src/qsa_prompt_index/prompt_device/selection_completion.rs diff --git a/crates/cuda-driver/src/qsa_resident_index.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index.rs similarity index 88% rename from crates/cuda-driver/src/qsa_resident_index.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index.rs index a6a4fad4..6b61cd18 100644 --- a/crates/cuda-driver/src/qsa_resident_index.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index.rs @@ -5,7 +5,6 @@ use super::{ Context, DeviceBuffer, Error, NativeBatchWorkspace, QsaPromptIndexWorkspace, RESERVE, Result, combine, ffi, sizes, }; // used only with some cargo features or targets of this crate -#[allow(unused_imports)] use super::{DeviceRef, OriginalQsaMappedAppend, OriginalQsaMappedJournal}; use std::{ cell::{Cell, RefCell}, @@ -58,16 +57,10 @@ pub struct OriginalQsaIndexBatch<'index, 'weights, 'ctx> { } #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "qsa_verification_commit.rs"] pub(crate) mod verification_commit; -#[path = "qsa_resident_index/image_bytes.rs"] mod image_bytes; -#[allow(unused_imports)] use image_bytes::image_bytes; -#[path = "qsa_resident_index/original_qsa_index_batch.rs"] mod original_qsa_index_batch; -#[path = "qsa_resident_index/original_qsa_resident_index.rs"] mod original_qsa_resident_index; -#[path = "qsa_resident_index/qsa_resident_index_checkpoint_restore.rs"] mod qsa_resident_index_checkpoint_restore; diff --git a/crates/cuda-driver/src/qsa_resident_index/image_bytes.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_index/image_bytes.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/image_bytes.rs diff --git a/crates/cuda-driver/src/qsa_resident_index/original_qsa_index_batch.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_index/original_qsa_index_batch.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_index_batch.rs diff --git a/crates/cuda-driver/src/qsa_resident_index/original_qsa_resident_index.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_index/original_qsa_resident_index.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/original_qsa_resident_index.rs diff --git a/crates/cuda-driver/src/qsa_resident_index/qsa_resident_index_checkpoint_restore.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_index/qsa_resident_index_checkpoint_restore.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/qsa_resident_index_checkpoint_restore.rs diff --git a/crates/cuda-driver/src/qsa_verification_commit.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit.rs similarity index 85% rename from crates/cuda-driver/src/qsa_verification_commit.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit.rs index 84790efd..267b9adf 100644 --- a/crates/cuda-driver/src/qsa_verification_commit.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit.rs @@ -64,22 +64,13 @@ pub struct OriginalVerifyQsaJournal<'ctx> { ple_snapshot: RefCell>, } -#[path = "qsa_verification_commit/original_verify_rope.rs"] mod original_verify_rope; -#[allow(unused_imports)] use original_verify_rope::overlaps; -#[allow(unused_imports)] use original_verify_rope::whole; -#[path = "qsa_verification_commit/original_verify_qsa_journal.rs"] mod original_verify_qsa_journal; -#[path = "qsa_verification_commit/verify_qsa_journal_loan.rs"] mod verify_qsa_journal_loan; pub use verify_qsa_journal_loan::OriginalQsaOwners; -#[path = "qsa_verification_commit/verify_qsa_journal_capture_commit.rs"] mod verify_qsa_journal_capture_commit; -#[path = "qsa_verification_commit/verify_qsa_journal_index_image.rs"] mod verify_qsa_journal_index_image; -#[path = "qsa_verification_commit/verify_qsa_journal_publish_discard.rs"] mod verify_qsa_journal_publish_discard; -#[path = "qsa_verification_commit/verify_qsa_journal_rearm.rs"] mod verify_qsa_journal_rearm; diff --git a/crates/cuda-driver/src/qsa_verification_commit/original_verify_qsa_journal.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs similarity index 99% rename from crates/cuda-driver/src/qsa_verification_commit/original_verify_qsa_journal.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs index 9b4e0867..486a90ce 100644 --- a/crates/cuda-driver/src/qsa_verification_commit/original_verify_qsa_journal.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_qsa_journal.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalVerifyQsaJournal`: `new`, `validate_context`, `identity`, `with_image` and 10 more. //! Functions: `check_armed_window`, `image_addresses`, `image_clear`, `check_gamma` and 2 more. Defines `Indices`. -#[allow(unused_imports)] use super::verify_qsa_journal_loan::print_of; use super::{ Arg, Cell, Command, Context, DeviceBuffer, DeviceRef, Error, Live, NativeBatchWorkspace, OriginalCapture, diff --git a/crates/cuda-driver/src/qsa_verification_commit/original_verify_rope.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs similarity index 100% rename from crates/cuda-driver/src/qsa_verification_commit/original_verify_rope.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/original_verify_rope.rs diff --git a/crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_capture_commit.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs similarity index 100% rename from crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_capture_commit.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_capture_commit.rs diff --git a/crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_index_image.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_index_image.rs similarity index 100% rename from crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_index_image.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_index_image.rs diff --git a/crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_loan.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_loan.rs similarity index 100% rename from crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_loan.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_loan.rs diff --git a/crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_publish_discard.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs similarity index 100% rename from crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_publish_discard.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_publish_discard.rs diff --git a/crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_rearm.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_rearm.rs similarity index 100% rename from crates/cuda-driver/src/qsa_verification_commit/verify_qsa_journal_rearm.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_index/verification_commit/verify_qsa_journal_rearm.rs diff --git a/crates/cuda-driver/src/qsa_resident_index_program.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_program.rs similarity index 61% rename from crates/cuda-driver/src/qsa_resident_index_program.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_program.rs index 81e725d7..5c15cad7 100644 --- a/crates/cuda-driver/src/qsa_resident_index_program.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_program.rs @@ -5,14 +5,9 @@ use super::{ QsaPromptIndexWorkspace, Result, combine, ffi, max_blocks, }; -#[path = "qsa_resident_index_program/arena_plan.rs"] mod arena_plan; -#[path = "qsa_resident_index_program/prefix_replay.rs"] mod prefix_replay; -#[path = "qsa_resident_index_program/qsa_prompt_index_workspace.rs"] mod qsa_prompt_index_workspace; -#[allow(unused_imports)] -use arena_plan::{ArenaCall, ArenaIo, ArenaPlan, LateLaunch, LateQueue}; +use arena_plan::{ArenaCall, ArenaIo, ArenaPlan, LateQueue}; pub(super) use prefix_replay::ReplayKeySpans; -#[allow(unused_imports)] use prefix_replay::launch_label; diff --git a/crates/cuda-driver/src/qsa_resident_index_program/arena_plan.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_program/arena_plan.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_index_program/arena_plan.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_program/arena_plan.rs diff --git a/crates/cuda-driver/src/qsa_resident_index_program/prefix_replay.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_index_program/prefix_replay.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_program/prefix_replay.rs diff --git a/crates/cuda-driver/src/qsa_resident_index_program/qsa_prompt_index_workspace.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_index_program/qsa_prompt_index_workspace.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_program/qsa_prompt_index_workspace.rs diff --git a/crates/cuda-driver/src/qsa_resident_scalar_index.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_scalar_index.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_scalar_index.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_scalar_index.rs diff --git a/crates/cuda-driver/src/qsa_resident_transfer.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_transfer.rs similarity index 97% rename from crates/cuda-driver/src/qsa_resident_transfer.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_transfer.rs index c14c483f..dc421a67 100644 --- a/crates/cuda-driver/src/qsa_resident_transfer.rs +++ b/crates/cuda-driver/src/qsa_prompt_index/resident_transfer.rs @@ -2,7 +2,6 @@ //! No public address/range API. All source owners remain borrowed until drain. use crate::{Context, Error, NativeBatchWorkspace, Result, combine}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "qsa_resident_transfer/enabled.rs"] mod enabled; #[cfg(not(all( feature = "cuda-driver", diff --git a/crates/cuda-driver/src/qsa_resident_transfer/enabled.rs b/crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs similarity index 100% rename from crates/cuda-driver/src/qsa_resident_transfer/enabled.rs rename to crates/cuda-driver/src/qsa_prompt_index/resident_transfer/enabled.rs diff --git a/crates/cuda-driver/src/qsa_prompt_kv.rs b/crates/cuda-driver/src/qsa_prompt_kv.rs index f858d1f7..2b559c0b 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv.rs @@ -79,31 +79,21 @@ pub struct QsaPromptStage<'ctx> { failed: bool, } -#[path = "qsa_prompt_device_kv.rs"] mod device_kv; -#[path = "qsa_mapped_journal.rs"] mod mapped_journal; pub use mapped_journal::{OriginalQsaMappedAppend, OriginalQsaMappedJournal, OriginalQsaMappedPrefix}; -#[path = "qsa_resident_transport.rs"] mod resident_transport; pub use resident_transport::{OriginalQsaResidentTransport, set_qsa_prefetch_override}; mod offsets; -#[allow(unused_imports)] use offsets::admit; -#[allow(unused_imports)] use offsets::bytes_i32; -#[allow(unused_imports)] pub(crate) use offsets::checked; -#[allow(unused_imports)] use offsets::offsets; -#[allow(unused_imports)] use offsets::resident_runs; -#[allow(unused_imports)] use offsets::stage_runs; mod qsa_prompt_kv_drop; mod staged_append; -#[allow(unused_imports)] pub(crate) use qsa_prompt_kv_drop::read_range; diff --git a/crates/cuda-driver/src/qsa_prompt_device_kv.rs b/crates/cuda-driver/src/qsa_prompt_kv/device_kv.rs similarity index 100% rename from crates/cuda-driver/src/qsa_prompt_device_kv.rs rename to crates/cuda-driver/src/qsa_prompt_kv/device_kv.rs diff --git a/crates/cuda-driver/src/qsa_mapped_journal.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal.rs similarity index 98% rename from crates/cuda-driver/src/qsa_mapped_journal.rs rename to crates/cuda-driver/src/qsa_prompt_kv/mapped_journal.rs index c1416bea..08bbdb5d 100644 --- a/crates/cuda-driver/src/qsa_mapped_journal.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal.rs @@ -245,7 +245,5 @@ mod parked_tests { } } -#[path = "qsa_mapped_journal/original_qsa_mapped_journal.rs"] mod original_qsa_mapped_journal; -#[path = "qsa_mapped_journal/original_qsa_mapped_prefix.rs"] mod original_qsa_mapped_prefix; diff --git a/crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_journal.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs similarity index 100% rename from crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_journal.rs rename to crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_journal.rs diff --git a/crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_prefix.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs similarity index 78% rename from crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_prefix.rs rename to crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs index b5f19edb..a0564a20 100644 --- a/crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_prefix.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix.rs @@ -7,7 +7,5 @@ use super::{ QsaPromptKv, Rc, Result, SelectedRows, checked, stage_runs, }; -#[path = "original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs"] mod qsa_mapped_journal_append_and_resolve; -#[path = "original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs"] mod qsa_mapped_journal_prefix_and_prefetch; diff --git a/crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs similarity index 99% rename from crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs rename to crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs index f69a3e6d..97d17853 100644 --- a/crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs @@ -1,7 +1,6 @@ //! Methods of `OriginalQsaMappedJournal`: `append_resident_arena`, `arena_plan`, `stage_arena`, `stage_prefix_from_h... //! Split out of `original_qsa_mapped_prefix` to keep its files under the line limit. -#[allow(unused_imports)] use super::super::original_qsa_mapped_journal::AppendPlan; use super::{ DeviceBuffer, Error, NativeBatchWorkspace, OriginalQsaMappedAppend, OriginalQsaMappedJournal, diff --git a/crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs b/crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs similarity index 100% rename from crates/cuda-driver/src/qsa_mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs rename to crates/cuda-driver/src/qsa_prompt_kv/mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_prefix_and_prefetch.rs diff --git a/crates/cuda-driver/src/qsa_resident_transport.rs b/crates/cuda-driver/src/qsa_prompt_kv/resident_transport.rs similarity index 99% rename from crates/cuda-driver/src/qsa_resident_transport.rs rename to crates/cuda-driver/src/qsa_prompt_kv/resident_transport.rs index 7e0f39be..643b9d4b 100644 --- a/crates/cuda-driver/src/qsa_resident_transport.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv/resident_transport.rs @@ -40,7 +40,7 @@ impl<'ctx> OriginalQsaResidentTransport<'ctx> { e })?; let load = Module::load( - include_bytes!("qsa_prompt_kv.ptx"), + include_bytes!("../qsa_prompt_kv.ptx"), &[c"leleka_qsa_kv_guard", c"leleka_qsa_kv_append", c"leleka_qsa_kv_scale_guard"], ); let pop = g.finish(); diff --git a/crates/cuda-driver/src/qsa_selected_kv.rs b/crates/cuda-driver/src/qsa_selected_kv.rs index 9740adcb..98af2538 100644 --- a/crates/cuda-driver/src/qsa_selected_kv.rs +++ b/crates/cuda-driver/src/qsa_selected_kv.rs @@ -49,11 +49,8 @@ pub struct QsaSelectedKvProducts<'lease, 'ctx> { mod selected_kv_installed; mod asset; -#[allow(unused_imports)] pub(crate) use asset::asset; mod qsa_selected_kv_attend_io; mod qsa_selected_kv_workspace; -#[allow(unused_imports)] use qsa_selected_kv_attend_io::owned_bytes; -#[allow(unused_imports)] use qsa_selected_kv_attend_io::slot_bytes; diff --git a/crates/cuda-driver/src/qwen_dispatch.rs b/crates/cuda-driver/src/qwen_dispatch.rs index 80ebc0dc..578112d1 100644 --- a/crates/cuda-driver/src/qwen_dispatch.rs +++ b/crates/cuda-driver/src/qwen_dispatch.rs @@ -6,7 +6,6 @@ use crate::{ }; use std::{cell::Cell, rc::Rc}; pub(crate) mod fixed_operands; -#[path = "gr_batch_read.rs"] pub(crate) mod gr_batch_read; pub(super) struct Cache { @@ -36,7 +35,6 @@ struct Admission<'asset> { #[cfg(test)] mod tests; -#[path = "batch_gr_preview.rs"] pub(crate) mod batch_gr_preview; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] @@ -45,71 +43,52 @@ mod queued_gr_installed; #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] mod gdn_products_installed; -#[path = "qwen_shared_tail.rs"] pub(crate) mod qwen_shared_tail; // Additive closed MTP input prefix; original dispatch stays byte-exact. -#[path = "mtp_input_workspace.rs"] pub(crate) mod mtp_input_workspace; // Additive closed GDN row stage queue; original GDN dispatch stays byte-exact. -#[path = "gdn_closed_queue.rs"] pub(crate) mod gdn_closed_queue; // Closed batched GDN program of the Strata PREFILL path (option B); needs the // Root-built PTX images and pins, so it is wired in last (see gdn_native_batch.rs). #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -#[path = "gdn_native_batch.rs"] pub(crate) mod gdn_native_batch; // Closed batched MoE router + shared-expert program of the Strata PREFILL path; needs the Root-built PTX image and // pin, so it is wired in last (see moe_prefill_batch.rs). #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -#[path = "moe_prefill_batch.rs"] pub(crate) mod moe_prefill_batch; // Closed single-token fused GDN program of the Original Strata engine (default `no_fused_gdn = false`); needs the // Root-built PTX image and pin, so it is wired in last (see gdn_fused_t1.rs). #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -#[path = "gdn_fused_t1.rs"] pub(crate) mod gdn_fused_t1; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -#[path = "gr_batch_inject_workspace.rs"] pub(crate) mod gr_batch_inject_workspace; // Closed original PLE whole-role queue; old entry bodies remain unchanged. -#[path = "ple_closed_queue.rs"] pub(crate) mod ple_closed_queue; -#[path = "gr_native_batch.rs"] pub(crate) mod gr_native_batch; mod cache; -#[allow(unused_imports)] use cache::execute; -#[allow(unused_imports)] use cache::prepare_pair; -#[allow(unused_imports)] use cache::registered; -#[allow(unused_imports)] use cache::restore; mod prepare_gr_read_set; -#[allow(unused_imports)] +#[cfg(test)] use prepare_gr_read_set::native_span; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -#[allow(unused_imports)] use prepare_gr_read_set::prepare_gr_read_set; #[cfg(test)] -#[allow(unused_imports)] use prepare_gr_read_set::ranges; -#[allow(unused_imports)] use prepare_gr_read_set::ranges_layout; -#[allow(unused_imports)] use prepare_gr_read_set::unload; mod admission; -#[allow(unused_imports)] use admission::admission; -#[allow(unused_imports)] use admission::owned_mtp_scratch; mod context; diff --git a/crates/cuda-driver/src/batch_gr_preview.rs b/crates/cuda-driver/src/qwen_dispatch/batch_gr_preview.rs similarity index 99% rename from crates/cuda-driver/src/batch_gr_preview.rs rename to crates/cuda-driver/src/qwen_dispatch/batch_gr_preview.rs index 13cebb44..982bcfab 100644 --- a/crates/cuda-driver/src/batch_gr_preview.rs +++ b/crates/cuda-driver/src/qwen_dispatch/batch_gr_preview.rs @@ -2,7 +2,6 @@ //! Numerical experiment only; no production asset admission or session commit. use super::{Context, DeviceBuffer, Error, Operation, Result, qwen_ffi}; // used only with some cargo features or targets of this crate -#[allow(unused_imports)] use super::{Arguments, Backend, combine, ffi, ranges_layout}; /// The four device buffers of one batched residual-inject launch. pub struct GrInjectBuffers<'a, 'b> { diff --git a/crates/cuda-driver/src/qwen_dispatch/context.rs b/crates/cuda-driver/src/qwen_dispatch/context.rs index f40fb0a2..bd155605 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context.rs @@ -8,17 +8,10 @@ use super::{ }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -#[path = "context/context_gr_gate_mean_inject.rs"] mod context_gr_gate_mean_inject; -#[path = "context/gdn_ple_fixed_kernels.rs"] mod gdn_ple_fixed_kernels; -#[path = "context/gdn_step_kernels.rs"] mod gdn_step_kernels; -#[path = "context/gr_read_chain.rs"] mod gr_read_chain; -#[path = "context/mtp_dense_attention.rs"] mod mtp_dense_attention; -#[path = "context/mtp_fixed_kernels.rs"] mod mtp_fixed_kernels; -#[path = "context/qsa_fixed_kernels.rs"] mod qsa_fixed_kernels; diff --git a/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs b/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs index 9809f139..b15705cc 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/gr_read_chain.rs @@ -6,7 +6,6 @@ use super::{ Admission, Asset, Context, DeviceBuffer, Error, Operation, Result, admission, ffi, prepare_gr_read_set, qwen_ffi, }; // used only with some cargo features or targets of this crate -#[allow(unused_imports)] use super::{Arguments, FixedKernel, combine}; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] diff --git a/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs b/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs index 2f41c504..33e1e330 100644 --- a/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs +++ b/crates/cuda-driver/src/qwen_dispatch/context/mtp_fixed_kernels.rs @@ -1,7 +1,6 @@ //! Methods of `Context`: `mtp_gr_attention_down`, `mtp_gr_attention_up`, `mtp_gr_mlp_down`, `mtp_gr_mlp_up` and 11 m... //! Split out of `context` to keep its files under the line limit. -#[allow(unused_imports)] use super::fixed_operands::{ MtpGrMlpOutputs, MtpGrMlpResidual, MtpGrProducts, MtpGrWeights, MtpQuantizedInput, MtpS2SelectedExpert, MtpS2TileWeights, diff --git a/crates/cuda-driver/src/gdn_closed_queue.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue.rs similarity index 97% rename from crates/cuda-driver/src/gdn_closed_queue.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue.rs index 66c0d76b..4421fed3 100644 --- a/crates/cuda-driver/src/gdn_closed_queue.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue.rs @@ -254,18 +254,11 @@ mod tests { } #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gdn_closed_queue_gpu.rs"] mod gpu; -#[path = "gdn_closed_queue/gdn_queue_stage.rs"] mod gdn_queue_stage; -#[allow(unused_imports)] use gdn_queue_stage::column_row_offset; -#[allow(unused_imports)] use gdn_queue_stage::decode_statuses; -#[path = "gdn_closed_queue/gdn_row_prefix.rs"] mod gdn_row_prefix; -#[path = "gdn_closed_queue/gdn_row_queue.rs"] mod gdn_row_queue; -#[allow(unused_imports)] use gdn_row_queue::staging; diff --git a/crates/cuda-driver/src/gdn_closed_queue/gdn_queue_stage.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs similarity index 100% rename from crates/cuda-driver/src/gdn_closed_queue/gdn_queue_stage.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_queue_stage.rs diff --git a/crates/cuda-driver/src/gdn_closed_queue/gdn_row_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs similarity index 81% rename from crates/cuda-driver/src/gdn_closed_queue/gdn_row_prefix.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs index e3237a7b..9c1210b6 100644 --- a/crates/cuda-driver/src/gdn_closed_queue/gdn_row_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix.rs @@ -8,9 +8,6 @@ use super::{ decode_statuses, ffi, qwen_ffi, ranges_layout, staging, }; -#[path = "gdn_row_prefix/convolution_stages.rs"] mod convolution_stages; -#[path = "gdn_row_prefix/gdn_row_prefix_fenced_drain.rs"] mod gdn_row_prefix_fenced_drain; -#[path = "gdn_row_prefix/recurrence_stages.rs"] mod recurrence_stages; diff --git a/crates/cuda-driver/src/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs similarity index 100% rename from crates/cuda-driver/src/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/convolution_stages.rs diff --git a/crates/cuda-driver/src/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs similarity index 100% rename from crates/cuda-driver/src/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/gdn_row_prefix_fenced_drain.rs diff --git a/crates/cuda-driver/src/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs similarity index 100% rename from crates/cuda-driver/src/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_prefix/recurrence_stages.rs diff --git a/crates/cuda-driver/src/gdn_closed_queue/gdn_row_queue.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs similarity index 100% rename from crates/cuda-driver/src/gdn_closed_queue/gdn_row_queue.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gdn_row_queue.rs diff --git a/crates/cuda-driver/src/gdn_closed_queue_gpu.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu.rs similarity index 84% rename from crates/cuda-driver/src/gdn_closed_queue_gpu.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu.rs index 82983e0a..82353aa5 100644 --- a/crates/cuda-driver/src/gdn_closed_queue_gpu.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu.rs @@ -74,37 +74,17 @@ fn queued_gdn_row_matches_scalar_calls_orders_refusals_and_cleans_up() { ); } -#[path = "gdn_closed_queue_gpu/bytes.rs"] mod bytes; -#[path = "gdn_closed_queue_gpu/scenarios.rs"] mod scenarios; -#[allow(unused_imports)] use bytes::blank; -#[allow(unused_imports)] use bytes::bytes; -#[allow(unused_imports)] use bytes::column_image; -#[allow(unused_imports)] -use bytes::pattern; -#[allow(unused_imports)] use bytes::queued; -#[allow(unused_imports)] use bytes::queued_columns; -#[allow(unused_imports)] -use bytes::read; -#[allow(unused_imports)] use bytes::scalar; -#[allow(unused_imports)] use bytes::upload; -#[path = "gdn_closed_queue_gpu/columns_pair_cases.rs"] mod columns_pair_cases; -#[allow(unused_imports)] use columns_pair_cases::clean_pair; -#[allow(unused_imports)] -use columns_pair_cases::compare; -#[allow(unused_imports)] use columns_pair_cases::refusal_case; -#[allow(unused_imports)] use columns_pair_cases::refuse; -#[allow(unused_imports)] use columns_pair_cases::{ColumnsCase, ColumnsPoison, columns_pair}; diff --git a/crates/cuda-driver/src/gdn_closed_queue_gpu/bytes.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs similarity index 100% rename from crates/cuda-driver/src/gdn_closed_queue_gpu/bytes.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/bytes.rs diff --git a/crates/cuda-driver/src/gdn_closed_queue_gpu/columns_pair_cases.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs similarity index 100% rename from crates/cuda-driver/src/gdn_closed_queue_gpu/columns_pair_cases.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/columns_pair_cases.rs diff --git a/crates/cuda-driver/src/gdn_closed_queue_gpu/scenarios.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/scenarios.rs similarity index 100% rename from crates/cuda-driver/src/gdn_closed_queue_gpu/scenarios.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_closed_queue/gpu/scenarios.rs diff --git a/crates/cuda-driver/src/gdn_fused_t1.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1.rs similarity index 97% rename from crates/cuda-driver/src/gdn_fused_t1.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1.rs index 6917697f..d2d39573 100644 --- a/crates/cuda-driver/src/gdn_fused_t1.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1.rs @@ -311,26 +311,16 @@ mod tests { } #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gdn_fused_t1_gpu.rs"] mod gpu; -#[path = "gdn_fused_t1/pinned.rs"] mod pinned; -#[allow(unused_imports)] use pinned::decode_statuses; -#[allow(unused_imports)] pub(crate) use pinned::fused_asset; -#[allow(unused_imports)] use pinned::linear; -#[allow(unused_imports)] +#[cfg(test)] use pinned::pinned; -#[path = "gdn_fused_t1/gdn_fused_prefix.rs"] mod gdn_fused_prefix; -#[path = "gdn_fused_t1/gdn_fused_t1_lifecycle.rs"] mod gdn_fused_t1_lifecycle; -#[path = "gdn_fused_t1/words.rs"] mod words; -#[allow(unused_imports)] use words::staging; -#[allow(unused_imports)] use words::words; diff --git a/crates/cuda-driver/src/gdn_fused_t1/gdn_fused_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs similarity index 82% rename from crates/cuda-driver/src/gdn_fused_t1/gdn_fused_prefix.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs index 9c188aa5..dfb723a8 100644 --- a/crates/cuda-driver/src/gdn_fused_t1/gdn_fused_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix.rs @@ -7,7 +7,5 @@ use super::{ STATE_WORDS, STATUS_BYTES, Step, combine, decode_statuses, ffi, linear, staging, words, }; -#[path = "gdn_fused_prefix/fused_stage_binding.rs"] mod fused_stage_binding; -#[path = "gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs"] mod gdn_fused_prefix_step_norm_drain; diff --git a/crates/cuda-driver/src/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs similarity index 100% rename from crates/cuda-driver/src/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/fused_stage_binding.rs diff --git a/crates/cuda-driver/src/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs similarity index 100% rename from crates/cuda-driver/src/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_prefix/gdn_fused_prefix_step_norm_drain.rs diff --git a/crates/cuda-driver/src/gdn_fused_t1/gdn_fused_t1_lifecycle.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_t1_lifecycle.rs similarity index 100% rename from crates/cuda-driver/src/gdn_fused_t1/gdn_fused_t1_lifecycle.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gdn_fused_t1_lifecycle.rs diff --git a/crates/cuda-driver/src/gdn_fused_t1_gpu.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gpu.rs similarity index 100% rename from crates/cuda-driver/src/gdn_fused_t1_gpu.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/gpu.rs diff --git a/crates/cuda-driver/src/gdn_fused_t1/pinned.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs similarity index 97% rename from crates/cuda-driver/src/gdn_fused_t1/pinned.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs index 78aabcc0..bc4c530f 100644 --- a/crates/cuda-driver/src/gdn_fused_t1/pinned.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/pinned.rs @@ -20,7 +20,7 @@ pub(super) fn pinned(ptx: &'static [u8], len: usize, digest: [u8; 32]) -> Result Ok(ptx) } pub(crate) fn fused_asset() -> Result<&'static [u8]> { - pinned(concat!(include_str!("../offline_gdn_fused_t1.ptx"), "\0").as_bytes(), FUSED_PTX_LEN, FUSED_PTX_SHA256) + pinned(concat!(include_str!("../../offline_gdn_fused_t1.ptx"), "\0").as_bytes(), FUSED_PTX_LEN, FUSED_PTX_SHA256) } impl FusedKernel { pub(crate) fn entry(self) -> &'static std::ffi::CStr { diff --git a/crates/cuda-driver/src/gdn_fused_t1/words.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs similarity index 100% rename from crates/cuda-driver/src/gdn_fused_t1/words.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1/words.rs diff --git a/crates/cuda-driver/src/gdn_native_batch.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch.rs similarity index 96% rename from crates/cuda-driver/src/gdn_native_batch.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch.rs index 8623e5dd..a10555c2 100644 --- a/crates/cuda-driver/src/gdn_native_batch.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch.rs @@ -332,35 +332,24 @@ struct Drained { } #[cfg(test)] -#[path = "gdn_native_batch/tests.rs"] +#[path = "../gdn_native_batch/tests.rs"] mod tests; #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "gdn_native_batch_gpu.rs"] mod gpu; // Original physical prompt arena producer: old whole-owner API remains exact. -#[path = "gdn_prompt_device.rs"] mod prompt_device; pub use prompt_device::{GdnPromptOptions, OriginalGdnPromptDevice, OriginalGdnPromptState, OriginalGdnPromptWeights}; -#[path = "gdn_native_batch/pinned.rs"] mod pinned; -#[allow(unused_imports)] use pinned::decode_statuses; -#[allow(unused_imports)] pub(crate) use pinned::dequant_asset; -#[allow(unused_imports)] use pinned::linear; -#[allow(unused_imports)] +#[cfg(test)] use pinned::pinned; -#[allow(unused_imports)] pub(crate) use pinned::prefill_asset; -#[path = "gdn_native_batch/context.rs"] mod context; -#[path = "gdn_native_batch/gdn_batch_prefix.rs"] mod gdn_batch_prefix; -#[path = "gdn_native_batch/staging.rs"] mod staging; -#[allow(unused_imports)] use staging::staging; diff --git a/crates/cuda-driver/src/gdn_native_batch/context.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs similarity index 100% rename from crates/cuda-driver/src/gdn_native_batch/context.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/context.rs diff --git a/crates/cuda-driver/src/gdn_native_batch/gdn_batch_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs similarity index 78% rename from crates/cuda-driver/src/gdn_native_batch/gdn_batch_prefix.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs index 8bacfcb5..7ad89e31 100644 --- a/crates/cuda-driver/src/gdn_native_batch/gdn_batch_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix.rs @@ -7,9 +7,6 @@ use super::{ STATE_WORDS, STATUS_BYTES, Step, ZV, combine, decode_statuses, ffi, linear, staging, }; -#[path = "gdn_batch_prefix/native_projection.rs"] mod native_projection; -#[path = "gdn_batch_prefix/qkv_and_z_projections.rs"] mod qkv_and_z_projections; -#[path = "gdn_batch_prefix/recurrence_and_output.rs"] mod recurrence_and_output; diff --git a/crates/cuda-driver/src/gdn_native_batch/gdn_batch_prefix/native_projection.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs similarity index 100% rename from crates/cuda-driver/src/gdn_native_batch/gdn_batch_prefix/native_projection.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/native_projection.rs diff --git a/crates/cuda-driver/src/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs similarity index 100% rename from crates/cuda-driver/src/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/qkv_and_z_projections.rs diff --git a/crates/cuda-driver/src/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs similarity index 100% rename from crates/cuda-driver/src/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gdn_batch_prefix/recurrence_and_output.rs diff --git a/crates/cuda-driver/src/gdn_native_batch_gpu.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu.rs similarity index 89% rename from crates/cuda-driver/src/gdn_native_batch_gpu.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu.rs index a03069fc..7da3984a 100644 --- a/crates/cuda-driver/src/gdn_native_batch_gpu.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu.rs @@ -132,43 +132,20 @@ fn run_cases(context: &Context<'_>, batch: &mut GdnPrefillBatch<'_>) -> Result<( run_case(context, batch, 3, Poison::default(), None) } -#[path = "gdn_native_batch_gpu/bytes_of.rs"] mod bytes_of; -#[allow(unused_imports)] use bytes_of::bf_bits; -#[allow(unused_imports)] use bytes_of::bf_value; -#[allow(unused_imports)] use bytes_of::bytes_of; -#[allow(unused_imports)] use bytes_of::close; -#[allow(unused_imports)] use bytes_of::f16_bits; -#[allow(unused_imports)] use bytes_of::f16_value; -#[allow(unused_imports)] use bytes_of::halves_of; -#[allow(unused_imports)] use bytes_of::pattern; -#[allow(unused_imports)] use bytes_of::q8_0; -#[allow(unused_imports)] -use bytes_of::sigm; -#[allow(unused_imports)] use bytes_of::words_of; -#[allow(unused_imports)] use bytes_of::{Projections, reference}; -#[path = "gdn_native_batch_gpu/host_gemm_adapter.rs"] mod host_gemm_adapter; -#[allow(unused_imports)] use host_gemm_adapter::mismatch; -#[allow(unused_imports)] use host_gemm_adapter::read; -#[allow(unused_imports)] -use host_gemm_adapter::upload; -#[path = "gdn_native_batch_gpu/run_case.rs"] mod run_case; -#[allow(unused_imports)] -use run_case::check_clean; -#[allow(unused_imports)] use run_case::run_case; diff --git a/crates/cuda-driver/src/gdn_native_batch_gpu/bytes_of.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs similarity index 100% rename from crates/cuda-driver/src/gdn_native_batch_gpu/bytes_of.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/bytes_of.rs diff --git a/crates/cuda-driver/src/gdn_native_batch_gpu/host_gemm_adapter.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs similarity index 100% rename from crates/cuda-driver/src/gdn_native_batch_gpu/host_gemm_adapter.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/host_gemm_adapter.rs diff --git a/crates/cuda-driver/src/gdn_native_batch_gpu/run_case.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs similarity index 100% rename from crates/cuda-driver/src/gdn_native_batch_gpu/run_case.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/gpu/run_case.rs diff --git a/crates/cuda-driver/src/gdn_native_batch/pinned.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs similarity index 97% rename from crates/cuda-driver/src/gdn_native_batch/pinned.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs index 5241e86f..a95ae75c 100644 --- a/crates/cuda-driver/src/gdn_native_batch/pinned.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/pinned.rs @@ -22,7 +22,7 @@ pub(super) fn pinned(ptx: &'static [u8], len: usize, digest: [u8; 32], what: &'s } pub(crate) fn prefill_asset() -> Result<&'static [u8]> { pinned( - concat!(include_str!("../offline_gdn_prefill.ptx"), "\0").as_bytes(), + concat!(include_str!("../../offline_gdn_prefill.ptx"), "\0").as_bytes(), PREFILL_PTX_LEN, PREFILL_PTX_SHA256, "GDN prefill artifact digest", @@ -30,7 +30,7 @@ pub(crate) fn prefill_asset() -> Result<&'static [u8]> { } pub(crate) fn dequant_asset() -> Result<&'static [u8]> { pinned( - concat!(include_str!("../offline_native_dequant_f16.ptx"), "\0").as_bytes(), + concat!(include_str!("../../offline_native_dequant_f16.ptx"), "\0").as_bytes(), DEQUANT_PTX_LEN, DEQUANT_PTX_SHA256, "native dequant artifact digest", diff --git a/crates/cuda-driver/src/gdn_prompt_device.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device.rs similarity index 94% rename from crates/cuda-driver/src/gdn_prompt_device.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device.rs index c3e0909f..9540264a 100644 --- a/crates/cuda-driver/src/gdn_prompt_device.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device.rs @@ -85,13 +85,9 @@ enum DeviceCommand { } #[cfg(test)] -#[path = "prefill_stage_gdn_gpu.rs"] mod stage_gpu_tests; -#[path = "gdn_prompt_device/context.rs"] mod context; -#[path = "gdn_prompt_device/original_gdn_prompt_device.rs"] mod original_gdn_prompt_device; use original_gdn_prompt_device::TensorCoreState; -#[path = "gdn_prompt_device/original_gdn_prompt_device_drop.rs"] mod original_gdn_prompt_device_drop; diff --git a/crates/cuda-driver/src/gdn_prompt_device/context.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs similarity index 100% rename from crates/cuda-driver/src/gdn_prompt_device/context.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/context.rs diff --git a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs similarity index 68% rename from crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs index 046d752e..36ce7ad0 100644 --- a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device.rs @@ -9,20 +9,12 @@ use super::{ SCRATCH, SLOTS, STATE_WORDS, STATUS_BYTES, ZV, combine, decode_statuses, ffi, linear, staging, }; -#[path = "original_gdn_prompt_device/gdn_prompt_run_buffer_binder.rs"] mod gdn_prompt_run_buffer_binder; -#[path = "original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs"] mod original_gdn_prompt_device_admit_open; -#[path = "original_gdn_prompt_device/original_gdn_prompt_device_close.rs"] mod original_gdn_prompt_device_close; -#[path = "original_gdn_prompt_device/original_gdn_prompt_device_drain.rs"] mod original_gdn_prompt_device_drain; -#[path = "original_gdn_prompt_device/prompt_block_produce.rs"] mod prompt_block_produce; -#[path = "original_gdn_prompt_device/prompt_command_list.rs"] mod prompt_command_list; -#[path = "original_gdn_prompt_device/prompt_tensor_core_scan.rs"] mod prompt_tensor_core_scan; -#[allow(unused_imports)] use gdn_prompt_run_buffer_binder::{Binder, Carve, Carved, Handles, Phase}; pub(super) use prompt_tensor_core_scan::TensorCoreState; diff --git a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/gdn_prompt_run_buffer_binder.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/gdn_prompt_run_buffer_binder.rs similarity index 100% rename from crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/gdn_prompt_run_buffer_binder.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/gdn_prompt_run_buffer_binder.rs diff --git a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs similarity index 100% rename from crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_admit_open.rs diff --git a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs similarity index 100% rename from crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_close.rs diff --git a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_drain.rs similarity index 100% rename from crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_drain.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/original_gdn_prompt_device_drain.rs diff --git a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/prompt_block_produce.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs similarity index 100% rename from crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/prompt_block_produce.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_block_produce.rs diff --git a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/prompt_command_list.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_command_list.rs similarity index 100% rename from crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/prompt_command_list.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_command_list.rs diff --git a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/prompt_tensor_core_scan.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_tensor_core_scan.rs similarity index 100% rename from crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device/prompt_tensor_core_scan.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device/prompt_tensor_core_scan.rs diff --git a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device_drop.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs similarity index 100% rename from crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device_drop.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/original_gdn_prompt_device_drop.rs diff --git a/crates/cuda-driver/src/prefill_stage_gdn_gpu.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests.rs similarity index 58% rename from crates/cuda-driver/src/prefill_stage_gdn_gpu.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests.rs index 43381329..a4f10c9c 100644 --- a/crates/cuda-driver/src/prefill_stage_gdn_gpu.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests.rs @@ -4,33 +4,19 @@ use super::*; use crate::ple_batch_ffi::{BatchArg as A, KernelArguments, KernelModule}; -#[path = "prefill_stage_gdn_gpu/rng.rs"] mod rng; -#[allow(unused_imports)] use rng::download; -#[allow(unused_imports)] use rng::f32_bytes; -#[allow(unused_imports)] use rng::hd; -#[allow(unused_imports)] use rng::run_stage; -#[allow(unused_imports)] use rng::upload; -#[allow(unused_imports)] use rng::words; -#[path = "prefill_stage_gdn_gpu/enable_types.rs"] mod enable_types; -#[allow(unused_imports)] use enable_types::ENABLE; -#[allow(unused_imports)] use enable_types::Old; -#[allow(unused_imports)] use enable_types::Rng; -#[path = "prefill_stage_gdn_gpu/gdn_recurrence_equals_the_original.rs"] mod gdn_recurrence_equals_the_original; -#[path = "prefill_stage_gdn_gpu/gdn_stage_kernels_equal.rs"] mod gdn_stage_kernels_equal; -#[path = "prefill_stage_gdn_gpu/gdn_tensor_core_scan_parity.rs"] mod gdn_tensor_core_scan_parity; diff --git a/crates/cuda-driver/src/prefill_stage_gdn_gpu/enable_types.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs similarity index 100% rename from crates/cuda-driver/src/prefill_stage_gdn_gpu/enable_types.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/enable_types.rs diff --git a/crates/cuda-driver/src/prefill_stage_gdn_gpu/gdn_recurrence_equals_the_original.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/gdn_recurrence_equals_the_original.rs similarity index 100% rename from crates/cuda-driver/src/prefill_stage_gdn_gpu/gdn_recurrence_equals_the_original.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/gdn_recurrence_equals_the_original.rs diff --git a/crates/cuda-driver/src/prefill_stage_gdn_gpu/gdn_stage_kernels_equal.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/gdn_stage_kernels_equal.rs similarity index 99% rename from crates/cuda-driver/src/prefill_stage_gdn_gpu/gdn_stage_kernels_equal.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/gdn_stage_kernels_equal.rs index 34f11c76..751a96e1 100644 --- a/crates/cuda-driver/src/prefill_stage_gdn_gpu/gdn_stage_kernels_equal.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/gdn_stage_kernels_equal.rs @@ -1,7 +1,6 @@ //! Tests of prefill_stage_gdn_gpu by topic (moved out of the test file by STRA-338): //! gdn_stage_kernels_equal_the_originals_bit_for_bit. -#[allow(unused_imports)] use super::gdn_recurrence_equals_the_original::{Rig, with_rig}; use super::*; diff --git a/crates/cuda-driver/src/prefill_stage_gdn_gpu/gdn_tensor_core_scan_parity.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/gdn_tensor_core_scan_parity.rs similarity index 100% rename from crates/cuda-driver/src/prefill_stage_gdn_gpu/gdn_tensor_core_scan_parity.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/gdn_tensor_core_scan_parity.rs diff --git a/crates/cuda-driver/src/prefill_stage_gdn_gpu/rng.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs similarity index 100% rename from crates/cuda-driver/src/prefill_stage_gdn_gpu/rng.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/prompt_device/stage_gpu_tests/rng.rs diff --git a/crates/cuda-driver/src/gdn_native_batch/staging.rs b/crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs similarity index 100% rename from crates/cuda-driver/src/gdn_native_batch/staging.rs rename to crates/cuda-driver/src/qwen_dispatch/gdn_native_batch/staging.rs diff --git a/crates/cuda-driver/src/gr_batch_inject_workspace.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_inject_workspace.rs similarity index 99% rename from crates/cuda-driver/src/gr_batch_inject_workspace.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_batch_inject_workspace.rs index 09ee9812..829242ea 100644 --- a/crates/cuda-driver/src/gr_batch_inject_workspace.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_inject_workspace.rs @@ -342,5 +342,4 @@ fn encode(values: &[f32]) -> Result> { } #[cfg(test)] -#[path = "gr_batch_inject_workspace_gpu.rs"] mod gpu; diff --git a/crates/cuda-driver/src/gr_batch_inject_workspace_gpu.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_inject_workspace/gpu.rs similarity index 100% rename from crates/cuda-driver/src/gr_batch_inject_workspace_gpu.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_batch_inject_workspace/gpu.rs diff --git a/crates/cuda-driver/src/gr_batch_read.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read.rs similarity index 98% rename from crates/cuda-driver/src/gr_batch_read.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_batch_read.rs index b41903df..f205f439 100644 --- a/crates/cuda-driver/src/gr_batch_read.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read.rs @@ -377,15 +377,9 @@ mod installed { eprintln!("GR microbank original-FIRST words={words} bit_exact=true allocated0=true context_closed=true"); } } -#[path = "gr_batch_read/context.rs"] mod context; -#[allow(unused_imports)] use context::checked_row; -#[allow(unused_imports)] use context::encode; -#[path = "gr_batch_read/gr_microbatch_read.rs"] mod gr_microbatch_read; -#[path = "gr_batch_read/gr_microbatch_read_drop.rs"] mod gr_microbatch_read_drop; -#[allow(unused_imports)] use gr_microbatch_read_drop::decode; diff --git a/crates/cuda-driver/src/gr_batch_read/context.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs similarity index 100% rename from crates/cuda-driver/src/gr_batch_read/context.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_batch_read/context.rs diff --git a/crates/cuda-driver/src/gr_batch_read/gr_microbatch_read.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs similarity index 74% rename from crates/cuda-driver/src/gr_batch_read/gr_microbatch_read.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs index 759eb1a7..06529b7d 100644 --- a/crates/cuda-driver/src/gr_batch_read/gr_microbatch_read.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read.rs @@ -6,9 +6,6 @@ use super::{ 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; diff --git a/crates/cuda-driver/src/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs similarity index 100% rename from crates/cuda-driver/src/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_inject.rs diff --git a/crates/cuda-driver/src/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs similarity index 100% rename from crates/cuda-driver/src/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/gr_microbatch_read_open.rs diff --git a/crates/cuda-driver/src/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs similarity index 100% rename from crates/cuda-driver/src/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read/micro_stage_launch.rs diff --git a/crates/cuda-driver/src/gr_batch_read/gr_microbatch_read_drop.rs b/crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs similarity index 100% rename from crates/cuda-driver/src/gr_batch_read/gr_microbatch_read_drop.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_batch_read/gr_microbatch_read_drop.rs diff --git a/crates/cuda-driver/src/gr_native_batch.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch.rs similarity index 84% rename from crates/cuda-driver/src/gr_native_batch.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_native_batch.rs index 46930a93..933d41ed 100644 --- a/crates/cuda-driver/src/gr_native_batch.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch.rs @@ -5,7 +5,7 @@ use crate::ple_batch_ffi::{BatchArg as A, Blas, KernelArguments, KernelModule}; use crate::{CurrentGuard, NativeBatchWorkspace}; use std::ffi::CStr; -const PTX: &[u8] = concat!(include_str!("gr_native_batch.ptx"), "\0").as_bytes(); +const PTX: &[u8] = concat!(include_str!("../gr_native_batch.ptx"), "\0").as_bytes(); const ENTRIES: &[&CStr] = &[ c"gr_norm_rs_kernel", c"gr_silu_kernel", @@ -46,13 +46,8 @@ pub struct GrNativeBatch<'ctx> { failed: bool, } -#[path = "gr_native_batch/context.rs"] mod context; -#[allow(unused_imports)] use context::decode; -#[allow(unused_imports)] use context::encode; -#[path = "gr_native_batch/gr_native_batch_drop.rs"] mod gr_native_batch_drop; -#[path = "gr_native_batch/gr_native_batch_operations.rs"] mod gr_native_batch_operations; diff --git a/crates/cuda-driver/src/gr_native_batch/context.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs similarity index 100% rename from crates/cuda-driver/src/gr_native_batch/context.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_native_batch/context.rs diff --git a/crates/cuda-driver/src/gr_native_batch/gr_native_batch_drop.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs similarity index 100% rename from crates/cuda-driver/src/gr_native_batch/gr_native_batch_drop.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_drop.rs diff --git a/crates/cuda-driver/src/gr_native_batch/gr_native_batch_operations.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations.rs similarity index 74% rename from crates/cuda-driver/src/gr_native_batch/gr_native_batch_operations.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations.rs index 94278a0a..f248644f 100644 --- a/crates/cuda-driver/src/gr_native_batch/gr_native_batch_operations.rs +++ b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations.rs @@ -7,9 +7,6 @@ use super::{ KernelArguments, KernelModule, NativeBatchWorkspace, PTX, RESERVE, Result, STAGES, combine, decode, encode, ffi, }; -#[path = "gr_native_batch_operations/native_command_drain.rs"] mod native_command_drain; -#[path = "gr_native_batch_operations/native_gemm_launch.rs"] mod native_gemm_launch; -#[path = "gr_native_batch_operations/native_inject.rs"] mod native_inject; diff --git a/crates/cuda-driver/src/gr_native_batch/gr_native_batch_operations/native_command_drain.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs similarity index 100% rename from crates/cuda-driver/src/gr_native_batch/gr_native_batch_operations/native_command_drain.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_command_drain.rs diff --git a/crates/cuda-driver/src/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs similarity index 100% rename from crates/cuda-driver/src/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_gemm_launch.rs diff --git a/crates/cuda-driver/src/gr_native_batch/gr_native_batch_operations/native_inject.rs b/crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs similarity index 100% rename from crates/cuda-driver/src/gr_native_batch/gr_native_batch_operations/native_inject.rs rename to crates/cuda-driver/src/qwen_dispatch/gr_native_batch/gr_native_batch_operations/native_inject.rs diff --git a/crates/cuda-driver/src/moe_prefill_batch.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch.rs similarity index 94% rename from crates/cuda-driver/src/moe_prefill_batch.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch.rs index 9bf0eee8..aab1ce61 100644 --- a/crates/cuda-driver/src/moe_prefill_batch.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch.rs @@ -230,24 +230,18 @@ struct Drained { } #[cfg(test)] -#[path = "moe_prefill_batch/tests.rs"] +#[path = "../moe_prefill_batch/tests.rs"] mod tests; #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "moe_prefill_batch_gpu.rs"] mod gpu; -#[path = "moe_prefill_batch/pinned.rs"] mod pinned; -#[allow(unused_imports)] use pinned::decode_statuses; -#[allow(unused_imports)] use pinned::format_index; -#[allow(unused_imports)] use pinned::linear; -#[allow(unused_imports)] +#[cfg(test)] use pinned::pinned; -#[allow(unused_imports)] pub(crate) use pinned::prefill_asset; /// The three caller-lent combine inputs: the route weights `[t][10]`, the shared output `[t][2560]` and the scalar /// gate logits `[t]`, all f32. @@ -258,15 +252,9 @@ pub struct MoeCombineInputs<'lease> { pub sg: &'lease DeviceBuffer<'lease>, } -#[path = "moe_prefill_batch/moe_batch_prefix.rs"] mod moe_batch_prefix; -#[path = "moe_prefill_batch/moe_prefill_batch_lifecycle.rs"] mod moe_prefill_batch_lifecycle; -#[path = "moe_prefill_batch/words.rs"] mod words; -#[allow(unused_imports)] use words::check_slot_map; -#[allow(unused_imports)] use words::staging; -#[allow(unused_imports)] use words::words; diff --git a/crates/cuda-driver/src/moe_prefill_batch_gpu.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu.rs similarity index 83% rename from crates/cuda-driver/src/moe_prefill_batch_gpu.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu.rs index f77aba6c..8aa1a36b 100644 --- a/crates/cuda-driver/src/moe_prefill_batch_gpu.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu.rs @@ -78,45 +78,24 @@ fn strata_prefill_moe_program_runs_in_order_refuses_earliest_and_cleans_up() { assert_eq!(leaked, 0, "bytes still allocated after close"); } -#[path = "moe_prefill_batch_gpu/bytes_of.rs"] mod bytes_of; -#[allow(unused_imports)] use bytes_of::bf_bits; -#[allow(unused_imports)] use bytes_of::bf_value; -#[allow(unused_imports)] use bytes_of::bytes_of; -#[allow(unused_imports)] use bytes_of::close; -#[allow(unused_imports)] use bytes_of::f16_bits; -#[allow(unused_imports)] use bytes_of::f16_value; -#[allow(unused_imports)] use bytes_of::halves_of; -#[allow(unused_imports)] use bytes_of::mismatch; -#[allow(unused_imports)] use bytes_of::pattern; -#[allow(unused_imports)] use bytes_of::q8_0; -#[allow(unused_imports)] use bytes_of::read; -#[allow(unused_imports)] use bytes_of::sigm; -#[allow(unused_imports)] use bytes_of::upload; -#[allow(unused_imports)] use bytes_of::words_of; -#[path = "moe_prefill_batch_gpu/fixture.rs"] mod fixture; -#[allow(unused_imports)] use fixture::{Window, run_case}; -#[path = "moe_prefill_batch_gpu/program_cases.rs"] mod program_cases; -#[allow(unused_imports)] use program_cases::run_program_cases; -#[path = "moe_prefill_batch_gpu/clean_window_check.rs"] mod clean_window_check; -#[allow(unused_imports)] use clean_window_check::check_clean; diff --git a/crates/cuda-driver/src/moe_prefill_batch_gpu/bytes_of.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs similarity index 100% rename from crates/cuda-driver/src/moe_prefill_batch_gpu/bytes_of.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/bytes_of.rs diff --git a/crates/cuda-driver/src/moe_prefill_batch_gpu/clean_window_check.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs similarity index 100% rename from crates/cuda-driver/src/moe_prefill_batch_gpu/clean_window_check.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/clean_window_check.rs diff --git a/crates/cuda-driver/src/moe_prefill_batch_gpu/fixture.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs similarity index 100% rename from crates/cuda-driver/src/moe_prefill_batch_gpu/fixture.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/fixture.rs diff --git a/crates/cuda-driver/src/moe_prefill_batch_gpu/program_cases.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/program_cases.rs similarity index 100% rename from crates/cuda-driver/src/moe_prefill_batch_gpu/program_cases.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/gpu/program_cases.rs diff --git a/crates/cuda-driver/src/moe_prefill_batch/moe_batch_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs similarity index 79% rename from crates/cuda-driver/src/moe_prefill_batch/moe_batch_prefix.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs index f8d3fa6a..ca07b439 100644 --- a/crates/cuda-driver/src/moe_prefill_batch/moe_batch_prefix.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix.rs @@ -8,9 +8,6 @@ use super::{ staging, words, }; -#[path = "moe_batch_prefix/combine_stage.rs"] mod combine_stage; -#[path = "moe_batch_prefix/moe_batch_prefix_router_pack.rs"] mod moe_batch_prefix_router_pack; -#[path = "moe_batch_prefix/shared_expert_projections.rs"] mod shared_expert_projections; diff --git a/crates/cuda-driver/src/moe_prefill_batch/moe_batch_prefix/combine_stage.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs similarity index 100% rename from crates/cuda-driver/src/moe_prefill_batch/moe_batch_prefix/combine_stage.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/combine_stage.rs diff --git a/crates/cuda-driver/src/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs similarity index 100% rename from crates/cuda-driver/src/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/moe_batch_prefix_router_pack.rs diff --git a/crates/cuda-driver/src/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs similarity index 100% rename from crates/cuda-driver/src/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_batch_prefix/shared_expert_projections.rs diff --git a/crates/cuda-driver/src/moe_prefill_batch/moe_prefill_batch_lifecycle.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_prefill_batch_lifecycle.rs similarity index 100% rename from crates/cuda-driver/src/moe_prefill_batch/moe_prefill_batch_lifecycle.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/moe_prefill_batch_lifecycle.rs diff --git a/crates/cuda-driver/src/moe_prefill_batch/pinned.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs similarity index 97% rename from crates/cuda-driver/src/moe_prefill_batch/pinned.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs index ba66e9e5..b53833f2 100644 --- a/crates/cuda-driver/src/moe_prefill_batch/pinned.rs +++ b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/pinned.rs @@ -20,7 +20,7 @@ pub(super) fn pinned(ptx: &'static [u8], len: usize, digest: [u8; 32]) -> Result Ok(ptx) } pub(crate) fn prefill_asset() -> Result<&'static [u8]> { - pinned(concat!(include_str!("../offline_moe_prefill.ptx"), "\0").as_bytes(), MOE_PTX_LEN, MOE_PTX_SHA256) + pinned(concat!(include_str!("../../offline_moe_prefill.ptx"), "\0").as_bytes(), MOE_PTX_LEN, MOE_PTX_SHA256) } impl MoeKernel { pub(crate) fn entry(self) -> &'static std::ffi::CStr { diff --git a/crates/cuda-driver/src/moe_prefill_batch/words.rs b/crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs similarity index 100% rename from crates/cuda-driver/src/moe_prefill_batch/words.rs rename to crates/cuda-driver/src/qwen_dispatch/moe_prefill_batch/words.rs diff --git a/crates/cuda-driver/src/mtp_input_workspace.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace.rs similarity index 93% rename from crates/cuda-driver/src/mtp_input_workspace.rs rename to crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace.rs index 61df5298..c08980fd 100644 --- a/crates/cuda-driver/src/mtp_input_workspace.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace.rs @@ -88,14 +88,9 @@ enum Command { } #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "mtp_input_workspace_gpu.rs"] mod gpu; -#[path = "mtp_input_workspace/mtp_input_completion.rs"] mod mtp_input_completion; -#[path = "mtp_input_workspace/mtp_input_prefix.rs"] mod mtp_input_prefix; -#[path = "mtp_input_workspace/mtp_input_workspace_lifecycle.rs"] mod mtp_input_workspace_lifecycle; -#[allow(unused_imports)] use mtp_input_workspace_lifecycle::staging; diff --git a/crates/cuda-driver/src/mtp_input_workspace_gpu.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu.rs similarity index 85% rename from crates/cuda-driver/src/mtp_input_workspace_gpu.rs rename to crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu.rs index 2c3bd045..5d424567 100644 --- a/crates/cuda-driver/src/mtp_input_workspace_gpu.rs +++ b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu.rs @@ -67,33 +67,14 @@ fn check_report(report: &Report, allocated: [usize; 3], poisoned: bool) { assert_eq!(report.numeric, 6); assert_eq!(report.guards, report.refusals); } -#[path = "mtp_input_workspace_gpu/bytes.rs"] mod bytes; -#[allow(unused_imports)] use bytes::bytes; -#[allow(unused_imports)] -use bytes::compare; -#[allow(unused_imports)] use bytes::finite_case; -#[allow(unused_imports)] -use bytes::full_finite; -#[allow(unused_imports)] use bytes::inputs; -#[allow(unused_imports)] use bytes::original; -#[allow(unused_imports)] use bytes::queue; -#[allow(unused_imports)] use bytes::raw; -#[allow(unused_imports)] -use bytes::read; -#[allow(unused_imports)] use bytes::refuse; -#[allow(unused_imports)] use bytes::upload; -#[path = "mtp_input_workspace_gpu/numeric_case.rs"] mod numeric_case; -#[allow(unused_imports)] -use numeric_case::numeric_case; -#[allow(unused_imports)] use numeric_case::run; diff --git a/crates/cuda-driver/src/mtp_input_workspace_gpu/bytes.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs similarity index 100% rename from crates/cuda-driver/src/mtp_input_workspace_gpu/bytes.rs rename to crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/bytes.rs diff --git a/crates/cuda-driver/src/mtp_input_workspace_gpu/numeric_case.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs similarity index 100% rename from crates/cuda-driver/src/mtp_input_workspace_gpu/numeric_case.rs rename to crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/gpu/numeric_case.rs diff --git a/crates/cuda-driver/src/mtp_input_workspace/mtp_input_completion.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs similarity index 100% rename from crates/cuda-driver/src/mtp_input_workspace/mtp_input_completion.rs rename to crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_completion.rs diff --git a/crates/cuda-driver/src/mtp_input_workspace/mtp_input_prefix.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs similarity index 100% rename from crates/cuda-driver/src/mtp_input_workspace/mtp_input_prefix.rs rename to crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_prefix.rs diff --git a/crates/cuda-driver/src/mtp_input_workspace/mtp_input_workspace_lifecycle.rs b/crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_workspace_lifecycle.rs similarity index 100% rename from crates/cuda-driver/src/mtp_input_workspace/mtp_input_workspace_lifecycle.rs rename to crates/cuda-driver/src/qwen_dispatch/mtp_input_workspace/mtp_input_workspace_lifecycle.rs diff --git a/crates/cuda-driver/src/ple_closed_queue.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue.rs similarity index 88% rename from crates/cuda-driver/src/ple_closed_queue.rs rename to crates/cuda-driver/src/qwen_dispatch/ple_closed_queue.rs index 7e5e115e..b9c1bad2 100644 --- a/crates/cuda-driver/src/ple_closed_queue.rs +++ b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue.rs @@ -73,20 +73,12 @@ enum Command { } #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "ple_closed_queue_gpu.rs"] mod gpu; -#[path = "ple_closed_queue/compose_phases.rs"] mod compose_phases; -#[path = "ple_closed_queue/ple_closed_completion.rs"] mod ple_closed_completion; -#[path = "ple_closed_queue/ple_closed_queue_compose_close.rs"] mod ple_closed_queue_compose_close; -#[allow(unused_imports)] use ple_closed_queue_compose_close::float_staging; -#[allow(unused_imports)] use ple_closed_queue_compose_close::staging; -#[path = "ple_closed_queue/float_owner.rs"] mod float_owner; -#[allow(unused_imports)] use float_owner::float_owner; diff --git a/crates/cuda-driver/src/ple_closed_queue/compose_phases.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/compose_phases.rs similarity index 100% rename from crates/cuda-driver/src/ple_closed_queue/compose_phases.rs rename to crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/compose_phases.rs diff --git a/crates/cuda-driver/src/ple_closed_queue/float_owner.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs similarity index 100% rename from crates/cuda-driver/src/ple_closed_queue/float_owner.rs rename to crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/float_owner.rs diff --git a/crates/cuda-driver/src/ple_closed_queue_gpu.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/gpu.rs similarity index 99% rename from crates/cuda-driver/src/ple_closed_queue_gpu.rs rename to crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/gpu.rs index aaa3a6de..e3bdad46 100644 --- a/crates/cuda-driver/src/ple_closed_queue_gpu.rs +++ b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/gpu.rs @@ -365,6 +365,5 @@ fn causal_history_cases<'c>( } Ok(history) } -#[path = "ple_closed_queue_gpu/refusal.rs"] mod refusal; use refusal::{corrupted_weight_cases, foreign_weight_case, invalid_input_cases}; diff --git a/crates/cuda-driver/src/ple_closed_queue_gpu/refusal.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/gpu/refusal.rs similarity index 100% rename from crates/cuda-driver/src/ple_closed_queue_gpu/refusal.rs rename to crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/gpu/refusal.rs diff --git a/crates/cuda-driver/src/ple_closed_queue/ple_closed_completion.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs similarity index 100% rename from crates/cuda-driver/src/ple_closed_queue/ple_closed_completion.rs rename to crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_completion.rs diff --git a/crates/cuda-driver/src/ple_closed_queue/ple_closed_queue_compose_close.rs b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs similarity index 99% rename from crates/cuda-driver/src/ple_closed_queue/ple_closed_queue_compose_close.rs rename to crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs index 55cbd9a7..a0a33a38 100644 --- a/crates/cuda-driver/src/ple_closed_queue/ple_closed_queue_compose_close.rs +++ b/crates/cuda-driver/src/qwen_dispatch/ple_closed_queue/ple_closed_queue_compose_close.rs @@ -1,7 +1,6 @@ //! Methods of `PleClosedQueue`: `compose`, `close`, `close_inner`. Implements `Drop for PleClosedQueue`. //! Functions: `staging`, `float_staging`, `release_buffer`. -#[allow(unused_imports)] use super::compose_phases::ComposeHost; use super::{ Context, DeviceBuffer, Error, PleClosedCompletion, PleClosedQueue, PleClosedWeights, Result, combine, ffi, diff --git a/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs b/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs index 770ef46c..0f40cb46 100644 --- a/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs +++ b/crates/cuda-driver/src/qwen_dispatch/prepare_gr_read_set.rs @@ -3,7 +3,6 @@ use super::{Backend, Cache, Error, OPERATIONS, Operation, Result, combine, ffi, qwen_ffi, restore}; // used only with some cargo features or targets of this crate -#[allow(unused_imports)] use super::{Asset, Cell, Context, FixedKernel}; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] diff --git a/crates/cuda-driver/src/qwen_shared_tail.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail.rs similarity index 91% rename from crates/cuda-driver/src/qwen_shared_tail.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail.rs index 1915001a..93502393 100644 --- a/crates/cuda-driver/src/qwen_shared_tail.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail.rs @@ -109,24 +109,14 @@ enum Command { } #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "qwen_shared_tail_gpu.rs"] mod shared_tail_gpu; -#[path = "qwen_shared_tail/shared_expert_workspace.rs"] mod shared_expert_workspace; -#[path = "qwen_shared_tail/shared_expert_workspace_drop.rs"] mod shared_expert_workspace_drop; -#[path = "qwen_shared_tail/shared_gu_kind.rs"] mod shared_gu_kind; -#[allow(unused_imports)] use shared_expert_workspace_drop::append_finite; -#[allow(unused_imports)] use shared_expert_workspace_drop::append_projection; -#[allow(unused_imports)] use shared_expert_workspace_drop::first_refusal; -#[allow(unused_imports)] use shared_expert_workspace_drop::staging; -#[allow(unused_imports)] use shared_expert_workspace_drop::status_spans; -#[allow(unused_imports)] use shared_expert_workspace_drop::{ProjectionDims, ProjectionScratch}; diff --git a/crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs similarity index 73% rename from crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs index abc7b085..78a443bf 100644 --- a/crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace.rs @@ -8,11 +8,7 @@ use super::{ first_refusal, qwen_ffi, registered, staging, status_spans, }; -#[path = "shared_expert_workspace/shared_expert_workspace_append_close.rs"] mod shared_expert_workspace_append_close; -#[path = "shared_expert_workspace/shared_expert_workspace_bring_up.rs"] mod shared_expert_workspace_bring_up; -#[path = "shared_expert_workspace/shared_expert_workspace_compose.rs"] mod shared_expert_workspace_compose; -#[path = "shared_expert_workspace/shared_phases.rs"] mod shared_phases; diff --git a/crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs similarity index 100% rename from crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_append_close.rs diff --git a/crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs similarity index 100% rename from crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_bring_up.rs diff --git a/crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs similarity index 98% rename from crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs index a00818ad..197723bc 100644 --- a/crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_expert_workspace_compose.rs @@ -1,7 +1,6 @@ //! Methods of `SharedExpertWorkspace`: `compose`. //! Split out of `shared_expert_workspace` to keep its files under the line limit. -#[allow(unused_imports)] use super::shared_phases::SharedStaging; use super::{DeviceBuffer, Error, Result, SharedExpertWeights, SharedExpertWorkspace, SharedTailCompletion}; diff --git a/crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace/shared_phases.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_phases.rs similarity index 100% rename from crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace/shared_phases.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace/shared_phases.rs diff --git a/crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace_drop.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs similarity index 100% rename from crates/cuda-driver/src/qwen_shared_tail/shared_expert_workspace_drop.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_expert_workspace_drop.rs diff --git a/crates/cuda-driver/src/qwen_shared_tail/shared_gu_kind.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs similarity index 100% rename from crates/cuda-driver/src/qwen_shared_tail/shared_gu_kind.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_gu_kind.rs diff --git a/crates/cuda-driver/src/qwen_shared_tail_gpu.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu.rs similarity index 90% rename from crates/cuda-driver/src/qwen_shared_tail_gpu.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu.rs index 0aa6e0d8..a71e838d 100644 --- a/crates/cuda-driver/src/qwen_shared_tail_gpu.rs +++ b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu.rs @@ -116,39 +116,20 @@ fn assert_totals(report: &Report) { assert_eq!((report.guards, report.faults, report.resets), (9, 10, 10)); } -#[path = "qwen_shared_tail_gpu/read.rs"] mod read; -#[allow(unused_imports)] use read::down_payload; -#[allow(unused_imports)] use read::f32_bytes; -#[allow(unused_imports)] use read::finite; -#[allow(unused_imports)] use read::gu_payload; -#[allow(unused_imports)] use read::input; -#[allow(unused_imports)] use read::original_projection; -#[allow(unused_imports)] use read::packet; -#[allow(unused_imports)] use read::read; -#[allow(unused_imports)] use read::scalar_weights; -#[allow(unused_imports)] use read::weights; -#[path = "qwen_shared_tail_gpu/original.rs"] mod original; -#[allow(unused_imports)] use original::compare; -#[allow(unused_imports)] use original::original; -#[allow(unused_imports)] use original::{ComposeCase, ProjectionKinds}; -#[path = "qwen_shared_tail_gpu/guard_probe.rs"] mod guard_probe; -#[allow(unused_imports)] -use guard_probe::guard_probe; -#[allow(unused_imports)] use guard_probe::run; diff --git a/crates/cuda-driver/src/qwen_shared_tail_gpu/guard_probe.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs similarity index 100% rename from crates/cuda-driver/src/qwen_shared_tail_gpu/guard_probe.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/guard_probe.rs diff --git a/crates/cuda-driver/src/qwen_shared_tail_gpu/original.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs similarity index 100% rename from crates/cuda-driver/src/qwen_shared_tail_gpu/original.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/original.rs diff --git a/crates/cuda-driver/src/qwen_shared_tail_gpu/read.rs b/crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs similarity index 100% rename from crates/cuda-driver/src/qwen_shared_tail_gpu/read.rs rename to crates/cuda-driver/src/qwen_dispatch/qwen_shared_tail/shared_tail_gpu/read.rs diff --git a/crates/cuda-driver/src/qwen_dispatch/tests.rs b/crates/cuda-driver/src/qwen_dispatch/tests.rs index db3e76ca..21f92af4 100644 --- a/crates/cuda-driver/src/qwen_dispatch/tests.rs +++ b/crates/cuda-driver/src/qwen_dispatch/tests.rs @@ -77,13 +77,8 @@ fn nested(primary: Error, secondary: Error) -> Error { Error::Multiple { primary: Box::new(primary), secondary: Box::new(secondary) } } -#[path = "tests/full_s2_bank_extent.rs"] mod full_s2_bank_extent; -#[path = "tests/moe_new_preflight_requires_exact.rs"] mod moe_new_preflight_requires_exact; -#[path = "tests/qsa_new_slots_keep_atomic.rs"] mod qsa_new_slots_keep_atomic; -#[path = "tests/qwen_actual_owner_poison_missing.rs"] mod qwen_actual_owner_poison_missing; -#[path = "tests/qwen_attempted_launch_always_syncs.rs"] mod qwen_attempted_launch_always_syncs; diff --git a/crates/cuda-driver/src/qwen_dispatch/tests/qsa_new_slots_keep_atomic.rs b/crates/cuda-driver/src/qwen_dispatch/tests/qsa_new_slots_keep_atomic.rs index cd040117..f99b45f9 100644 --- a/crates/cuda-driver/src/qwen_dispatch/tests/qsa_new_slots_keep_atomic.rs +++ b/crates/cuda-driver/src/qwen_dispatch/tests/qsa_new_slots_keep_atomic.rs @@ -13,7 +13,6 @@ use super::full_s2_bank_extent::{platform_context, synthetic_buffer}; use super::{ Asset, Cache, Cell, Error, Mock, Operation, Rc, arguments, error, execute, nested, qwen_ffi, ready, unload, }; -use crate::{QsaIndexAppendSource, QsaPackedKv, QsaPooledImage}; #[test] fn qsa_new_slots_keep_atomic_lookup_and_uncertain_completion_owners() { diff --git a/crates/cuda-driver/src/qwen_dispatch/tests/qwen_actual_owner_poison_missing.rs b/crates/cuda-driver/src/qwen_dispatch/tests/qwen_actual_owner_poison_missing.rs index 03eec93c..e9b47cea 100644 --- a/crates/cuda-driver/src/qwen_dispatch/tests/qwen_actual_owner_poison_missing.rs +++ b/crates/cuda-driver/src/qwen_dispatch/tests/qwen_actual_owner_poison_missing.rs @@ -10,7 +10,6 @@ )))] use super::full_s2_bank_extent::{platform_context, synthetic_buffer}; use super::{Backend, Cache, Error, Mock, Operation, ffi, prepare_pair, qwen_ffi, ranges_layout, ready}; -use crate::MtpDenseKv; #[cfg(not(all( feature = "cuda-driver", diff --git a/crates/cuda-driver/src/qwen_ffi.rs b/crates/cuda-driver/src/qwen_ffi.rs index 5f873247..9a4dc440 100644 --- a/crates/cuda-driver/src/qwen_ffi.rs +++ b/crates/cuda-driver/src/qwen_ffi.rs @@ -14,142 +14,73 @@ mod tests; mod mtp_s2_full_layout; mod operation; -#[allow(unused_imports)] pub(super) use mtp_s2_full_layout::mtp_dense_layout; -#[allow(unused_imports)] use mtp_s2_full_layout::mtp_extended_layout; -#[allow(unused_imports)] use mtp_s2_full_layout::mtp_input_layout; -#[allow(unused_imports)] pub(super) use mtp_s2_full_layout::mtp_s2_full_layout; mod qsa_layout; -#[allow(unused_imports)] use qsa_layout::gdn_layout; -#[allow(unused_imports)] use qsa_layout::moe_layout; -#[allow(unused_imports)] use qsa_layout::ple_layout; -#[allow(unused_imports)] pub(super) use qsa_layout::qsa_layout; mod asset_validation_and_bf16_layout; -#[allow(unused_imports)] pub(super) use asset_validation_and_bf16_layout::bf16_layout; -#[allow(unused_imports)] use asset_validation_and_bf16_layout::gdn_asset; -#[allow(unused_imports)] use asset_validation_and_bf16_layout::gr_asset; -#[allow(unused_imports)] use asset_validation_and_bf16_layout::inspect_ptx; -#[allow(unused_imports)] pub(super) use asset_validation_and_bf16_layout::kar_ple_layout; -#[allow(unused_imports)] use asset_validation_and_bf16_layout::moe_asset; -#[allow(unused_imports)] use asset_validation_and_bf16_layout::ple_asset; -#[allow(unused_imports)] use asset_validation_and_bf16_layout::qsa_asset; mod asset; -#[allow(unused_imports)] pub(super) use asset::asset; -#[allow(unused_imports)] pub(crate) use asset::sha256; mod mock_asset; -#[allow(unused_imports)] pub(super) use mock_asset::gr_batch_preview_ptx; #[cfg(test)] -#[allow(unused_imports)] pub(super) use mock_asset::mock_asset; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -#[allow(unused_imports)] pub(crate) use mock_asset::q6_batch_preview_ptx; mod n_types; -#[allow(unused_imports)] pub(super) use n_types::Asset; -#[allow(unused_imports)] pub(super) use n_types::H; -#[allow(unused_imports)] pub(super) use n_types::HC; -#[allow(unused_imports)] pub(super) use n_types::Layout; -#[allow(unused_imports)] pub(super) use n_types::N; -#[allow(unused_imports)] pub(super) use n_types::OPERATIONS; -#[allow(unused_imports)] pub(super) use n_types::Operation; -#[allow(unused_imports)] use n_types::PTX_PROOFS; -#[allow(unused_imports)] use n_types::PtxProof; -#[allow(unused_imports)] pub(super) use n_types::QSA_OPERATIONS; -#[allow(unused_imports)] use n_types::ROUTE_ASSET; -#[allow(unused_imports)] -use n_types::ROUTE_RECEIPT; -#[allow(unused_imports)] pub(super) use n_types::Receipt; mod bf16_receipt_types; -#[allow(unused_imports)] use bf16_receipt_types::BF16_ASSETS; -#[allow(unused_imports)] -use bf16_receipt_types::BF16_RECEIPT; -#[allow(unused_imports)] use bf16_receipt_types::GDN_ASSETS; -#[allow(unused_imports)] use bf16_receipt_types::GDN_RECEIPT; -#[allow(unused_imports)] use bf16_receipt_types::GR_ASSETS; -#[allow(unused_imports)] use bf16_receipt_types::GR_RECEIPT; -#[allow(unused_imports)] use bf16_receipt_types::MOE_ASSETS; -#[allow(unused_imports)] use bf16_receipt_types::MOE_RECEIPT; -#[allow(unused_imports)] use bf16_receipt_types::PLE_ASSETS; -#[allow(unused_imports)] use bf16_receipt_types::PLE_RECEIPT; -#[allow(unused_imports)] use bf16_receipt_types::PLE_VALUE_FULL_ASSET; -#[allow(unused_imports)] -use bf16_receipt_types::PLE_VALUE_FULL_RECEIPT; -#[allow(unused_imports)] use bf16_receipt_types::QSA_NATIVE_RECEIPT; -#[allow(unused_imports)] use bf16_receipt_types::QSA_SELECT_RECEIPT; mod qsa_attention_receipt_types; -#[allow(unused_imports)] use qsa_attention_receipt_types::KAR_PLE_ASSETS; -#[allow(unused_imports)] +#[cfg(test)] use qsa_attention_receipt_types::KAR_PLE_RECEIPT; -#[allow(unused_imports)] use qsa_attention_receipt_types::MTP_DENSE_ASSETS; -#[allow(unused_imports)] -use qsa_attention_receipt_types::MTP_DENSE_RECEIPT; -#[allow(unused_imports)] use qsa_attention_receipt_types::MTP_GR_RECEIPT; -#[allow(unused_imports)] use qsa_attention_receipt_types::MTP_INPUT_ASSETS; -#[allow(unused_imports)] -use qsa_attention_receipt_types::MTP_INPUT_RECEIPT; -#[allow(unused_imports)] use qsa_attention_receipt_types::MTP_S2_RECEIPT; -#[allow(unused_imports)] use qsa_attention_receipt_types::QSA_ASSETS; -#[allow(unused_imports)] use qsa_attention_receipt_types::QSA_ATTENTION_RECEIPT; -#[allow(unused_imports)] use qsa_attention_receipt_types::QSA_GATE_RECEIPT; mod mtp_extended_assets_types; -#[allow(unused_imports)] pub(super) use mtp_extended_assets_types::Arguments; -#[allow(unused_imports)] use mtp_extended_assets_types::MTP_EXTENDED_ASSETS; -#[allow(unused_imports)] use mtp_extended_assets_types::MTP_S2_FULL_ASSETS; -#[allow(unused_imports)] -use mtp_extended_assets_types::MTP_S2_FULL_RECEIPT; -#[allow(unused_imports)] use mtp_extended_assets_types::Storage; diff --git a/crates/cuda-driver/src/qwen_ffi/tests.rs b/crates/cuda-driver/src/qwen_ffi/tests.rs index c1dc6949..ea6aed40 100644 --- a/crates/cuda-driver/src/qwen_ffi/tests.rs +++ b/crates/cuda-driver/src/qwen_ffi/tests.rs @@ -2,11 +2,7 @@ use super::*; -#[path = "tests/full_s2_expert_scalar.rs"] mod full_s2_expert_scalar; -#[path = "tests/moe_fixed_pointer_abi_extents.rs"] mod moe_fixed_pointer_abi_extents; -#[path = "tests/mtp_new_qualified_assets.rs"] mod mtp_new_qualified_assets; -#[path = "tests/qsa_new_literal_abi_scalar.rs"] mod qsa_new_literal_abi_scalar; diff --git a/crates/cuda-driver/src/root_exports.rs b/crates/cuda-driver/src/root_exports.rs index e8e55d89..6ab48a34 100644 --- a/crates/cuda-driver/src/root_exports.rs +++ b/crates/cuda-driver/src/root_exports.rs @@ -1,229 +1,235 @@ //! Plain `pub use` re-exports of the crate root, moved out of `lib.rs` by STRA-338 (the public paths are unchanged). -#[allow(unused_imports)] -use super::*; - -pub use device_ref::DeviceRef; -pub use device_slab::{DeviceSlice, SlabAllocator, SlabPolicy, SlabStats}; -pub use gdn_state_finite_guard::GdnStateFiniteGuard; -pub use head_greedy::{HEAD_GREEDY_WORKSPACE_BYTES, HeadGreedySelection, HeadGreedyWorkspace}; -pub use mmq::resident::original_group::{ +pub use crate::device_ref::DeviceRef; +pub use crate::device_slab::{DeviceSlice, SlabAllocator, SlabPolicy, SlabStats}; +pub use crate::gdn_state_finite_guard::GdnStateFiniteGuard; +pub use crate::head_greedy::{HEAD_GREEDY_WORKSPACE_BYTES, HeadGreedySelection, HeadGreedyWorkspace}; +pub use crate::mmq::resident::original_group::{ OriginalMmqCopySchedule, OriginalMmqLayer, OriginalMmqOutput, OriginalStreamAllLayer, PrefetchSource, PrefetchTarget, RingExperts, original_mmq_group_bank_bytes, }; -pub use mmq::resident::{FiniteMmqOutput, MmqChunkActivation, MmqGroupActivation, MmqHidden, MmqWorkspace}; -pub use mmq::{MmqExperiment, MmqFormat, MmqProfile, MmqRequest, MmqWeights}; -pub use mtp_dense_kv::MTP_ORIGINAL_WINDOW; -pub use mtp_dense_kv::MtpDenseKvRing; -pub use mtp_dense_kv::{ +pub use crate::mmq::resident::{FiniteMmqOutput, MmqChunkActivation, MmqGroupActivation, MmqHidden, MmqWorkspace}; +pub use crate::mmq::{MmqExperiment, MmqFormat, MmqProfile, MmqRequest, MmqWeights}; +pub use crate::mtp_dense_kv::MTP_ORIGINAL_WINDOW; +pub use crate::mtp_dense_kv::MtpDenseKvRing; +pub use crate::mtp_dense_kv::{ CompletedMtpAttention, CompletedMtpKvReplay, MtpInt8OwnerId, MtpInt8Snapshot, MtpOriginalInt8, MtpOriginalMixed, MtpOriginalQuery, }; -pub use original_expert_cache::{OriginalExpertCache, RefillBatchOptions}; -pub use original_gpu_schedule::{ +pub use crate::original_expert_cache::{OriginalExpertCache, RefillBatchOptions}; +pub use crate::original_gpu_schedule::{ OriginalCapture, OriginalCapturePolicy, OriginalEventKind, OriginalGpuEvent, OriginalGpuGraph, OriginalGpuStream, OriginalGraphFlight, OriginalGraphKey, OriginalGraphRegistry, OriginalGraphResources, OriginalStreamKind, OriginalWait, }; -pub use original_moe_prompt_device::{ +pub use crate::original_moe_prompt_device::{ ExpertStreamLayer, OriginalLayerExpertSources, OriginalMoePromptDevice, OriginalMoePromptLayer, SharedExpertLayout, }; -pub use original_mtp_actor::{ActorRefusal as OriginalMtpActorRefusal, DraftSettings as OriginalMtpDraftSettings}; +pub use crate::original_mtp_actor::{ + ActorRefusal as OriginalMtpActorRefusal, DraftSettings as OriginalMtpDraftSettings, +}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_mtp_actor::{OriginalMtpActor, OriginalMtpLoadEvidence, OriginalMtpLoadMeter, OriginalMtpLoadedParts}; -pub use original_mtp_bank::{ +pub use crate::original_mtp_actor::{ + OriginalMtpActor, OriginalMtpLoadEvidence, OriginalMtpLoadMeter, OriginalMtpLoadedParts, +}; +pub use crate::original_mtp_bank::{ OriginalMtpLoadFailure, OriginalMtpRtBank, OriginalMtpRtTensor, OriginalMtpTensorKind, original_mtp_draft_vocab_bytes, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_mtp_draft_head::{FullForwardHead, OriginalMainHead, OriginalMtpDraftHead}; -pub use original_mtp_loader::{ - CoupledPlan as OriginalMtpCoupledPlan, KvFormat as OriginalMtpKvFormat, KvMode as OriginalMtpKvMode, - KvPlan as OriginalMtpKvPlan, LoaderError as OriginalMtpPlanError, OriginalMtpCapture, OriginalMtpKvStartup, - OriginalMtpLoadPlan, WeightBankPlan as OriginalMtpWeightBankPlan, original_mtp_bind_reserve, -}; -pub use original_prefill_arena::{OriginalPrefillArena, OriginalPromptLeaseIdentity, OriginalPromptRows}; -pub use original_prefill_layout::{ +pub use crate::original_mtp_draft_head::{FullForwardHead, OriginalMainHead, OriginalMtpDraftHead}; +pub use crate::original_prefill_arena::{OriginalPrefillArena, OriginalPromptLeaseIdentity, OriginalPromptRows}; +pub use crate::original_prefill_layout::{ OriginalPrefillLayout, PrefillKvStage, PrefillLayoutOptions, PrefillPhase, PrefillSpan, }; -pub use original_session_state::{ +pub use crate::original_session_state::{ OriginalGeometryFacts, OriginalHostKv, OriginalIdxKind, OriginalKvLayer, OriginalKvPool, OriginalQsaFacts, OriginalRegion, OriginalRingBlocks, OriginalSessionBytes, OriginalSessionControl, OriginalSessionFacts, }; -pub use qsa_selected_kv::{QsaKvMisses, QsaSelectedKvProducts, QsaSelectedKvWorkspace}; -pub use qwen_dispatch::fixed_operands::{ +pub use crate::qsa_selected_kv::{QsaKvMisses, QsaSelectedKvProducts, QsaSelectedKvWorkspace}; +pub use crate::qwen_dispatch::fixed_operands::{ GdnConvResult, GdnGates, GdnOutNormInput, GdnQkv, GdnStepProducts, GdnStepResult, GrReadInputs, GrReadOutputs, MtpDenseKv, MtpGrMlpOutputs, MtpGrMlpResidual, MtpGrProducts, MtpGrWeights, MtpQuantizedInput, MtpRingWindow, MtpS2SelectedExpert, MtpS2TileWeights, PleConvResult, QsaIndexAppendSource, QsaPackedKv, QsaPooledImage, }; -pub use qwen_dispatch::gr_batch_read::{GrMicroValues, GrMicrobatchRead}; -pub use routed_group_workspace::RoutedColumnsLoan; -pub use routed_group_workspace::{RoutedDownShape, RoutedGroupWorkspace}; -pub use routed_stage_finite_guard::{RoutedFiniteStage, RoutedStageFiniteGuard}; -pub use serving_context::{ +pub use crate::qwen_dispatch::gr_batch_read::{GrMicroValues, GrMicrobatchRead}; +pub use crate::routed_group_workspace::RoutedColumnsLoan; +pub use crate::routed_group_workspace::{RoutedDownShape, RoutedGroupWorkspace}; +pub use crate::routed_stage_finite_guard::{RoutedFiniteStage, RoutedStageFiniteGuard}; +pub use leleka_cuda_model::original_mtp_loader::{ + CoupledPlan as OriginalMtpCoupledPlan, KvFormat as OriginalMtpKvFormat, KvMode as OriginalMtpKvMode, + KvPlan as OriginalMtpKvPlan, LoaderError as OriginalMtpPlanError, OriginalMtpCapture, OriginalMtpKvStartup, + OriginalMtpLoadPlan, WeightBankPlan as OriginalMtpWeightBankPlan, original_mtp_bind_reserve, +}; +pub use leleka_cuda_model::serving_context::{ KV_RESIDENT_DEFAULT_CELLS, KV_RESIDENT_MIN_CELLS, MAX_CONTEXT_CELLS, ServingContext, TRAINED_CONTEXT_CELLS, configure_kv_resident, configure_serving_context, kv_resident_cells, serving_context, }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -pub use qwen_dispatch::batch_gr_preview::GrBatchModule; -pub use qwen_dispatch::batch_gr_preview::{GrInjectBuffers, GrNormBuffers}; +pub use crate::qwen_dispatch::batch_gr_preview::GrBatchModule; +pub use crate::qwen_dispatch::batch_gr_preview::{GrInjectBuffers, GrNormBuffers}; -pub use qwen_dispatch::qwen_shared_tail::{ +pub use crate::qwen_dispatch::qwen_shared_tail::{ SharedDownKind, SharedExpertWeights, SharedExpertWorkspace, SharedGuKind, SharedTailCompletion, SharedTailRefusal, }; // Additive closed MTP input transport owners. -pub use qwen_dispatch::gdn_closed_queue::{ +pub use crate::qwen_dispatch::gdn_closed_queue::{ GdnConvBuffers, GdnOutNormBuffers, GdnQueueStage, GdnRecurrenceBuffers, GdnRowCompletion, GdnRowPrefix, GdnRowQueue, }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -pub use qwen_dispatch::gdn_fused_t1::{ +pub use crate::qwen_dispatch::gdn_fused_t1::{ GDN_FUSED_T1_PERSISTENT_BYTES, GDN_FUSED_T1_STATE_BYTES, GdnAbBuffers, GdnFusedCompletion, GdnFusedPrefix, GdnFusedStage, GdnFusedT1, GdnReplayBuffers, }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -pub(crate) use qwen_dispatch::gdn_native_batch::GdnGeometry; +pub(crate) use crate::qwen_dispatch::gdn_native_batch::GdnGeometry; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -pub use qwen_dispatch::gdn_native_batch::{ +pub use crate::qwen_dispatch::gdn_native_batch::{ GDN_BATCH_EPSILON, GDN_BATCH_MAX_TOKENS, GdnBatchCompletion, GdnBatchPrefix, GdnBatchStage, GdnGemm, GdnNativeFormat, GdnPrefillBatch, GdnPromptOptions, GdnStream, GemmShape, OriginalGdnPromptDevice, OriginalGdnPromptState, OriginalGdnPromptWeights, }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -pub use qwen_dispatch::moe_prefill_batch::{ +pub use crate::qwen_dispatch::moe_prefill_batch::{ MOE_BATCH_MAX_TOKENS, MOE_BATCH_SCRATCH_BYTES, MoeBatchCompletion, MoeBatchPrefix, MoeBatchStage, MoeCombineInputs, MoePrefillBatch, MoeRouteBatch, }; -pub use qwen_dispatch::mtp_input_workspace::{MtpInputCompletion, MtpInputPrefix, MtpInputRefusal, MtpInputWorkspace}; +pub use crate::qwen_dispatch::mtp_input_workspace::{ + MtpInputCompletion, MtpInputPrefix, MtpInputRefusal, MtpInputWorkspace, +}; -pub use async_owned_copy::{CompletedOwnedCopy, MAX_ASYNC_COPY_PAIRS, OwnedCopyPairs, OwnedCopyPoll, PendingOwnedCopy}; +pub use crate::async_owned_copy::{ + CompletedOwnedCopy, MAX_ASYNC_COPY_PAIRS, OwnedCopyPairs, OwnedCopyPoll, PendingOwnedCopy, +}; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64", feature = "cuda-driver"))] -pub use qwen_dispatch::gr_batch_inject_workspace::{ +pub use crate::qwen_dispatch::gr_batch_inject_workspace::{ GR_BATCH_INJECT_WORKSPACE_BYTES, GrBatchInjectShape, GrBatchInjectWorkspace, GrInjectInputs, }; -pub use routed_resident_queue::{ +pub use crate::routed_resident_queue::{ RoutedResidentCompletion, RoutedResidentOutputs, RoutedResidentQueue, RoutedResidentRefusal, RoutedResidentWeights, }; -pub use mapped_expert_bank::{ +pub use crate::mapped_expert_bank::{ MappedExpertBank, MappedExpertCopyCompletion, MappedExpertCopyScratch, PendingMappedExpertCopy, }; -pub use qwen_dispatch::ple_closed_queue::{ +pub use crate::qwen_dispatch::ple_closed_queue::{ PleClosedCompletion, PleClosedParts, PleClosedQueue, PleClosedRefusal, PleClosedWeights, }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use gdn_batch_gemm::NativeGdnGemm; -pub use native_batch_workspace::{NATIVE_BATCH_WORKSPACE_BYTES, NativeBatchWorkspace}; -pub use ple_batch_queue::{ +pub use crate::gdn_batch_gemm::NativeGdnGemm; +pub use crate::native_batch_workspace::{NATIVE_BATCH_WORKSPACE_BYTES, NativeBatchWorkspace}; +pub use crate::ple_batch_queue::{ PLE_BATCH_QUEUE_BYTES, PleBatchCompletion, PleBatchQueue, PleBatchRow, PleBatchSources, PleBf16Mode, }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use qsa_native_batch::{ +pub use crate::qsa_native_batch::{ QSA_NATIVE_BATCH_BYTES, QsaNativeBatchWorkspace, QsaNativeKind, QsaNativePacking, QsaNativeProjections, }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use qsa_native_batch::{QsaGatedAttention, QsaInputWeights, QsaNativeWeight}; -pub use qsa_native_decode::{QSA_NATIVE_DECODE_BYTES, QsaNativeDecode, QsaNativeDecodeCompletion}; +pub use crate::qsa_native_batch::{QsaGatedAttention, QsaInputWeights, QsaNativeWeight}; +pub use crate::qsa_native_decode::{QSA_NATIVE_DECODE_BYTES, QsaNativeDecode, QsaNativeDecodeCompletion}; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use qsa_prompt_attention::{ +pub use crate::qsa_prompt_attention::{ QSA_PROMPT_ATTENTION_BYTES, QsaAttendedKv, QsaAttentionInputs, QsaPromptAttention, QsaPromptAttentionCompletion, }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use qsa_prompt_index::{ +pub use crate::qsa_prompt_index::{ OriginalQsaDeviceSelection, OriginalQsaPromptDevice, OriginalQsaPromptWeights, OriginalQsaResidentAppendTarget, QSA_PROMPT_INDEX_BYTES, QsaChunkPrior, QsaChunkRows, QsaIndexPrior, QsaKvAppendTarget, QsaPromptIndexPrefix, QsaPromptIndexState, QsaPromptIndexWorkspace, QsaPromptSelection, ResidentContinuation, ScalarStepRows, }; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use qsa_prompt_kv::{ +pub use crate::qsa_prompt_kv::{ CompletedQsaKvAppend, QSA_PROMPT_MAPPED_HOST_BYTES, QSA_PROMPT_MAX_SNAPSHOT_METADATA_BYTES, QSA_PROMPT_MAX_SNAPSHOT_PAYLOAD_BYTES, QSA_PROMPT_RESIDENT_BYTES, QSA_PROMPT_STAGE_BYTES, QsaKvInputs, QsaKvOwnerId, QsaKvSnapshot, QsaPromptKv, QsaPromptStage, }; -pub use qsa_prompt_resolver::KvStreamCounters; -pub use qwen_dispatch::gr_native_batch::{GrNativeBatch, GrNativeProfile}; +pub use crate::qsa_prompt_resolver::KvStreamCounters; +pub use crate::qwen_dispatch::gr_native_batch::{GrNativeBatch, GrNativeProfile}; -pub use gpu_report::gpu_kernel_report; -pub use native_prompt_device::{ +pub use crate::gpu_report::gpu_kernel_report; +pub use crate::native_prompt_device::{ OriginalDeviceBlock, OriginalDeviceGrRead, OriginalDeviceNormedResidual, OriginalDeviceResidual, OriginalPleHistory, OriginalPromptDevice, PromptInputStage, }; -pub use original_sampler::{OriginalSampler, SampleRequest, SampleWindow, SamplerParams, SamplerPath}; -pub use prefill_stage::{ +pub use crate::original_sampler::{OriginalSampler, SampleRequest, SampleWindow, SamplerParams, SamplerPath}; +pub use crate::prefill_stage::{ set_gdn_nostore_override as set_prefill_gdn_nostore_override, set_gdn_override as set_prefill_gdn_override, }; -pub use qsa_cluster::{requested as qsa_cluster_requested, set_override as set_qsa_cluster_override}; -pub use qsa_late::set_override as set_qsa_late_override; -pub use qsa_late::set_topk_override as set_qsa_topk_override; +pub use crate::qsa_cluster::{requested as qsa_cluster_requested, set_override as set_qsa_cluster_override}; +pub use crate::qsa_late::set_override as set_qsa_late_override; +pub use crate::qsa_late::set_topk_override as set_qsa_topk_override; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use qsa_native_decode::OriginalQsaResidentDecodeCompletion; -pub use qsa_native_gate::QsaNativeGate; +pub use crate::qsa_native_decode::OriginalQsaResidentDecodeCompletion; +pub use crate::qsa_native_gate::QsaNativeGate; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use qsa_prompt_attention::OriginalQsaResidentAttention; +pub use crate::qsa_prompt_attention::OriginalQsaResidentAttention; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use qsa_prompt_index::{ +pub use crate::qsa_prompt_index::{ OriginalQsaIndexBatch, OriginalQsaIndexCheckpoint, OriginalQsaResidentIndex, OriginalQsaResidentPromptDevice, OriginalQsaResidentScalarIndex, OriginalQsaResidentScalarSelection, OriginalQsaResidentSelection, }; -pub use qsa_prompt_kv::set_qsa_prefetch_override; +pub use crate::qsa_prompt_kv::set_qsa_prefetch_override; #[cfg(all(any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -pub use qsa_prompt_kv::{ +pub use crate::qsa_prompt_kv::{ OriginalQsaMappedAppend, OriginalQsaMappedJournal, OriginalQsaMappedPrefix, OriginalQsaResidentTransport, }; -pub use mtp_dense_kv::{ +pub use crate::mtp_dense_kv::{ CompletedDraftKv, CompressedEmbedding, DraftKvFallback, DraftKvOutcome, DraftKvPolicy, DraftKvSources, OriginalMtpEmbedding, OriginalMtpPrefill, OriginalMtpPrefillWeights, PrefillRows, RecordRun, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use mtp_dense_kv::{ +pub use crate::mtp_dense_kv::{ CompletedOriginalMtpDraft, OriginalMtpDraftProgram, OriginalMtpDrafter, OriginalMtpForwardProgram, OriginalMtpFullForward, OriginalMtpFullPolicy, OriginalMtpRetainedFullWeights, OriginalMtpRetainedPrefix, OriginalMtpStepOutput, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use mtp_dense_kv::{OriginalMtpSkipPrior, OriginalMtpSkippedPrefix}; +pub use crate::mtp_dense_kv::{OriginalMtpSkipPrior, OriginalMtpSkippedPrefix}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use native_parity::{ +pub use crate::native_parity::{ NativeParity, NativeParityExpert, native_parity_embed_supported, native_parity_iq_supported, native_parity_row_bytes, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_expert_stager::{ +pub use crate::original_expert_stager::{ OriginalExpertStager, OriginalFileExpertBlob, OriginalStagerBatch, OriginalStagerCompleted, OriginalStagerJob, OriginalStagerOptions, OriginalStreamAll, OriginalStreamAllCompleted, OriginalStreamAllForward, OriginalStreamAllOptions, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use mtp_dense_kv::{ +pub use crate::mtp_dense_kv::{ OriginalMtpGrVariant, OriginalMtpRetainedScalarWeights, OriginalMtpScalarPolicy, OriginalMtpScalarPrefill, ScalarDraftKvSources, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use native_head::{ +pub use crate::native_head::{ NativeEmbedFlight, NativeHeadDispatch, NativeHeadFlight, NativeHeadPayload, NativeHeadProjectionFlight, NativeHeadSampling, NativeHeadSelection, OriginalNativeEmbed, OriginalNativeEmbedRows, OriginalNativeHead, OriginalNativeHeadGraphResources, OriginalNativeHeadRows, native_embed_supported, native_head_row_bytes, native_head_supported, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_file_expert_source::{ +pub use crate::original_file_expert_source::{ OriginalFileExpertSource, OriginalFileSourceBlob, OriginalFileSourceCounters, OriginalResidentOptions, OriginalSourceSwap, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_gpu_schedule::OriginalStreamDrained; -pub use original_gpu_schedule::capture_timing as original_capture_timing; +pub use crate::original_gpu_schedule::OriginalStreamDrained; +pub use crate::original_gpu_schedule::capture_timing as original_capture_timing; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_mtp_draft_round::{AcceptedWindow, DraftOutput, DraftSampling, DraftTarget, RepeatRowWindow}; +pub use crate::original_mtp_draft_round::{AcceptedWindow, DraftOutput, DraftSampling, DraftTarget, RepeatRowWindow}; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_verify::chain::set_down_override as set_chain_down_override; -pub use original_verify::sm120::set_overrides as set_sm120_overrides; +pub use crate::original_verify::chain::set_down_override as set_chain_down_override; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_verify::{ +pub use crate::original_verify::sm120::set_overrides as set_sm120_overrides; +#[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] +pub use crate::original_verify::{ MAX_PCIE_FETCHES as ORIGINAL_VERIFY_MAX_PCIE_FETCHES, OriginalVerifier, OriginalVerifyBank, OriginalVerifyCanonicalGdn, OriginalVerifyCpuRows, OriginalVerifyCpuSink, OriginalVerifyGdnJournal, OriginalVerifyGdnStage, OriginalVerifyGdnWeights, OriginalVerifyGeometry, OriginalVerifyGpuPlan, @@ -232,33 +238,29 @@ pub use original_verify::{ OriginalVerifyWindowTokens, }; // Live verifier release/diagnostic owner, profile report and completed-logit readout. -#[allow(unused_imports)] -pub use context_matvec_k_quant_projections::MatvecDims; +pub use crate::context_matvec_k_quant_projections::MatvecDims; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[allow(unused_imports)] -pub use device_buffer::chain_selects_mtp; +pub use crate::device_buffer::chain_selects_mtp; #[cfg(not(all( feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" )))] -#[allow(unused_imports)] -pub use device_buffer::chain_selects_mtp; +pub use crate::device_buffer::chain_selects_mtp; #[cfg(not(all( feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" )))] -#[allow(unused_imports)] -pub use device_buffer::set_chain_down_override; -pub use moe_group_down_columns::DownColumns; +pub use crate::device_buffer::set_chain_down_override; +pub use crate::moe_group_down_columns::DownColumns; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_serve_assets::{ +pub use crate::original_serve_assets::{ OriginalAssetKind, OriginalAssetStatus, original_serve_asset_status, original_serve_assets_sealed, unsealed_original_serve_assets, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_verify::{ +pub use crate::original_verify::{ ExpertTier, HcHalf, LogitRows, LogprobReadout, OriginalVerifyDiag, OriginalVerifyExpertLayout, OriginalVerifyProfile, OriginalVerifyWindowResources, PROFILE_STAMPS_PER_LAYER, PlanLayout, Projection, QuantSource, RowLogprob, Rows as OriginalVerifyRows, UNBOUND_PRODUCERS, WINDOW_LAYERS, @@ -269,7 +271,7 @@ pub use original_verify::{ write_window_logprobs, }; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use original_verify::{ +pub use crate::original_verify::{ HcHalfBuffers, HcLayerBuffers, HcOutputBuffers, OriginalVerifyExpertFormats, OriginalVerifyGdnProjections, OriginalVerifyGrBinding, OriginalVerifyMoeBinding, OriginalVerifyMoeLayerWeights, OriginalVerifyNativeMatrix, OriginalVerifyProjBinding, OriginalVerifyQsaBinding, OriginalVerifyQsaKvBinding, OriginalVerifyQsaLayerWeights, @@ -282,36 +284,21 @@ pub use original_verify::{ any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" ))] -pub use original_verify::{OriginalExpertTierProbe, expert_probe_geometry}; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::Bf16ProjectionShape; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::Context; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::DenseFormat; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::Device; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::Driver; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::Error; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::ProjectionKind; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::ProjectionSpec; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::PromptSyncTrace; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::Q5KProjectionShape; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::Q6KProjectionShape; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::Result; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::RoutedFormat; -#[allow(unused_imports)] -pub use prompt_sync_trace_types::RoutedGateUpQ8; -#[allow(unused_imports)] -pub use q5_kshape_types::DeviceBuffer; +pub use crate::original_verify::{OriginalExpertTierProbe, expert_probe_geometry}; +pub use crate::prompt_sync_trace_types::Bf16ProjectionShape; +pub use crate::prompt_sync_trace_types::Context; +pub use crate::prompt_sync_trace_types::DenseFormat; +pub use crate::prompt_sync_trace_types::Device; +pub use crate::prompt_sync_trace_types::Driver; +pub use crate::prompt_sync_trace_types::Error; +pub use crate::prompt_sync_trace_types::ProjectionKind; +pub use crate::prompt_sync_trace_types::ProjectionSpec; +pub use crate::prompt_sync_trace_types::PromptSyncTrace; +pub use crate::prompt_sync_trace_types::Q5KProjectionShape; +pub use crate::prompt_sync_trace_types::Q6KProjectionShape; +pub use crate::prompt_sync_trace_types::Result; +pub use crate::prompt_sync_trace_types::RoutedFormat; +pub use crate::prompt_sync_trace_types::RoutedGateUpQ8; +pub use crate::q5_kshape_types::DeviceBuffer; #[cfg(all(feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -pub use qsa_prompt_index::{OriginalQsaOwners, OriginalVerifyQsaJournal, OriginalVerifyRope}; +pub use crate::qsa_prompt_index::{OriginalQsaOwners, OriginalVerifyQsaJournal, OriginalVerifyRope}; diff --git a/crates/cuda-driver/src/routed_group_workspace.rs b/crates/cuda-driver/src/routed_group_workspace.rs index 0b291ae6..a6fc5ead 100644 --- a/crates/cuda-driver/src/routed_group_workspace.rs +++ b/crates/cuda-driver/src/routed_group_workspace.rs @@ -30,7 +30,6 @@ pub struct RoutedGroupWorkspace<'ctx> { any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" ))] -#[path = "routed_group_workspace_gpu.rs"] mod gpu; // Additive closed column loan: all preceding workspace methods are byte-exact. @@ -43,7 +42,6 @@ pub struct RoutedColumnsLoan<'ws, 'cols, 'activation, 'ctx> { } #[cfg(all(test, feature = "cuda-driver", any(target_os = "linux", target_os = "windows"), target_arch = "x86_64"))] -#[path = "routed_columns_loan_gpu.rs"] mod loan_gpu; mod context; diff --git a/crates/cuda-driver/src/routed_group_workspace_gpu.rs b/crates/cuda-driver/src/routed_group_workspace/gpu.rs similarity index 98% rename from crates/cuda-driver/src/routed_group_workspace_gpu.rs rename to crates/cuda-driver/src/routed_group_workspace/gpu.rs index e0a62115..6894ccd2 100644 --- a/crates/cuda-driver/src/routed_group_workspace_gpu.rs +++ b/crates/cuda-driver/src/routed_group_workspace/gpu.rs @@ -194,9 +194,7 @@ struct Subject<'a, 'c, 'w, 'x> { context: &'a Context<'c>, workspace: &'w mut RoutedGroupWorkspace<'x>, } -#[path = "routed_group_workspace_gpu/gu_case.rs"] mod gu_case; use gu_case::gu_case; -#[path = "routed_group_workspace_gpu/down_case.rs"] mod down_case; use down_case::down_case; diff --git a/crates/cuda-driver/src/routed_group_workspace_gpu/down_case.rs b/crates/cuda-driver/src/routed_group_workspace/gpu/down_case.rs similarity index 100% rename from crates/cuda-driver/src/routed_group_workspace_gpu/down_case.rs rename to crates/cuda-driver/src/routed_group_workspace/gpu/down_case.rs diff --git a/crates/cuda-driver/src/routed_group_workspace_gpu/gu_case.rs b/crates/cuda-driver/src/routed_group_workspace/gpu/gu_case.rs similarity index 100% rename from crates/cuda-driver/src/routed_group_workspace_gpu/gu_case.rs rename to crates/cuda-driver/src/routed_group_workspace/gpu/gu_case.rs diff --git a/crates/cuda-driver/src/routed_columns_loan_gpu.rs b/crates/cuda-driver/src/routed_group_workspace/loan_gpu.rs similarity index 99% rename from crates/cuda-driver/src/routed_columns_loan_gpu.rs rename to crates/cuda-driver/src/routed_group_workspace/loan_gpu.rs index b124eb3b..c10417a7 100644 --- a/crates/cuda-driver/src/routed_columns_loan_gpu.rs +++ b/crates/cuda-driver/src/routed_group_workspace/loan_gpu.rs @@ -151,6 +151,5 @@ struct LoanProof<'a, 'x, 'y> { finite: &'a mut RoutedStageFiniteGuard<'y>, report: &'a mut Report, } -#[path = "routed_columns_loan_gpu/loan_cases.rs"] mod loan_cases; use loan_cases::{case, mixed_pair}; diff --git a/crates/cuda-driver/src/routed_columns_loan_gpu/loan_cases.rs b/crates/cuda-driver/src/routed_group_workspace/loan_gpu/loan_cases.rs similarity index 100% rename from crates/cuda-driver/src/routed_columns_loan_gpu/loan_cases.rs rename to crates/cuda-driver/src/routed_group_workspace/loan_gpu/loan_cases.rs diff --git a/crates/cuda-driver/src/routed_group_workspace/routed_group_down_projection.rs b/crates/cuda-driver/src/routed_group_workspace/routed_group_down_projection.rs index 3911c749..7007893d 100644 --- a/crates/cuda-driver/src/routed_group_workspace/routed_group_down_projection.rs +++ b/crates/cuda-driver/src/routed_group_workspace/routed_group_down_projection.rs @@ -2,7 +2,6 @@ //! quantization and the column launches. //! Apart from `routed_group_workspace.rs`, which holds the types and the gate/up side. -#[allow(unused_imports)] use super::context::{check_table, reserve_pointers}; use super::{ Context, DeviceBuffer, Error, FixedKernel, FixedOperation, NativeWeights, ProjectionKind, ProjectionShape, diff --git a/crates/cuda-driver/src/routed_resident_queue.rs b/crates/cuda-driver/src/routed_resident_queue.rs index 452ec6a7..3b0538ca 100644 --- a/crates/cuda-driver/src/routed_resident_queue.rs +++ b/crates/cuda-driver/src/routed_resident_queue.rs @@ -68,14 +68,11 @@ enum Command { any(target_os = "linux", target_os = "windows"), target_pointer_width = "64" ))] -#[path = "routed_resident_queue_gpu.rs"] mod gpu; mod compose_phases; mod routed_resident_completion; mod routed_resident_queue_drop; mod routed_resident_queue_operations; -#[allow(unused_imports)] use routed_resident_queue_drop::gu_operation; -#[allow(unused_imports)] use routed_resident_queue_drop::scan; diff --git a/crates/cuda-driver/src/routed_resident_queue_gpu.rs b/crates/cuda-driver/src/routed_resident_queue/gpu.rs similarity index 83% rename from crates/cuda-driver/src/routed_resident_queue_gpu.rs rename to crates/cuda-driver/src/routed_resident_queue/gpu.rs index aaddc3c8..8b48b2c6 100644 --- a/crates/cuda-driver/src/routed_resident_queue_gpu.rs +++ b/crates/cuda-driver/src/routed_resident_queue/gpu.rs @@ -55,31 +55,14 @@ fn original_first_routed_resident_pipeline_all_products_refusals_reset_and_clean eprintln!("ROUTED-RESIDENT-QUEUE {report:?}"); } -#[path = "routed_resident_queue_gpu/upload.rs"] mod upload; -#[allow(unused_imports)] use upload::activation; -#[allow(unused_imports)] -use upload::compare; -#[allow(unused_imports)] -use upload::finite; -#[allow(unused_imports)] -use upload::original; -#[allow(unused_imports)] use upload::pair; -#[allow(unused_imports)] use upload::read; -#[allow(unused_imports)] use upload::upload; -#[allow(unused_imports)] use upload::view; -#[allow(unused_imports)] use upload::weights; -#[path = "routed_resident_queue_gpu/queue_cases.rs"] mod queue_cases; -#[allow(unused_imports)] use queue_cases::{CaseSpec, QueueProof, case}; -#[path = "routed_resident_queue_gpu/run.rs"] mod run; -#[allow(unused_imports)] use run::run; diff --git a/crates/cuda-driver/src/routed_resident_queue_gpu/queue_cases.rs b/crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs similarity index 100% rename from crates/cuda-driver/src/routed_resident_queue_gpu/queue_cases.rs rename to crates/cuda-driver/src/routed_resident_queue/gpu/queue_cases.rs diff --git a/crates/cuda-driver/src/routed_resident_queue_gpu/run.rs b/crates/cuda-driver/src/routed_resident_queue/gpu/run.rs similarity index 100% rename from crates/cuda-driver/src/routed_resident_queue_gpu/run.rs rename to crates/cuda-driver/src/routed_resident_queue/gpu/run.rs diff --git a/crates/cuda-driver/src/routed_resident_queue_gpu/upload.rs b/crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs similarity index 100% rename from crates/cuda-driver/src/routed_resident_queue_gpu/upload.rs rename to crates/cuda-driver/src/routed_resident_queue/gpu/upload.rs diff --git a/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_operations.rs b/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_operations.rs index 7da97152..a49de14d 100644 --- a/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_operations.rs +++ b/crates/cuda-driver/src/routed_resident_queue/routed_resident_queue_operations.rs @@ -2,7 +2,6 @@ //! allocated-bytes and failed queries. //! Apart from `routed_resident_queue.rs`, which holds the types and fields. -#[allow(unused_imports)] use super::compose_phases::{ComposeHostBuffers, compose_operations, zeroed_staging}; use super::{ DeviceBuffer, Error, Q8, Rc, Result, RoutedGateUpQ8, RoutedResidentCompletion, RoutedResidentOutputs, diff --git a/crates/cuda-driver/src/routed_stage_finite_guard.rs b/crates/cuda-driver/src/routed_stage_finite_guard.rs index 5523d37b..5fccf55b 100644 --- a/crates/cuda-driver/src/routed_stage_finite_guard.rs +++ b/crates/cuda-driver/src/routed_stage_finite_guard.rs @@ -231,5 +231,4 @@ impl Drop for RoutedStageFiniteGuard<'_> { } #[cfg(all(test, any(target_os = "linux", target_os = "windows"), target_pointer_width = "64"))] -#[path = "routed_stage_finite_guard_gpu.rs"] mod gpu; diff --git a/crates/cuda-driver/src/routed_stage_finite_guard_gpu.rs b/crates/cuda-driver/src/routed_stage_finite_guard/gpu.rs similarity index 100% rename from crates/cuda-driver/src/routed_stage_finite_guard_gpu.rs rename to crates/cuda-driver/src/routed_stage_finite_guard/gpu.rs diff --git a/crates/cuda-driver/tests/mock_driver.rs b/crates/cuda-driver/tests/mock_driver.rs index aad1961d..ff34c8b5 100644 --- a/crates/cuda-driver/tests/mock_driver.rs +++ b/crates/cuda-driver/tests/mock_driver.rs @@ -8,188 +8,70 @@ mod isolated_cpu_elf_matrix; #[path = "mock_driver/trace.rs"] mod trace; -#[allow(unused_imports)] -use trace::bootstrap_allocation_bounds; -#[allow(unused_imports)] -use trace::bootstrap_buffer_bounds; -#[allow(unused_imports)] -use trace::bootstrap_buffer_path; -#[allow(unused_imports)] use trace::bootstrap_child; -#[allow(unused_imports)] -use trace::bootstrap_create; -#[allow(unused_imports)] -use trace::bootstrap_early_fault; -#[allow(unused_imports)] use trace::bootstrap_load_failure; -#[allow(unused_imports)] -use trace::configure_faults; -#[allow(unused_imports)] use trace::cuda_errors; -#[allow(unused_imports)] use trace::run_fixture_case; -#[allow(unused_imports)] -use trace::scenario_command; -#[allow(unused_imports)] -use trace::scenario_failure; -#[allow(unused_imports)] use trace::trace; -#[allow(unused_imports)] use trace::valid_context_trace; #[path = "mock_driver/bootstrap_copies.rs"] mod bootstrap_copies; -#[allow(unused_imports)] use bootstrap_copies::bootstrap_close; -#[allow(unused_imports)] use bootstrap_copies::bootstrap_copies; -#[allow(unused_imports)] -use bootstrap_copies::bootstrap_copy_errors; -#[allow(unused_imports)] use bootstrap_copies::bootstrap_copy_trace; -#[allow(unused_imports)] -use bootstrap_copies::bootstrap_dtoh_fault; -#[allow(unused_imports)] -use bootstrap_copies::bootstrap_failed_copy_sync; -#[allow(unused_imports)] use bootstrap_copies::bootstrap_final_trace; -#[allow(unused_imports)] -use bootstrap_copies::bootstrap_htod_fault; -#[allow(unused_imports)] -use bootstrap_copies::bootstrap_pending_trace; -#[allow(unused_imports)] use bootstrap_copies::bootstrap_release; -#[allow(unused_imports)] use bootstrap_copies::vector_call; -#[allow(unused_imports)] use bootstrap_copies::vector_child; -#[allow(unused_imports)] -use bootstrap_copies::vector_count; -#[allow(unused_imports)] -use bootstrap_copies::vector_fixture; #[path = "mock_driver/vector_bounds.rs"] mod vector_bounds; -#[allow(unused_imports)] use vector_bounds::vector_bounds; -#[allow(unused_imports)] -use vector_bounds::vector_cache_trace; -#[allow(unused_imports)] use vector_bounds::vector_close; -#[allow(unused_imports)] use vector_bounds::vector_error; -#[allow(unused_imports)] -use vector_bounds::vector_expected; -#[allow(unused_imports)] -use vector_bounds::vector_fault_trace; -#[allow(unused_imports)] -use vector_bounds::vector_launch_sync; -#[allow(unused_imports)] use vector_bounds::vector_poison_refusals; -#[allow(unused_imports)] -use vector_bounds::vector_second_context; -#[allow(unused_imports)] use vector_bounds::vector_success; -#[allow(unused_imports)] -use vector_bounds::vector_successful_cache_trace; -#[allow(unused_imports)] use vector_bounds::vector_trace; #[path = "mock_driver/vector_module_context_trace.rs"] mod vector_module_context_trace; -#[allow(unused_imports)] -use vector_module_context_trace::check_arithmetic_fixture; -#[allow(unused_imports)] use vector_module_context_trace::check_f32_output; -#[allow(unused_imports)] -use vector_module_context_trace::check_matvec_dimensions; -#[allow(unused_imports)] -use vector_module_context_trace::check_matvec_foreign; -#[allow(unused_imports)] use vector_module_context_trace::f32_bytes; -#[allow(unused_imports)] use vector_module_context_trace::matvec_arithmetic; -#[allow(unused_imports)] -use vector_module_context_trace::matvec_bounds; -#[allow(unused_imports)] use vector_module_context_trace::matvec_call; -#[allow(unused_imports)] use vector_module_context_trace::matvec_child; -#[allow(unused_imports)] -use vector_module_context_trace::matvec_fixture; -#[allow(unused_imports)] use vector_module_context_trace::matvec_oracle; -#[allow(unused_imports)] -use vector_module_context_trace::matvec_rows; -#[allow(unused_imports)] -use vector_module_context_trace::rounded_add; -#[allow(unused_imports)] -use vector_module_context_trace::rounded_product; -#[allow(unused_imports)] use vector_module_context_trace::vector_module_context_trace; #[path = "mock_driver/check_matvec_lengths.rs"] mod check_matvec_lengths; -#[allow(unused_imports)] -use check_matvec_lengths::check_matvec_bad_length; -#[allow(unused_imports)] -use check_matvec_lengths::check_matvec_cache_trace; -#[allow(unused_imports)] use check_matvec_lengths::check_matvec_close; -#[allow(unused_imports)] use check_matvec_lengths::check_matvec_error; -#[allow(unused_imports)] use check_matvec_lengths::check_matvec_lengths; -#[allow(unused_imports)] use check_matvec_lengths::check_matvec_trace; -#[allow(unused_imports)] use check_matvec_lengths::check_poison_trace; -#[allow(unused_imports)] -use check_matvec_lengths::matvec_interleave; -#[allow(unused_imports)] use check_matvec_lengths::matvec_poison_refusals; -#[allow(unused_imports)] -use check_matvec_lengths::matvec_second_context; -#[allow(unused_imports)] use check_matvec_lengths::matvec_success; -#[allow(unused_imports)] use check_matvec_lengths::release_poisoned_fixture; #[path = "mock_driver/matvec_launch_count.rs"] mod matvec_launch_count; -#[allow(unused_imports)] use matvec_launch_count::check_launch_sync; -#[allow(unused_imports)] use matvec_launch_count::check_matvec_both_cleanup; -#[allow(unused_imports)] use matvec_launch_count::check_matvec_geometry; -#[allow(unused_imports)] use matvec_launch_count::matvec_launch_count; #[path = "mock_driver/row_types.rs"] mod row_types; -#[allow(unused_imports)] use row_types::ARITHMETIC_FIXTURES; -#[allow(unused_imports)] use row_types::COPY_POISON; -#[allow(unused_imports)] use row_types::Row; -#[allow(unused_imports)] use row_types::SCENARIO_FAILURES; -#[allow(unused_imports)] use row_types::SCENARIOS; -#[allow(unused_imports)] use row_types::VECTOR_ERRORS; -#[allow(unused_imports)] use row_types::VECTOR_EXECUTION_FAILURES; -#[allow(unused_imports)] use row_types::VECTOR_POISON; -#[allow(unused_imports)] use row_types::VectorFixture; -#[allow(unused_imports)] use row_types::WRONG_POP; #[path = "mock_driver/matvec_execution_failures_types.rs"] mod matvec_execution_failures_types; -#[allow(unused_imports)] use matvec_execution_failures_types::MATVEC_ERRORS; -#[allow(unused_imports)] use matvec_execution_failures_types::MATVEC_EXECUTION_FAILURES; -#[allow(unused_imports)] use matvec_execution_failures_types::MATVEC_POISON; -#[allow(unused_imports)] use matvec_execution_failures_types::MatvecFixture; diff --git a/crates/cuda-driver/tests/mock_driver/bootstrap_copies.rs b/crates/cuda-driver/tests/mock_driver/bootstrap_copies.rs index 2d4ba11b..fdc93aed 100644 --- a/crates/cuda-driver/tests/mock_driver/bootstrap_copies.rs +++ b/crates/cuda-driver/tests/mock_driver/bootstrap_copies.rs @@ -1,7 +1,6 @@ //! Functions: `bootstrap_copies`, `bootstrap_copy_errors`, `bootstrap_htod_fault`, `bootstrap_dtoh_fault` and 10 more. //! Split out of `mock_driver` to keep its files under the line limit. -#[allow(unused_imports)] use super::*; pub(super) fn bootstrap_copies( diff --git a/crates/cuda-driver/tests/mock_driver/check_matvec_lengths.rs b/crates/cuda-driver/tests/mock_driver/check_matvec_lengths.rs index 4e19ac21..ff2b9bc0 100644 --- a/crates/cuda-driver/tests/mock_driver/check_matvec_lengths.rs +++ b/crates/cuda-driver/tests/mock_driver/check_matvec_lengths.rs @@ -1,7 +1,6 @@ //! Functions: `check_matvec_lengths`, `check_matvec_bad_length`, `check_matvec_error`, `matvec_poison_refusals` and ... //! Split out of `mock_driver` to keep its files under the line limit. -#[allow(unused_imports)] use super::*; use leleka_cuda_driver::MatvecDims; diff --git a/crates/cuda-driver/tests/mock_driver/isolated_cpu_elf_matrix.rs b/crates/cuda-driver/tests/mock_driver/isolated_cpu_elf_matrix.rs index d741beff..7ed3e4fe 100644 --- a/crates/cuda-driver/tests/mock_driver/isolated_cpu_elf_matrix.rs +++ b/crates/cuda-driver/tests/mock_driver/isolated_cpu_elf_matrix.rs @@ -1,6 +1,5 @@ //! Tests of `mock_driver` by topic: isolated_cpu_elf_matrix, fixture_child. -#[allow(unused_imports)] use super::*; #[test] diff --git a/crates/cuda-driver/tests/mock_driver/matvec_execution_failures_types.rs b/crates/cuda-driver/tests/mock_driver/matvec_execution_failures_types.rs index c7814105..0366f9b8 100644 --- a/crates/cuda-driver/tests/mock_driver/matvec_execution_failures_types.rs +++ b/crates/cuda-driver/tests/mock_driver/matvec_execution_failures_types.rs @@ -1,8 +1,6 @@ //! Defines `MatvecFixture`. //! MATVEC_EXECUTION_FAILURES, MATVEC_POISON, MATVEC_ERRORS, MatvecFixture. -#[allow(unused_imports)] -use super::*; pub(super) const MATVEC_EXECUTION_FAILURES: &[&str] = &[ "matvec_load", diff --git a/crates/cuda-driver/tests/mock_driver/matvec_launch_count.rs b/crates/cuda-driver/tests/mock_driver/matvec_launch_count.rs index 0ddfb76b..d776a880 100644 --- a/crates/cuda-driver/tests/mock_driver/matvec_launch_count.rs +++ b/crates/cuda-driver/tests/mock_driver/matvec_launch_count.rs @@ -1,7 +1,6 @@ //! Functions: `matvec_launch_count`, `check_matvec_geometry`, `check_matvec_both_cleanup`, `check_launch_sync`. //! Split out of `mock_driver` to keep its files under the line limit. -#[allow(unused_imports)] use super::*; pub(super) fn matvec_launch_count(case: &str) -> usize { diff --git a/crates/cuda-driver/tests/mock_driver/row_types.rs b/crates/cuda-driver/tests/mock_driver/row_types.rs index f86771b4..d1374922 100644 --- a/crates/cuda-driver/tests/mock_driver/row_types.rs +++ b/crates/cuda-driver/tests/mock_driver/row_types.rs @@ -1,8 +1,6 @@ //! Defines `Row`, `VectorFixture`. //! Row, SCENARIOS, SCENARIO_FAILURES, WRONG_POP, COPY_POISON, VECTOR_EXECUTION_FAILURES .... -#[allow(unused_imports)] -use super::*; #[derive(Debug)] pub(super) struct Row { diff --git a/crates/cuda-driver/tests/mock_driver/trace.rs b/crates/cuda-driver/tests/mock_driver/trace.rs index 4283d2d0..8f1b2b66 100644 --- a/crates/cuda-driver/tests/mock_driver/trace.rs +++ b/crates/cuda-driver/tests/mock_driver/trace.rs @@ -1,7 +1,6 @@ //! Functions: `trace`, `valid_context_trace`, `cuda_errors`, `run_fixture_case` and 10 more. //! Split out of `mock_driver` to keep its files under the line limit. -#[allow(unused_imports)] use super::*; pub(super) fn trace() -> Vec { diff --git a/crates/cuda-driver/tests/mock_driver/vector_bounds.rs b/crates/cuda-driver/tests/mock_driver/vector_bounds.rs index 5f31926a..3c8a63ee 100644 --- a/crates/cuda-driver/tests/mock_driver/vector_bounds.rs +++ b/crates/cuda-driver/tests/mock_driver/vector_bounds.rs @@ -1,7 +1,6 @@ //! Functions: `vector_bounds`, `vector_error`, `vector_poison_refusals`, `vector_expected` and 8 more. //! Split out of `mock_driver` to keep its files under the line limit. -#[allow(unused_imports)] use super::*; use leleka_cuda_driver::MatvecDims; diff --git a/crates/cuda-driver/tests/mock_driver/vector_module_context_trace.rs b/crates/cuda-driver/tests/mock_driver/vector_module_context_trace.rs index 2186851c..88cf7492 100644 --- a/crates/cuda-driver/tests/mock_driver/vector_module_context_trace.rs +++ b/crates/cuda-driver/tests/mock_driver/vector_module_context_trace.rs @@ -1,7 +1,6 @@ //! Functions: `vector_module_context_trace`, `f32_bytes`, `rounded_product`, `rounded_add` and 11 more. //! Split out of `mock_driver` to keep its files under the line limit. -#[allow(unused_imports)] use super::*; use leleka_cuda_driver::MatvecDims; diff --git a/crates/cuda-driver/tests/original_serve_preflight_probe.rs b/crates/cuda-driver/tests/original_serve_preflight_probe.rs index 7e1a9830..6913b37c 100644 --- a/crates/cuda-driver/tests/original_serve_preflight_probe.rs +++ b/crates/cuda-driver/tests/original_serve_preflight_probe.rs @@ -55,21 +55,12 @@ mod preflight_00_sealed_asset_report; #[path = "original_serve_preflight_probe/synthetic_mtp_owner.rs"] mod synthetic_mtp_owner; -#[allow(unused_imports)] use synthetic_mtp_owner::budget; -#[allow(unused_imports)] -use synthetic_mtp_owner::embed_row_bytes; -#[allow(unused_imports)] use synthetic_mtp_owner::env_list; -#[allow(unused_imports)] use synthetic_mtp_owner::env_usize; -#[allow(unused_imports)] use synthetic_mtp_owner::geometry; -#[allow(unused_imports)] use synthetic_mtp_owner::layout_options; -#[allow(unused_imports)] use synthetic_mtp_owner::{MtpShape, synthetic_mtp}; #[path = "original_serve_preflight_probe/synthetic_verifier.rs"] mod synthetic_verifier; -#[allow(unused_imports)] -use synthetic_verifier::{Drafting, Sizes, synthetic_verifier}; +use synthetic_verifier::{Sizes, synthetic_verifier}; diff --git a/crates/cuda-driver/tests/original_serve_preflight_probe/preflight_00_sealed_asset_report.rs b/crates/cuda-driver/tests/original_serve_preflight_probe/preflight_00_sealed_asset_report.rs index 1768b8cd..c2f4019e 100644 --- a/crates/cuda-driver/tests/original_serve_preflight_probe/preflight_00_sealed_asset_report.rs +++ b/crates/cuda-driver/tests/original_serve_preflight_probe/preflight_00_sealed_asset_report.rs @@ -2,7 +2,6 @@ //! preflight_00_sealed_asset_report, preflight_01_device_limits, preflight_10_lazy_constructors, //! preflight_20_prefill_arena .... -#[allow(unused_imports)] use super::*; /// Which gating assets the build itself reports as unsealed (no GPU needed beyond the process). diff --git a/crates/cuda-driver/tests/original_serve_preflight_probe/synthetic_mtp_owner.rs b/crates/cuda-driver/tests/original_serve_preflight_probe/synthetic_mtp_owner.rs index f2185aa2..a5b9a047 100644 --- a/crates/cuda-driver/tests/original_serve_preflight_probe/synthetic_mtp_owner.rs +++ b/crates/cuda-driver/tests/original_serve_preflight_probe/synthetic_mtp_owner.rs @@ -1,7 +1,6 @@ //! The probe knobs read from the environment and the synthetic MTP owner assembly (`synthetic_mtp`): sizes, layout //! options and the owner built over uninitialised, correctly sized weights. -#[allow(unused_imports)] use super::*; pub(super) fn env_usize(name: &str, default: usize) -> usize { diff --git a/crates/cuda-driver/tests/original_serve_preflight_probe/synthetic_verifier.rs b/crates/cuda-driver/tests/original_serve_preflight_probe/synthetic_verifier.rs index 875df6ee..a3d8b2b8 100644 --- a/crates/cuda-driver/tests/original_serve_preflight_probe/synthetic_verifier.rs +++ b/crates/cuda-driver/tests/original_serve_preflight_probe/synthetic_verifier.rs @@ -1,7 +1,6 @@ //! The synthetic verifier probe: window graphs and the commit graph recorded over uninitialised weights, then //! replayed request by request over the same MTP drafter. -#[allow(unused_imports)] use super::*; use std::rc::Rc; use weights::Weights; diff --git a/crates/cuda-driver/tests/projection_family_mock/common_protocol_matrix.rs b/crates/cuda-driver/tests/projection_family_mock/common_protocol_matrix.rs index b8e1e420..2a9f2a6c 100644 --- a/crates/cuda-driver/tests/projection_family_mock/common_protocol_matrix.rs +++ b/crates/cuda-driver/tests/projection_family_mock/common_protocol_matrix.rs @@ -1,6 +1,5 @@ //! Tests of `projection_family_mock` by topic: common_protocol_matrix. -#[allow(unused_imports)] use super::*; use leleka_cuda_driver::{Context, DeviceBuffer}; use std::{path::Path, process::Output}; diff --git a/crates/cuda-driver/tests/projection_family_mock/family_public_q8_child.rs b/crates/cuda-driver/tests/projection_family_mock/family_public_q8_child.rs index e8372826..cf0a5f3c 100644 --- a/crates/cuda-driver/tests/projection_family_mock/family_public_q8_child.rs +++ b/crates/cuda-driver/tests/projection_family_mock/family_public_q8_child.rs @@ -1,6 +1,5 @@ //! Tests of `projection_family_mock` by topic: family_public_q8_child. -#[allow(unused_imports)] use super::*; use leleka_cuda_driver::{Context, DeviceBuffer}; use std::path::Path; diff --git a/crates/cuda-driver/tests/q6_mock/isolated_q6_protocol_matrix.rs b/crates/cuda-driver/tests/q6_mock/isolated_q6_protocol_matrix.rs index 36476437..0697a88a 100644 --- a/crates/cuda-driver/tests/q6_mock/isolated_q6_protocol_matrix.rs +++ b/crates/cuda-driver/tests/q6_mock/isolated_q6_protocol_matrix.rs @@ -1,6 +1,5 @@ //! Tests of `q6_mock` by topic: isolated_q6_protocol_matrix. -#[allow(unused_imports)] use super::*; use std::path::Path; diff --git a/crates/cuda-driver/tests/q6_mock/q6_fixture_child.rs b/crates/cuda-driver/tests/q6_mock/q6_fixture_child.rs index b19a1f8d..dbe821cb 100644 --- a/crates/cuda-driver/tests/q6_mock/q6_fixture_child.rs +++ b/crates/cuda-driver/tests/q6_mock/q6_fixture_child.rs @@ -1,6 +1,5 @@ //! Tests of `q6_mock` by topic: q6_fixture_child. -#[allow(unused_imports)] use super::*; use leleka_cuda_driver::{Context, Device, DeviceBuffer}; diff --git a/crates/cuda-model/src/bringup_trace.rs b/crates/cuda-model/src/bringup_trace.rs index 0df8203c..e229ed44 100644 --- a/crates/cuda-model/src/bringup_trace.rs +++ b/crates/cuda-model/src/bringup_trace.rs @@ -1,9 +1,11 @@ //! The bring-up tracing switch shared by the driver's `bringup_trace!` macro and the command profile. +use crate::env_switch::{EnvSwitch, rules}; + /// Bring-up tracing: `LELEKA_BRINGUP_TRACE` set (any value) enables the `DBG`/`PROBE` diagnostics on stderr. /// Off by default so production serving prints nothing extra. #[inline] pub fn bringup_trace_enabled() -> bool { - static ON: std::sync::OnceLock = std::sync::OnceLock::new(); - *ON.get_or_init(|| crate::settings::var_os("LELEKA_BRINGUP_TRACE").is_some()) + static BRINGUP_TRACE: EnvSwitch = EnvSwitch::new("LELEKA_BRINGUP_TRACE", rules::is_set); + BRINGUP_TRACE.get() } diff --git a/crates/cuda-model/src/command_profile.rs b/crates/cuda-model/src/command_profile.rs index 69488787..1b9c369d 100644 --- a/crates/cuda-model/src/command_profile.rs +++ b/crates/cuda-model/src/command_profile.rs @@ -2,6 +2,7 @@ //! producers (each command drained on its own; attribution only, the drains slow the run). The runtime's //! `PREFILL-PROFILE` takes and prints the totals once per chunk. use std::sync::Mutex; +use crate::env_switch::{EnvSwitch, rules}; use std::time::Duration; static TOTALS: Mutex> = Mutex::new(Vec::new()); @@ -9,10 +10,8 @@ static TOTALS: Mutex> = /// Whether per-command timing is on (both switches set). #[inline] pub fn enabled() -> bool { - static ON: std::sync::OnceLock = std::sync::OnceLock::new(); - *ON.get_or_init(|| { - crate::bringup_trace_enabled() && crate::settings::var_os("LELEKA_PREFILL_PROFILE_SYNC").is_some() - }) + static PROFILE_SYNC: EnvSwitch = EnvSwitch::new("LELEKA_PREFILL_PROFILE_SYNC", rules::is_set); + crate::bringup_trace_enabled() && PROFILE_SYNC.get() } pub fn add(producer: &'static str, index: usize, label: &'static str, elapsed: Duration) { if let Ok(mut totals) = TOTALS.lock() { diff --git a/crates/cuda-model/src/env_switch.rs b/crates/cuda-model/src/env_switch.rs new file mode 100644 index 00000000..ed6ebc56 --- /dev/null +++ b/crates/cuda-model/src/env_switch.rs @@ -0,0 +1,122 @@ +//! An operator switch read once from one environment variable, with the rule that turns its text into a flag. +//! +//! Many tuning and diagnostic switches of the CUDA stack are "on", "off" or "on unless `0`". Each used to carry its own +//! `static ON: OnceLock` and its own comparison. [`EnvSwitch`] names the variable and the [`rules`] in one place, +//! caches the answer on the first [`EnvSwitch::get`] (a hot path pays one atomic load afterwards, never an environment +//! read), and can be judged without touching the process environment through [`EnvSwitch::decide`]. +//! +//! This file is the one place of the model crate where a variable is read and a value is cached for the process life; +//! both are listed in `architecture.json` `exceptions`. + +use std::ffi::OsStr; +use std::sync::OnceLock; + +/// A rule: the variable's text (`None` when it is unset) to the switch position. +pub type Rule = fn(Option<&OsStr>) -> bool; + +/// The rules the switches of this repository use. The names say what makes the switch "on". +pub mod rules { + use std::ffi::OsStr; + + /// On when the variable exists, with any value (also empty). + pub fn is_set(value: Option<&OsStr>) -> bool { + value.is_some() + } + + /// On when the variable exists and is not `0`. + pub fn is_set_and_not_zero(value: Option<&OsStr>) -> bool { + value.is_some_and(|v| v != "0") + } + + /// On only for the value `1`. + pub fn is_one(value: Option<&OsStr>) -> bool { + value.is_some_and(|v| v == "1") + } + + /// On when the variable is valid text that is neither empty nor `0`. + pub fn is_text_not_empty_and_not_zero(value: Option<&OsStr>) -> bool { + value.and_then(OsStr::to_str).is_some_and(|v| !v.is_empty() && v != "0") + } + + /// On unless the variable is `0` (a switch that is on by default). + pub fn is_unset_or_not_zero(value: Option<&OsStr>) -> bool { + value.is_none_or(|v| v != "0") + } + + /// On unless the variable is `off` or `0` (a switch that is on by default). + pub fn is_unset_or_not_off(value: Option<&OsStr>) -> bool { + value.is_none_or(|v| v != "off" && v != "0") + } +} + +/// One switch: the variable, its rule, and the answer cached on the first read. +pub struct EnvSwitch { + name: &'static str, + rule: Rule, + answer: OnceLock, +} + +impl EnvSwitch { + /// A switch over the variable `name`; nothing is read until the first [`Self::get`]. + pub const fn new(name: &'static str, rule: Rule) -> Self { + Self { name, rule, answer: OnceLock::new() } + } + + /// The name of the variable. + pub const fn name(&self) -> &'static str { + self.name + } + + /// The position of the switch: the environment is read on the first call only. + #[inline] + pub fn get(&self) -> bool { + *self.answer.get_or_init(|| (self.rule)(std::env::var_os(self.name).as_deref())) + } + + /// What the rule says for a given value, without reading the environment or the cache. + pub fn decide(&self, value: Option<&OsStr>) -> bool { + (self.rule)(value) + } +} + +#[cfg(test)] +mod tests { + use super::{EnvSwitch, rules}; + use std::ffi::OsStr; + + fn os(text: &str) -> Option<&OsStr> { + Some(OsStr::new(text)) + } + + #[test] + fn presence_rules_judge_unset_empty_and_zero() { + assert!(!rules::is_set(None) && rules::is_set(os("")) && rules::is_set(os("0"))); + assert!(!rules::is_set_and_not_zero(None) && !rules::is_set_and_not_zero(os("0"))); + assert!(rules::is_set_and_not_zero(os("1")) && rules::is_set_and_not_zero(os("yes"))); + } + + #[test] + fn the_one_rule_accepts_only_one() { + assert!(!rules::is_one(None) && !rules::is_one(os("0")) && !rules::is_one(os("yes"))); + assert!(rules::is_one(os("1"))); + } + + #[test] + fn default_on_rules_turn_off_only_on_their_words() { + assert!(rules::is_unset_or_not_zero(None) && !rules::is_unset_or_not_zero(os("0"))); + assert!(rules::is_unset_or_not_zero(os("off")) && rules::is_unset_or_not_zero(os("1"))); + assert!(rules::is_unset_or_not_off(None) && !rules::is_unset_or_not_off(os("off"))); + assert!(!rules::is_unset_or_not_off(os("0")) && rules::is_unset_or_not_off(os("on"))); + } + + #[test] + fn a_switch_over_an_unset_variable_follows_its_rule_and_keeps_its_answer() { + static ABSENT_ON: EnvSwitch = + EnvSwitch::new("LELEKA_TEST_SWITCH_THAT_IS_NEVER_SET", rules::is_unset_or_not_zero); + static ABSENT_OFF: EnvSwitch = EnvSwitch::new("LELEKA_TEST_SWITCH_THAT_IS_NEVER_SET", rules::is_one); + assert!(ABSENT_ON.get() && ABSENT_ON.get()); + assert!(!ABSENT_OFF.get()); + assert_eq!(ABSENT_ON.name(), "LELEKA_TEST_SWITCH_THAT_IS_NEVER_SET"); + assert!(!ABSENT_ON.decide(os("0"))); + } +} diff --git a/crates/cuda-model/src/host_profile.rs b/crates/cuda-model/src/host_profile.rs index 9ac86480..1a0d348d 100644 --- a/crates/cuda-model/src/host_profile.rs +++ b/crates/cuda-model/src/host_profile.rs @@ -1,14 +1,15 @@ //! Operator profile of the driver's host-side spans (`LELEKA_SERVE_PROFILE=1`, off by default), summed per thread //! and printed by the runtime's serve profile next to its own spans. Inclusive wall-clock; nested spans are not //! additive. When the switch is off a span is one cached boolean test. +use crate::env_switch::{EnvSwitch, rules}; use std::cell::RefCell; use std::time::Instant; /// `LELEKA_SERVE_PROFILE` set to anything but `0`, read once. #[inline] pub fn enabled() -> bool { - static ON: std::sync::OnceLock = std::sync::OnceLock::new(); - *ON.get_or_init(|| crate::settings::var("LELEKA_SERVE_PROFILE").is_ok_and(|v| !v.is_empty() && v != "0")) + static SERVE_PROFILE: EnvSwitch = EnvSwitch::new("LELEKA_SERVE_PROFILE", rules::is_text_not_empty_and_not_zero); + SERVE_PROFILE.get() } thread_local! { diff --git a/crates/cuda-model/src/lib.rs b/crates/cuda-model/src/lib.rs index de9bf27c..da5026b7 100644 --- a/crates/cuda-model/src/lib.rs +++ b/crates/cuda-model/src/lib.rs @@ -19,6 +19,7 @@ mod bringup_trace; pub mod command_profile; pub mod device_arena; pub mod draft_check_batch; +pub mod env_switch; mod error; mod error_messages; pub mod host_profile; @@ -33,7 +34,6 @@ pub mod ring_prefetch; pub mod s_gemv_legacy; pub mod serving_context; mod shapes; -mod settings; pub use bringup_trace::bringup_trace_enabled; pub use error::{Error, Result}; diff --git a/crates/cuda-model/src/original_mtp_loader.rs b/crates/cuda-model/src/original_mtp_loader.rs index d62cad49..ff2cc2f6 100644 --- a/crates/cuda-model/src/original_mtp_loader.rs +++ b/crates/cuda-model/src/original_mtp_loader.rs @@ -250,20 +250,8 @@ pub struct OriginalMtpLoadPlan { mod tests; mod loader_error; -#[allow(unused_imports)] -use loader_error::add; -#[allow(unused_imports)] -use loader_error::aligned; -#[allow(unused_imports)] pub use loader_error::bind_bytes; -#[allow(unused_imports)] -use loader_error::ceil; -#[allow(unused_imports)] pub use loader_error::coupled_plan; -#[allow(unused_imports)] pub use loader_error::mapped_staging; -#[allow(unused_imports)] -use loader_error::mul; -#[allow(unused_imports)] pub use loader_error::original_mtp_bind_reserve; mod original_mtp_load_plan; diff --git a/crates/cuda-model/src/original_prefill_schedule.rs b/crates/cuda-model/src/original_prefill_schedule.rs index e566f0fa..3fafe0e0 100644 --- a/crates/cuda-model/src/original_prefill_schedule.rs +++ b/crates/cuda-model/src/original_prefill_schedule.rs @@ -220,12 +220,8 @@ mod tests; mod ring_policy; pub use ring_policy::FuseFlags; -#[allow(unused_imports)] pub use ring_policy::chunks; -#[allow(unused_imports)] pub use ring_policy::fuse_after_half; -#[allow(unused_imports)] pub use ring_policy::ring_slots; mod planner; -#[allow(unused_imports)] pub use planner::check_trace; diff --git a/crates/cuda-model/src/qsa_prompt_attention_select.rs b/crates/cuda-model/src/qsa_prompt_attention_select.rs index a58b1bf0..445b39b4 100644 --- a/crates/cuda-model/src/qsa_prompt_attention_select.rs +++ b/crates/cuda-model/src/qsa_prompt_attention_select.rs @@ -130,36 +130,18 @@ pub struct LaunchSlice { mod tests; mod pool_presence; -#[allow(unused_imports)] -use pool_presence::align_up; -#[allow(unused_imports)] pub use pool_presence::hip_wmma_usable; -#[allow(unused_imports)] pub use pool_presence::launch_slices; -#[allow(unused_imports)] pub use pool_presence::pool_row; -#[allow(unused_imports)] pub use pool_presence::reference_attention_f64; -#[allow(unused_imports)] pub use pool_presence::scale_log2; -#[allow(unused_imports)] pub use pool_presence::select; -#[allow(unused_imports)] pub use pool_presence::slice_offsets; -#[allow(unused_imports)] pub use pool_presence::smem_bytes; -#[allow(unused_imports)] pub use pool_presence::smem2_bytes; mod q_prescale; -#[allow(unused_imports)] pub use q_prescale::f16_hi_lo; -#[allow(unused_imports)] pub use q_prescale::f16_round; -#[allow(unused_imports)] pub use q_prescale::f16_to_f32; -#[allow(unused_imports)] pub use q_prescale::f32_to_f16; -#[allow(unused_imports)] -use q_prescale::pow2f; -#[allow(unused_imports)] pub use q_prescale::q_prescale; diff --git a/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs b/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs index 9389e27b..1bc5a2ce 100644 --- a/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs +++ b/crates/cuda-model/src/qsa_prompt_attention_select/pool_presence.rs @@ -70,12 +70,6 @@ impl SelectSwitches { pub fn from_values(qsa_warp: Option<&str>, prompt_attn_v1: Option<&str>) -> Self { Self { qsa_warp_arm: matches!(qsa_warp, Some("1") | Some("attn")), prompt_attn_v1: prompt_attn_v1.is_some() } } - pub fn from_environment() -> Self { - Self::from_values( - crate::settings::var("STRATA_QSA_WARP").ok().as_deref(), - crate::settings::var("STRATA_PROMPT_ATTN_V1").ok().as_deref(), - ) - } } impl PromptAttnKernel { pub const fn kv_mode(self) -> Option { diff --git a/crates/cuda-model/src/s_gemv_legacy.rs b/crates/cuda-model/src/s_gemv_legacy.rs index 8eb42df9..41ebaefb 100644 --- a/crates/cuda-model/src/s_gemv_legacy.rs +++ b/crates/cuda-model/src/s_gemv_legacy.rs @@ -121,54 +121,25 @@ pub struct Weights<'a> { mod tests; mod s_form_planners; -#[allow(unused_imports)] -use s_form_planners::bits_u8; -#[allow(unused_imports)] -use s_form_planners::ceil_div; -#[allow(unused_imports)] use s_form_planners::check_tpr; -#[allow(unused_imports)] use s_form_planners::grid_for; -#[allow(unused_imports)] -use s_form_planners::group_shift_of; -#[allow(unused_imports)] pub use s_form_planners::plan_s_gemv; -#[allow(unused_imports)] pub use s_form_planners::plan_s_gemv_q8_0_split; -#[allow(unused_imports)] pub use s_form_planners::plan_s_gemv_q8k; -#[allow(unused_imports)] pub use s_form_planners::plan_s_gemv_q8k_split; -#[allow(unused_imports)] pub use s_form_planners::plan_s_gemv_split; -#[allow(unused_imports)] pub use s_form_planners::plan_s2_gemv; -#[allow(unused_imports)] -use s_form_planners::q8_form_ok; mod s2_gemv_planners; -#[allow(unused_imports)] pub use s2_gemv_planners::code_at; -#[allow(unused_imports)] pub use s2_gemv_planners::decode; -#[allow(unused_imports)] pub use s2_gemv_planners::f16_to_f32; -#[allow(unused_imports)] pub use s2_gemv_planners::naive_f32; -#[allow(unused_imports)] pub use s2_gemv_planners::pack_codes; -#[allow(unused_imports)] pub use s2_gemv_planners::plan_s2_gemv_fast; -#[allow(unused_imports)] pub use s2_gemv_planners::plan_s2_gemv_q8; -#[allow(unused_imports)] pub use s2_gemv_planners::plan_s2_gemv_quads; -#[allow(unused_imports)] pub use s2_gemv_planners::q8_0_dequant; -#[allow(unused_imports)] pub use s2_gemv_planners::q8_split_f32; -#[allow(unused_imports)] pub use s2_gemv_planners::q8k_dequant; -#[allow(unused_imports)] pub use s2_gemv_planners::reference_f64; -#[allow(unused_imports)] pub use s2_gemv_planners::split_f32; diff --git a/crates/cuda-model/src/settings.rs b/crates/cuda-model/src/settings.rs deleted file mode 100644 index 4ce948db..00000000 --- a/crates/cuda-model/src/settings.rs +++ /dev/null @@ -1,17 +0,0 @@ -//! The only place of this crate that reads the process environment (`env-read` ratchet of `architecture.json`). -//! The reads keep their call sites and their parsing; a later step replaces these functions by a parsed settings value. - -use std::env::{self, VarError}; -use std::ffi::{OsStr, OsString}; - -/// `std::env::var`: the text of an environment variable. -#[inline] -pub(crate) fn var>(key: K) -> Result { - env::var(key) -} - -/// `std::env::var_os`: an environment variable that may not be valid text. -#[inline] -pub(crate) fn var_os>(key: K) -> Option { - env::var_os(key) -} diff --git a/crates/experimental-ref/src/cvec.rs b/crates/experimental-ref/src/cvec.rs index 0e8ccce5..d7a4768e 100644 --- a/crates/experimental-ref/src/cvec.rs +++ b/crates/experimental-ref/src/cvec.rs @@ -109,8 +109,6 @@ pub struct CvecTables { mod tests; mod cvec_reading_and_errors; -#[allow(unused_imports)] pub use cvec_reading_and_errors::*; mod load_control_vectors; -#[allow(unused_imports)] pub use load_control_vectors::*; diff --git a/crates/experimental-ref/src/keyless.rs b/crates/experimental-ref/src/keyless.rs index 1a115c62..e5e82708 100644 --- a/crates/experimental-ref/src/keyless.rs +++ b/crates/experimental-ref/src/keyless.rs @@ -309,7 +309,7 @@ fn admit_layer(r: &mut Reader<'_>, g: &KeylessGeometry, seen: &mut BTreeSet pub fn parse_artifact<'a>( bytes: &[u8], g: &KeylessGeometry, - source: &dyn Fn(u32, &str) -> Option>, + source: &(impl Fn(u32, &str) -> Option> + ?Sized), ) -> Result { let mut r = Reader { b: bytes, at: 0 }; let (layers, heads) = read_artifact_header(&mut r, g)?; diff --git a/crates/experimental-ref/src/kv_stream.rs b/crates/experimental-ref/src/kv_stream.rs index 39ce41d5..8cb0de22 100644 --- a/crates/experimental-ref/src/kv_stream.rs +++ b/crates/experimental-ref/src/kv_stream.rs @@ -139,8 +139,6 @@ pub struct StreamMap { mod tests; mod map_bytes; -#[allow(unused_imports)] pub use map_bytes::*; mod residency_map; -#[allow(unused_imports)] pub use residency_map::*; diff --git a/crates/experimental-ref/src/remote_experts.rs b/crates/experimental-ref/src/remote_experts.rs index d0605e92..b516235a 100644 --- a/crates/experimental-ref/src/remote_experts.rs +++ b/crates/experimental-ref/src/remote_experts.rs @@ -349,7 +349,6 @@ pub fn dispatch( } mod device_image; -#[allow(unused_imports)] pub use device_image::*; mod dispatch_groups; use dispatch_groups::{assign_groups, pack_groups, pick_unclaimed}; diff --git a/crates/experimental-ref/src/remote_experts/device_image.rs b/crates/experimental-ref/src/remote_experts/device_image.rs index 413583f3..e20cfd8d 100644 --- a/crates/experimental-ref/src/remote_experts/device_image.rs +++ b/crates/experimental-ref/src/remote_experts/device_image.rs @@ -9,7 +9,7 @@ use super::{ pub struct RemoteMeta; impl RemoteMeta { - pub fn to_bytes(d: &Dispatch, device_slot: &dyn Fn(i32) -> u64) -> [u8; META_BYTES] { + pub fn to_bytes(d: &Dispatch, device_slot: &(impl Fn(i32) -> u64 + ?Sized)) -> [u8; META_BYTES] { let mut b = [0u8; META_BYTES]; for (g, grp) in d.groups.iter().enumerate() { b[META_PTR_OFFSET + g * 8..][..8].copy_from_slice(&device_slot(grp.slot).to_le_bytes()); diff --git a/crates/experimental-ref/tests/emulated_kernels/cvec_reduction.rs b/crates/experimental-ref/tests/emulated_kernels/cvec_reduction.rs index 4cc6d2b5..d6dfad83 100644 --- a/crates/experimental-ref/tests/emulated_kernels/cvec_reduction.rs +++ b/crates/experimental-ref/tests/emulated_kernels/cvec_reduction.rs @@ -1,6 +1,5 @@ //! The cvec kernel against its reduction-tree twin. -#[allow(unused_imports)] use super::*; // ------------------------------------------------------------------------------------ control vector diff --git a/crates/experimental-ref/tests/emulated_kernels/fwht_and_q4_append.rs b/crates/experimental-ref/tests/emulated_kernels/fwht_and_q4_append.rs index f74db44b..5be46fb7 100644 --- a/crates/experimental-ref/tests/emulated_kernels/fwht_and_q4_append.rs +++ b/crates/experimental-ref/tests/emulated_kernels/fwht_and_q4_append.rs @@ -1,6 +1,5 @@ //! The FWHT kernel and the q4_0 append, batch and gather kernels against the reference. -#[allow(unused_imports)] use super::*; #[test] diff --git a/crates/experimental-ref/tests/emulated_kernels/int8_and_k8v4_append.rs b/crates/experimental-ref/tests/emulated_kernels/int8_and_k8v4_append.rs index cb56f56d..21ebf380 100644 --- a/crates/experimental-ref/tests/emulated_kernels/int8_and_k8v4_append.rs +++ b/crates/experimental-ref/tests/emulated_kernels/int8_and_k8v4_append.rs @@ -1,6 +1,5 @@ //! The int8 value-only and K8V4 append and gather kernels against the reference. -#[allow(unused_imports)] use super::*; /// The twelve cells every section appends, the page table and the cells it gathers. diff --git a/crates/experimental-ref/tests/emulated_kernels/kv_stream_and_keyless_routing.rs b/crates/experimental-ref/tests/emulated_kernels/kv_stream_and_keyless_routing.rs index a349d4bc..9a07639a 100644 --- a/crates/experimental-ref/tests/emulated_kernels/kv_stream_and_keyless_routing.rs +++ b/crates/experimental-ref/tests/emulated_kernels/kv_stream_and_keyless_routing.rs @@ -1,6 +1,5 @@ //! The KV stream resolver, copy and ring, and the keyless query routing kernel. -#[allow(unused_imports)] use super::*; const N_BLOCKS: usize = 1600; diff --git a/crates/experimental-ref/tests/emulated_kernels/quantized_attention.rs b/crates/experimental-ref/tests/emulated_kernels/quantized_attention.rs index 16008f2d..d77775f4 100644 --- a/crates/experimental-ref/tests/emulated_kernels/quantized_attention.rs +++ b/crates/experimental-ref/tests/emulated_kernels/quantized_attention.rs @@ -1,6 +1,5 @@ //! The quantized attention kernels against the double-precision reference. -#[allow(unused_imports)] use super::*; /// The inputs shared by the three modes: the page table, the cells' keys and values, the queries and the cell diff --git a/crates/gateway-text/src/lib.rs b/crates/gateway-text/src/lib.rs index 05406b52..d7d15d96 100644 --- a/crates/gateway-text/src/lib.rs +++ b/crates/gateway-text/src/lib.rs @@ -4,7 +4,6 @@ //! through `#[path]`. They need only `minijinja`, `serde`, `serde_json`, `sha2`, `regex` and `hex`, so they are a leaf //! crate that both hosts use. -mod env_settings; pub mod prompt; pub mod response_tools; pub mod tool_output; diff --git a/crates/gateway-text/src/prompt.rs b/crates/gateway-text/src/prompt.rs index 4a73b975..de408ed0 100644 --- a/crates/gateway-text/src/prompt.rs +++ b/crates/gateway-text/src/prompt.rs @@ -109,6 +109,8 @@ pub enum Effort { #[path = "prompt/tests.rs"] mod tests; +#[path = "prompt/env_settings.rs"] +mod env_settings; #[path = "prompt/json.rs"] mod json; pub use json::*; diff --git a/crates/gateway-text/src/env_settings.rs b/crates/gateway-text/src/prompt/env_settings.rs similarity index 100% rename from crates/gateway-text/src/env_settings.rs rename to crates/gateway-text/src/prompt/env_settings.rs diff --git a/crates/gateway-text/src/prompt/python_json.rs b/crates/gateway-text/src/prompt/python_json.rs index a4976f5c..6405904e 100644 --- a/crates/gateway-text/src/prompt/python_json.rs +++ b/crates/gateway-text/src/prompt/python_json.rs @@ -3,7 +3,7 @@ //! used to drop completed empty assistant turns from the history. use super::{Error, ErrorKind, Json, Kwargs, State, Value, ValueKind, py_space, python_float}; -use crate::env_settings::keep_empty_turns; +use super::env_settings::keep_empty_turns; pub(super) fn json_string(text: &str, ensure_ascii: bool, out: &mut String) { out.push('"'); diff --git a/crates/gateway-text/src/prompt/template_render.rs b/crates/gateway-text/src/prompt/template_render.rs index 0c7fa083..75de15df 100644 --- a/crates/gateway-text/src/prompt/template_render.rs +++ b/crates/gateway-text/src/prompt/template_render.rs @@ -5,7 +5,7 @@ use super::{ ChatInput, Effort, Json, Message, Part, Plain, Role, chat_tool, pinned, render_native, }; -use crate::env_settings::{keep_empty_turns, reference_render}; +use super::env_settings::{keep_empty_turns, reference_render}; /// The typed counterpart of [`without_empty_assistant_turns`]. pub(super) fn without_empty_turns<'a>(messages: &[Message<'a>]) -> Vec> { diff --git a/crates/gguf/tests/synthetic/hostile_input_and_tensor_layout.rs b/crates/gguf/tests/synthetic/hostile_input_and_tensor_layout.rs index c4d7838b..dc552028 100644 --- a/crates/gguf/tests/synthetic/hostile_input_and_tensor_layout.rs +++ b/crates/gguf/tests/synthetic/hostile_input_and_tensor_layout.rs @@ -1,6 +1,5 @@ //! Hostile counts and lengths, duplicates, bad shapes and tensors out of range. -#[allow(unused_imports)] use super::*; fn assert_huge_tensor_count_is_limited() { diff --git a/crates/gguf/tests/synthetic/limits_and_inventory.rs b/crates/gguf/tests/synthetic/limits_and_inventory.rs index d4967929..e83aa8d5 100644 --- a/crates/gguf/tests/synthetic/limits_and_inventory.rs +++ b/crates/gguf/tests/synthetic/limits_and_inventory.rs @@ -1,6 +1,5 @@ //! Custom alignment, enforced limits and the tensor inventory. -#[allow(unused_imports)] use super::*; #[test] diff --git a/crates/gguf/tests/synthetic/metadata_and_headers.rs b/crates/gguf/tests/synthetic/metadata_and_headers.rs index d7d52bba..47a9b645 100644 --- a/crates/gguf/tests/synthetic/metadata_and_headers.rs +++ b/crates/gguf/tests/synthetic/metadata_and_headers.rs @@ -1,6 +1,5 @@ //! Reading metadata, tensors and geometry; truncated headers; bad magic and versions. -#[allow(unused_imports)] use super::*; #[test] diff --git a/crates/gptoss-igpu/src/prefill_pass.rs b/crates/gptoss-igpu/src/prefill_pass.rs index b54fb793..922ef7bb 100644 --- a/crates/gptoss-igpu/src/prefill_pass.rs +++ b/crates/gptoss-igpu/src/prefill_pass.rs @@ -28,11 +28,12 @@ impl GpuPrefill { pub fn prefill_part( &mut self, job: PrefillJob, - mut progress: &mut dyn FnMut(f64) -> bool, + mut progress: &mut (impl FnMut(f64) -> bool + ?Sized), ) -> Result>, ModelError> { let PrefillJob { model, cache, span, all_hidden } = job; let PrefillSpan { tokens, pos0 } = span; Self::check(model)?; + // Measurement timer, not decision logic (instant-now exception in architecture.json). let started = Instant::now(); self.timings = Timings { tokens: tokens.len(), diff --git a/crates/gptoss-igpu/src/prefill_run.rs b/crates/gptoss-igpu/src/prefill_run.rs index 16cdd473..2d88616a 100644 --- a/crates/gptoss-igpu/src/prefill_run.rs +++ b/crates/gptoss-igpu/src/prefill_run.rs @@ -123,6 +123,7 @@ impl<'a> PrefillRun<'a> { let (tx, rx) = std::sync::mpsc::sync_channel::>(0); scope.spawn(move || upload_layers(gpu, model, tx)); for l in 0..blocks { + // Measurement timer, not decision logic (instant-now exception in architecture.json). let t0 = Instant::now(); let lw = next_layer(&rx)?; self.load_prefix(cache, l)?; diff --git a/crates/gptoss-npu/src/client.rs b/crates/gptoss-npu/src/client.rs index c765fec1..9b4f8af5 100644 --- a/crates/gptoss-npu/src/client.rs +++ b/crates/gptoss-npu/src/client.rs @@ -116,7 +116,7 @@ fn openvino_dirs(root: &Path) -> (PathBuf, PathBuf) { /// The `PATH` for the service: the OpenVINO folders in front of the current one. fn search_path(folders: [PathBuf; 2]) -> Result { - let current = std::env::var_os("PATH").unwrap_or_default(); + let current = crate::settings::search_path(); std::env::join_paths(folders.into_iter().chain(std::env::split_paths(¤t))).map_err(|e| e.to_string()) } diff --git a/crates/gptoss-npu/src/expert_pass.rs b/crates/gptoss-npu/src/expert_pass.rs index 7bef70f6..92381efd 100644 --- a/crates/gptoss-npu/src/expert_pass.rs +++ b/crates/gptoss-npu/src/expert_pass.rs @@ -97,6 +97,7 @@ impl NpuPrefill { let (dispatch, view, layer) = (&ctx.dispatch, &ctx.view, ctx.l); let (e, ff) = (ctx.c.n_embd, ctx.c.n_ff); let layout = self.client.layout; + // Measurement timer, not decision logic (instant-now exception in architecture.json). let t0 = Instant::now(); let plan = ExpertPlan::new(per_expert, m); self.put_gathered(&plan, h2f, e)?; diff --git a/crates/gptoss-npu/src/lib.rs b/crates/gptoss-npu/src/lib.rs index f9017c53..29dafb3a 100644 --- a/crates/gptoss-npu/src/lib.rs +++ b/crates/gptoss-npu/src/lib.rs @@ -13,6 +13,7 @@ pub mod client; mod half; mod par; +mod settings; use client::{Client, ProductRegions, Layout, Region, ServiceConfig, Spec, ServiceTensor}; use leleka_cpu_kernels::Dispatch; diff --git a/crates/gptoss-npu/src/prefill_batch.rs b/crates/gptoss-npu/src/prefill_batch.rs index a88499e5..1ed742c1 100644 --- a/crates/gptoss-npu/src/prefill_batch.rs +++ b/crates/gptoss-npu/src/prefill_batch.rs @@ -42,6 +42,7 @@ impl NpuPrefill { // --- experts --- let moe = self.experts(ctx, &per_expert, &h2f, span.1)?; + // Measurement timer, not decision logic (instant-now exception in architecture.json). let t5 = Instant::now(); par::for_chunks(&mut xs[span.0 * e..(span.0 + span.1) * e], e, |t, row| { for (x, d) in row.iter_mut().zip(&moe[t * e..(t + 1) * e]) { diff --git a/crates/gptoss-npu/src/prefill_part_pass.rs b/crates/gptoss-npu/src/prefill_part_pass.rs index 91947a41..c6ac442c 100644 --- a/crates/gptoss-npu/src/prefill_part_pass.rs +++ b/crates/gptoss-npu/src/prefill_part_pass.rs @@ -51,10 +51,11 @@ impl NpuPrefill { pub fn prefill_part( &mut self, job: PrefillJob, - progress: &mut dyn FnMut(f64) -> bool, + progress: &mut (impl FnMut(f64) -> bool + ?Sized), ) -> Result>, ModelError> { let PrefillJob { model, cache, span, all_hidden } = job; let PrefillSpan { tokens, pos0 } = span; + // Measurement timer, not decision logic (instant-now exception in architecture.json). let started = Instant::now(); self.timings = Timings::starting(tokens.len()); let c = &model.config; diff --git a/crates/gptoss-npu/src/service_transfers.rs b/crates/gptoss-npu/src/service_transfers.rs index a57cd17a..40f7863b 100644 --- a/crates/gptoss-npu/src/service_transfers.rs +++ b/crates/gptoss-npu/src/service_transfers.rs @@ -36,6 +36,7 @@ impl NpuPrefill { io: ProductRegions, ) -> Result<(), ModelError> { let ProductRegions { input, out } = io; + // Measurement timer, not decision logic (instant-now exception in architecture.json). let started = Instant::now(); let shifts = self.client.product(tensor, rows, n, io).map_err(fail)?; match shifts { diff --git a/crates/gptoss-npu/src/settings.rs b/crates/gptoss-npu/src/settings.rs new file mode 100644 index 00000000..b3fbcb94 --- /dev/null +++ b/crates/gptoss-npu/src/settings.rs @@ -0,0 +1,8 @@ +//! The only place of this crate that reads the process environment. + +use std::ffi::OsString; + +/// The `PATH` of this process (empty when unset), to which the service's OpenVINO folders are prepended. +pub(crate) fn search_path() -> OsString { + std::env::var_os("PATH").unwrap_or_default() +} diff --git a/crates/gptoss/src/config.rs b/crates/gptoss/src/config.rs index 9a6aa54e..9d5bb716 100644 --- a/crates/gptoss/src/config.rs +++ b/crates/gptoss/src/config.rs @@ -23,11 +23,7 @@ pub struct Config { /// EXPERIMENTAL and lossy: `LELEKA_EXPERIMENTAL_EXPERTS_USED=N` routes every token to N experts instead of the /// model's own count (fewer expert bytes per decoded token). Off unless set; not covered by any quality gate. pub(super) fn experimental_experts_used(model_value: usize) -> usize { - let Some(n) = crate::settings::var("LELEKA_EXPERIMENTAL_EXPERTS_USED") - .ok() - .and_then(|v| v.parse::().ok()) - .filter(|n| (1..model_value).contains(n)) - else { + let Some(n) = crate::settings::experts_used().filter(|n| (1..model_value).contains(n)) else { return model_value; }; eprintln!("leleka-gptoss: EXPERIMENTAL lossy mode: {n} experts per token instead of {model_value}"); diff --git a/crates/gptoss/src/forward_pass.rs b/crates/gptoss/src/forward_pass.rs index 99d62458..fafcbb6c 100644 --- a/crates/gptoss/src/forward_pass.rs +++ b/crates/gptoss/src/forward_pass.rs @@ -16,6 +16,7 @@ impl Pass { /// Time since the previous lap; starts the next one. pub(super) fn lap(&mut self) -> std::time::Duration { let elapsed = self.lap_start.elapsed(); + // Measurement timer, not decision logic (instant-now exception in architecture.json). self.lap_start = std::time::Instant::now(); elapsed } diff --git a/crates/gptoss/src/generation.rs b/crates/gptoss/src/generation.rs index 9f137fc9..9438c1a1 100644 --- a/crates/gptoss/src/generation.rs +++ b/crates/gptoss/src/generation.rs @@ -16,6 +16,7 @@ impl Model { let Some(last) = xs.last().filter(|_| want_logits) else { return Ok(None); }; + // Measurement timer, not decision logic (instant-now exception in architecture.json). let started = std::time::Instant::now(); let next = self.next_from_hidden(state, last)?; state.profile.lm_head += started.elapsed(); diff --git a/crates/gptoss/src/prefill.rs b/crates/gptoss/src/prefill.rs index ae9cccb3..1413238a 100644 --- a/crates/gptoss/src/prefill.rs +++ b/crates/gptoss/src/prefill.rs @@ -50,7 +50,7 @@ impl Model { &self, state: &mut State, prompt: &[u32], - progress: &mut dyn FnMut(usize, usize) -> bool, + progress: &mut (impl FnMut(usize, usize) -> bool + ?Sized), ) -> Result, ModelError> { let reused = Self::reusable_prefix(state, prompt)?; state.truncate(reused); @@ -81,7 +81,7 @@ impl Model { state: &mut State, prompt: &[u32], accelerate: PrefillOffload, - progress: &mut dyn FnMut(usize, usize) -> bool, + progress: &mut (impl FnMut(usize, usize) -> bool + ?Sized), ) -> Result, ModelError> { let PrefillOffload { accelerator, min_tokens } = accelerate; let reused = Self::reusable_prefix(state, prompt)?; diff --git a/crates/gptoss/src/quant_probes.rs b/crates/gptoss/src/quant_probes.rs index 9da76d62..1be425c9 100644 --- a/crates/gptoss/src/quant_probes.rs +++ b/crates/gptoss/src/quant_probes.rs @@ -9,10 +9,7 @@ pub(super) fn fake_bits_for(name: &str) -> Option { if !(name.contains("attn_") || name == "output.weight") { return None; } - crate::settings::var("LELEKA_EXPERIMENTAL_FAKE_BITS") - .ok() - .and_then(|v| v.parse::().ok()) - .filter(|b| (2..8).contains(b)) + crate::settings::fake_bits().filter(|b| (2..8).contains(b)) } pub(super) fn fake_quantize_q8_0(bytes: &[u8], bits: u32) -> Vec { @@ -43,16 +40,13 @@ pub(super) fn fake_quantize_q8_0(bytes: &[u8], bits: u32) -> Vec { /// KAR format would cost in quality. Storing in Q8_0 adds at most half an 8-bit step per block. Gives no speed-up. pub(super) fn kar_levels_for(name: &str) -> Option { // `LELEKA_EXPERIMENTAL_KAR_TENSORS=a,b`: only the tensors whose name contains one of these (default: all of them) - let selected = crate::settings::var("LELEKA_EXPERIMENTAL_KAR_TENSORS").map_or(true, |list| { + let selected = crate::settings::kar_tensor_fragments().map_or(true, |list| { list.split(',').any(|part| !part.is_empty() && name.contains(part)) }); if !(name.contains("attn_") || name == "output.weight") || !selected { return None; } - crate::settings::var("LELEKA_EXPERIMENTAL_KAR_LEVELS") - .ok() - .and_then(|v| v.parse::().ok()) - .filter(|l| (1..=8).contains(l)) + crate::settings::kar_levels().filter(|l| (1..=8).contains(l)) } /// Groups of 32 sampled evenly across a tensor to fit its codebook (65,536 values, as the KAR preparer uses). @@ -74,20 +68,11 @@ pub(super) fn kar_expert_levels_for(name: &str) -> Option { if !name.contains("_exps.weight") { return None; } - let (first, last) = crate::settings::var("LELEKA_EXPERIMENTAL_KAR_EXPERT_LAYERS") - .ok() - .and_then(|r| { - let (a, b) = r.split_once('-')?; - Some((a.trim().parse().ok()?, b.trim().parse().ok()?)) - }) - .unwrap_or((0, usize::MAX)); + let (first, last) = crate::settings::kar_expert_layers().unwrap_or((0, usize::MAX)); if !(first..=last).contains(&layer) { return None; } - crate::settings::var("LELEKA_EXPERIMENTAL_KAR_EXPERT_LEVELS") - .ok() - .and_then(|v| v.parse::().ok()) - .filter(|l| (0..=8).contains(l)) + crate::settings::kar_expert_levels().filter(|l| (0..=8).contains(l)) } pub(super) fn kar_roundtrip_mxfp4(bytes: &[u8], levels: u8, name: &str) -> Result, ModelError> { diff --git a/crates/gptoss/src/settings.rs b/crates/gptoss/src/settings.rs index 24f8d322..b9ef55a7 100644 --- a/crates/gptoss/src/settings.rs +++ b/crates/gptoss/src/settings.rs @@ -1,11 +1,34 @@ -//! The only place of this crate that reads the process environment (`env-read` ratchet of `architecture.json`). -//! The reads keep their call sites and their parsing; a later step replaces these functions by a parsed settings value. +//! The only place of this crate that reads the process environment: the operator's EXPERIMENTAL lossy probes, as typed +//! values (none is set in production; none is covered by a quality gate). -use std::env::{self, VarError}; -use std::ffi::OsStr; +/// `LELEKA_EXPERIMENTAL_EXPERTS_USED=N`: route every token to N experts, as written (unchecked). +pub(crate) fn experts_used() -> Option { + std::env::var("LELEKA_EXPERIMENTAL_EXPERTS_USED").ok().and_then(|v| v.parse::().ok()) +} -/// `std::env::var`: the text of an environment variable. -#[inline] -pub(crate) fn var>(key: K) -> Result { - env::var(key) +/// `LELEKA_EXPERIMENTAL_FAKE_BITS=N`: fake-quantize the attention and output tensors to N bits, as written. +pub(crate) fn fake_bits() -> Option { + std::env::var("LELEKA_EXPERIMENTAL_FAKE_BITS").ok().and_then(|v| v.parse::().ok()) +} + +/// `LELEKA_EXPERIMENTAL_KAR_TENSORS=a,b`: the name fragments of the tensors the KAR probe touches. +pub(crate) fn kar_tensor_fragments() -> Option { + std::env::var("LELEKA_EXPERIMENTAL_KAR_TENSORS").ok() +} + +/// `LELEKA_EXPERIMENTAL_KAR_LEVELS=N`: the KAR probe's levels for the attention and output tensors, as written. +pub(crate) fn kar_levels() -> Option { + std::env::var("LELEKA_EXPERIMENTAL_KAR_LEVELS").ok().and_then(|v| v.parse::().ok()) +} + +/// `LELEKA_EXPERIMENTAL_KAR_EXPERT_LAYERS=first-last`: the layers whose experts the KAR probe touches. +pub(crate) fn kar_expert_layers() -> Option<(usize, usize)> { + let text = std::env::var("LELEKA_EXPERIMENTAL_KAR_EXPERT_LAYERS").ok()?; + let (first, last) = text.split_once('-')?; + Some((first.trim().parse().ok()?, last.trim().parse().ok()?)) +} + +/// `LELEKA_EXPERIMENTAL_KAR_EXPERT_LEVELS=N`: the KAR probe's levels for the expert tensors, as written. +pub(crate) fn kar_expert_levels() -> Option { + std::env::var("LELEKA_EXPERIMENTAL_KAR_EXPERT_LEVELS").ok().and_then(|v| v.parse::().ok()) } diff --git a/crates/gptoss/tests/synthetic_model/decoder_and_prefill.rs b/crates/gptoss/tests/synthetic_model/decoder_and_prefill.rs index 1e171b4b..ac0ce36c 100644 --- a/crates/gptoss/tests/synthetic_model/decoder_and_prefill.rs +++ b/crates/gptoss/tests/synthetic_model/decoder_and_prefill.rs @@ -1,7 +1,6 @@ //! The decoder against the f64 reference, every instruction-set level, the sliding window, overflow, and chunked //! prefill. -#[allow(unused_imports)] use super::*; #[test] diff --git a/crates/gptoss/tests/synthetic_model/decoder_runs.rs b/crates/gptoss/tests/synthetic_model/decoder_runs.rs index e1c37e23..d93a9dbe 100644 --- a/crates/gptoss/tests/synthetic_model/decoder_runs.rs +++ b/crates/gptoss/tests/synthetic_model/decoder_runs.rs @@ -1,6 +1,5 @@ //! Running the decoder under test and the argmax of reference logits. -#[allow(unused_imports)] use super::*; // ------------------------------------------------------------------------------------ tests ---- diff --git a/crates/gptoss/tests/synthetic_model/gguf_builder.rs b/crates/gptoss/tests/synthetic_model/gguf_builder.rs index 81b30268..2d049121 100644 --- a/crates/gptoss/tests/synthetic_model/gguf_builder.rs +++ b/crates/gptoss/tests/synthetic_model/gguf_builder.rs @@ -1,6 +1,5 @@ //! The LCG generator and the writer of the synthetic GGUF file. -#[allow(unused_imports)] use super::*; impl Lcg { diff --git a/crates/gptoss/tests/synthetic_model/prefix_copy.rs b/crates/gptoss/tests/synthetic_model/prefix_copy.rs index 212685b3..07a9bdbc 100644 --- a/crates/gptoss/tests/synthetic_model/prefix_copy.rs +++ b/crates/gptoss/tests/synthetic_model/prefix_copy.rs @@ -1,6 +1,5 @@ //! A copied prefix continues bit-identically and leaves its source alone. -#[allow(unused_imports)] use super::*; fn logit_bits(s: &State) -> Vec { diff --git a/crates/gptoss/tests/synthetic_model/prefix_reuse_and_generation.rs b/crates/gptoss/tests/synthetic_model/prefix_reuse_and_generation.rs index fa00c75d..c604c534 100644 --- a/crates/gptoss/tests/synthetic_model/prefix_reuse_and_generation.rs +++ b/crates/gptoss/tests/synthetic_model/prefix_reuse_and_generation.rs @@ -1,6 +1,5 @@ //! Prefix reuse, greedy generation, per-position logits, and batches wider than one kernel call. -#[allow(unused_imports)] use super::*; fn logit_bits(s: &State) -> Vec { diff --git a/crates/gptoss/tests/synthetic_model/reference_forward.rs b/crates/gptoss/tests/synthetic_model/reference_forward.rs index 6ab7598a..81406825 100644 --- a/crates/gptoss/tests/synthetic_model/reference_forward.rs +++ b/crates/gptoss/tests/synthetic_model/reference_forward.rs @@ -1,6 +1,5 @@ //! The independent f64 reference forward pass (quantization, matrix product, norm, RoPE). -#[allow(unused_imports)] use super::*; /// YaRN rotation of one head at `pos`, written from the definition with no recurrence. diff --git a/crates/gptoss/tests/synthetic_model/synthetic_world.rs b/crates/gptoss/tests/synthetic_model/synthetic_world.rs index fcbef38e..4ba68f5d 100644 --- a/crates/gptoss/tests/synthetic_model/synthetic_world.rs +++ b/crates/gptoss/tests/synthetic_model/synthetic_world.rs @@ -1,6 +1,5 @@ //! The synthetic model: its tensors, quantized weights and reference layers. -#[allow(unused_imports)] use super::*; /// The norm weights: one around 1. diff --git a/crates/gptoss/tests/synthetic_model/world_types.rs b/crates/gptoss/tests/synthetic_model/world_types.rs index b05b88ce..ea4238c0 100644 --- a/crates/gptoss/tests/synthetic_model/world_types.rs +++ b/crates/gptoss/tests/synthetic_model/world_types.rs @@ -1,7 +1,5 @@ //! The dimensions and the plain types of the synthetic model. -#[allow(unused_imports)] -use super::*; pub(super) struct Lcg(pub(super) u64); diff --git a/crates/gpu-npu-worker/src/lib.rs b/crates/gpu-npu-worker/src/lib.rs index 1b0f086d..0c95f78e 100644 --- a/crates/gpu-npu-worker/src/lib.rs +++ b/crates/gpu-npu-worker/src/lib.rs @@ -126,6 +126,7 @@ impl LayerCache for SecondPart<'_> { self.cache.capacity() } fn prefix(&self, layer: usize, to: usize) -> Result<(Vec, Vec), ModelError> { + // Measurement timer, not decision logic (instant-now exception in architecture.json). let started = Instant::now(); self.handoff.wait_for(layer)?; self.waited_ns @@ -221,7 +222,7 @@ impl GpuNpuPrefill { fn run( &mut self, job: PrefillJob, - mut progress: &mut dyn FnMut(f64) -> bool, + mut progress: &mut (impl FnMut(f64) -> bool + ?Sized), ) -> Result>, ModelError> { let PrefillJob { model, cache, span, all_hidden } = job; let PrefillSpan { tokens, pos0 } = span; @@ -286,6 +287,7 @@ impl GpuNpuPrefill { } mod split_run; +pub mod settings; use split_run::{SplitJob, join_hidden, run_parts}; impl PrefillAccelerator for GpuNpuPrefill { @@ -298,7 +300,7 @@ impl PrefillAccelerator for GpuNpuPrefill { ) -> Result>, ModelError> { let job = PrefillJob { model, cache: state, span, all_hidden: false }; let out = self.run(job, progress); - if std::env::var_os("LELEKA_SPLIT_LOG").is_some() { + if settings::split_log_enabled() { eprintln!("leleka-gpu-npu: {}", self.timings.report()); } out diff --git a/crates/gpu-npu-worker/src/main.rs b/crates/gpu-npu-worker/src/main.rs index 198a6dd2..c384445c 100644 --- a/crates/gpu-npu-worker/src/main.rs +++ b/crates/gpu-npu-worker/src/main.rs @@ -93,7 +93,7 @@ impl Parsed { .map_or(0x5EED, |d| d.as_nanos() as u64), speculate: false, cache_slots: 1, - openvino_root: std::env::var_os("LELEKA_OPENVINO_ROOT").map(PathBuf::from), + openvino_root: leleka_gpu_npu_worker::settings::openvino_root(), service: None, device: "NPU".to_owned(), gpu_min_tokens: DEFAULT_GPU_MIN_TOKENS, diff --git a/crates/gpu-npu-worker/src/settings.rs b/crates/gpu-npu-worker/src/settings.rs new file mode 100644 index 00000000..0422f10f --- /dev/null +++ b/crates/gpu-npu-worker/src/settings.rs @@ -0,0 +1,13 @@ +//! The only place of this crate that reads the process environment: the operator's switches, as typed values. + +use std::path::PathBuf; + +/// `LELEKA_SPLIT_LOG` is set: print the split-prefill timing line after each pass. +pub(crate) fn split_log_enabled() -> bool { + std::env::var_os("LELEKA_SPLIT_LOG").is_some() +} + +/// `LELEKA_OPENVINO_ROOT`: the OpenVINO runtime folder, when the operator names one. +pub fn openvino_root() -> Option { + std::env::var_os("LELEKA_OPENVINO_ROOT").map(PathBuf::from) +} diff --git a/crates/gpu-npu-worker/src/split_run.rs b/crates/gpu-npu-worker/src/split_run.rs index 4f4a7170..82f9fe17 100644 --- a/crates/gpu-npu-worker/src/split_run.rs +++ b/crates/gpu-npu-worker/src/split_run.rs @@ -60,6 +60,7 @@ fn run_gpu_part( progress: &mut impl FnMut(f64) -> bool, (npu_done, stop): (&AtomicU64, &AtomicBool), ) -> PartOutcome { + // Measurement timer, not decision logic (instant-now exception in architecture.json). let t = Instant::now(); let part = PrefillJob { model: job.model, diff --git a/crates/harmony/src/render.rs b/crates/harmony/src/render.rs index 5713d605..1ea21f1c 100644 --- a/crates/harmony/src/render.rs +++ b/crates/harmony/src/render.rs @@ -53,8 +53,6 @@ struct Out { } mod render_options; -#[allow(unused_imports)] pub use render_options::*; mod render_namespace; -#[allow(unused_imports)] pub use render_namespace::*; diff --git a/crates/igpu/src/device.rs b/crates/igpu/src/device.rs index 00b5a08c..44b37e2c 100644 --- a/crates/igpu/src/device.rs +++ b/crates/igpu/src/device.rs @@ -47,13 +47,7 @@ pub(super) const STORAGE: wgpu::BufferUsages = wgpu::BufferUsages::STORAGE /// Experiment hook: `LELEKA_IGPU_MOE_TILE=TMxTN` sets the expert kernel's tile, else it is `tm` x `tn`. fn moe_tile_from_env(tm: u32, tn: u32) -> (u32, u32) { - std::env::var("LELEKA_IGPU_MOE_TILE") - .ok() - .and_then(|s| { - let (a, b) = s.split_once('x')?; - Some((a.parse().ok()?, b.parse().ok()?)) - }) - .unwrap_or((tm, tn)) + crate::settings::moe_tile().unwrap_or((tm, tn)) } /// The stand-in binding for a product without bias. diff --git a/crates/igpu/src/lib.rs b/crates/igpu/src/lib.rs index 374f33bf..912de57e 100644 --- a/crates/igpu/src/lib.rs +++ b/crates/igpu/src/lib.rs @@ -9,6 +9,7 @@ //! aligned for 32-bit access, so quants and scales go to separate word arrays (see [`shaders::gemm`]). pub mod shaders; +mod settings; use std::fmt; use wgpu::util::DeviceExt; diff --git a/crates/igpu/src/matrices_and_moe_plan.rs b/crates/igpu/src/matrices_and_moe_plan.rs index de88c279..735c85af 100644 --- a/crates/igpu/src/matrices_and_moe_plan.rs +++ b/crates/igpu/src/matrices_and_moe_plan.rs @@ -184,6 +184,7 @@ impl Gpu { rec.submit() }; run(1)?; + // Measurement timer, not decision logic (instant-now exception in architecture.json). let start = std::time::Instant::now(); run(iterations)?; Ok(start.elapsed().as_secs_f64() / iterations as f64) diff --git a/crates/igpu/src/recorder_moe.rs b/crates/igpu/src/recorder_moe.rs index 90e71c57..0f19f6ed 100644 --- a/crates/igpu/src/recorder_moe.rs +++ b/crates/igpu/src/recorder_moe.rs @@ -1,6 +1,5 @@ //! The expert matrix product and the weighted combine of expert outputs. -#[allow(unused_imports)] use super::recorder_core::product_dims; use super::{ Buf, CombineBufs, GpuActivations, GpuError, GpuMatrix, MoePlan, Operands, ProductOutput, Quad, Recorder, diff --git a/crates/igpu/src/settings.rs b/crates/igpu/src/settings.rs new file mode 100644 index 00000000..b63ca229 --- /dev/null +++ b/crates/igpu/src/settings.rs @@ -0,0 +1,8 @@ +//! The only place of this crate that reads the process environment: the operator's experiment hooks, as typed values. + +/// `LELEKA_IGPU_MOE_TILE=TMxTN`: the tile of the expert kernel; `None` when unset or malformed. +pub(crate) fn moe_tile() -> Option<(u32, u32)> { + let text = std::env::var("LELEKA_IGPU_MOE_TILE").ok()?; + let (rows, columns) = text.split_once('x')?; + Some((rows.parse().ok()?, columns.parse().ok()?)) +} diff --git a/crates/igpu/src/shaders.rs b/crates/igpu/src/shaders.rs index 3e1da441..8d46ac67 100644 --- a/crates/igpu/src/shaders.rs +++ b/crates/igpu/src/shaders.rs @@ -8,7 +8,6 @@ use crate::WeightKind; mod gemm; mod gemm_template; -#[allow(unused_imports)] pub use gemm::*; mod tiling_norm_and_rope; diff --git a/crates/leleka-memory/src/census.rs b/crates/leleka-memory/src/census.rs index 4e703d01..02cc12e0 100644 --- a/crates/leleka-memory/src/census.rs +++ b/crates/leleka-memory/src/census.rs @@ -148,22 +148,33 @@ fn drift_of(name: &'static str, values: &[f64], tolerance: u64) -> Option }) } +/// The drift of one measured quantity (`get` reads it from a census) over the post-warm-up samples. +fn series_drift( + tail: &[Census], + name: &'static str, + get: impl Fn(&Census) -> Option, + tolerance: u64, +) -> Option { + let values: Vec = tail.iter().filter_map(get).collect(); + drift_of(name, &values, tolerance) +} + /// Judge a series of censuses taken between requests. Fewer than 8 post-warm-up samples is not a judgement: not ok. pub fn check_flat(series: &[Census], warmup: usize, tol: &Tolerances) -> FlatReport { let tail = series.get(warmup..).unwrap_or(&[]); - let mut drifts = Vec::new(); - let mut add = |name: &'static str, get: &dyn Fn(&Census) -> Option, tolerance: u64| { - let values: Vec = tail.iter().filter_map(get).collect(); - drifts.extend(drift_of(name, &values, tolerance)); - }; - add("rss", &|c| Some(c.rss as f64), tol.rss); - add("swap", &|c| Some(c.swap as f64), tol.swap); - add("pinned", &|c| Some(c.pinned as f64), tol.pinned); - add("locked", &|c| Some(c.locked as f64), tol.locked); - add("threads", &|c| Some(c.threads as f64), tol.threads); - add("fds", &|c| Some(c.fds as f64), tol.fds); - add("device", &|c| c.device_used.map(|v| v as f64), tol.device); - add("device_acct", &|c| c.device_accounted.map(|v| v as f64), tol.device); + let drifts: Vec = [ + series_drift(tail, "rss", |c| Some(c.rss as f64), tol.rss), + series_drift(tail, "swap", |c| Some(c.swap as f64), tol.swap), + series_drift(tail, "pinned", |c| Some(c.pinned as f64), tol.pinned), + series_drift(tail, "locked", |c| Some(c.locked as f64), tol.locked), + series_drift(tail, "threads", |c| Some(c.threads as f64), tol.threads), + series_drift(tail, "fds", |c| Some(c.fds as f64), tol.fds), + series_drift(tail, "device", |c| c.device_used.map(|v| v as f64), tol.device), + series_drift(tail, "device_acct", |c| c.device_accounted.map(|v| v as f64), tol.device), + ] + .into_iter() + .flatten() + .collect(); let ok = drifts.iter().all(|d| d.ok); FlatReport { samples: series.len(), warmup, drifts, ok } } diff --git a/crates/leleka-memory/src/governor.rs b/crates/leleka-memory/src/governor.rs index e5ac21e2..e8584a3e 100644 --- a/crates/leleka-memory/src/governor.rs +++ b/crates/leleka-memory/src/governor.rs @@ -195,11 +195,6 @@ mod pressure_tests; mod tests; mod governor_config; -#[allow(unused_imports)] pub use governor_config::*; mod operations; -#[allow(unused_imports)] -pub use operations::*; mod sampler_guard; -#[allow(unused_imports)] -pub use sampler_guard::*; diff --git a/crates/leleka-memory/src/governor/governor_config.rs b/crates/leleka-memory/src/governor/governor_config.rs index fc5cf580..942eac5c 100644 --- a/crates/leleka-memory/src/governor/governor_config.rs +++ b/crates/leleka-memory/src/governor/governor_config.rs @@ -124,7 +124,11 @@ impl GovernorConfig { /// Defaults for the host, then the `LELEKA_MEMORY_*` overrides. An unparsable override is an error naming the /// variable (a typo must not silently keep the default of a safety setting). - pub fn from_env(mem_total: u64, laptop: bool, env: &dyn Fn(&str) -> Option) -> Result { + pub fn from_env( + mem_total: u64, + laptop: bool, + env: &(impl Fn(&str) -> Option + ?Sized), + ) -> Result { let mut cfg = Self::new(Policy::for_host(mem_total, laptop)); cfg.policy.apply_env_floors(env)?; cfg.policy.apply_env_psi(env)?; diff --git a/crates/leleka-memory/src/governor/operations/admission.rs b/crates/leleka-memory/src/governor/operations/admission.rs index a74cc444..0e099206 100644 --- a/crates/leleka-memory/src/governor/operations/admission.rs +++ b/crates/leleka-memory/src/governor/operations/admission.rs @@ -3,7 +3,7 @@ //! A file of its own: the per-request half of the governor, apart from its setup and its report. use super::{ - Admission, Governor, HostFacts, Level, LockReport, NONE, OnceLock, Ordering, ProcSource, Refusal, Refuse, + Admission, Governor, HostFacts, Level, LockReport, NONE, Ordering, ProcSource, Refusal, Refuse, RequestShape, ShedDirective, WORKING_SET_TRIM_EVERY, gib, lock, }; @@ -84,11 +84,7 @@ impl Governor { /// A/B inside one engine (bring-up): no trim while the file named by LELEKA_NO_TRIM_FILE exists. fn trim_disabled() -> bool { - static NO_TRIM_FILE: OnceLock> = OnceLock::new(); - NO_TRIM_FILE - .get_or_init(|| std::env::var_os("LELEKA_NO_TRIM_FILE").map(std::path::PathBuf::from)) - .as_ref() - .is_some_and(|f| f.exists()) + crate::settings::no_trim_file().is_some_and(|f| f.exists()) } pub(in super::super) fn relieve_working_set_below(&self, facts: HostFacts, threshold: u64) -> HostFacts { diff --git a/crates/leleka-memory/src/ledger.rs b/crates/leleka-memory/src/ledger.rs index 1ad21f57..e7fc3469 100644 --- a/crates/leleka-memory/src/ledger.rs +++ b/crates/leleka-memory/src/ledger.rs @@ -88,10 +88,10 @@ impl Ledger { pub fn with_clock(clock: AnyClock) -> Self { Self { stages: Mutex::default(), clock } } - pub fn begin(&self, name: &str, src: &dyn ProcSource, device: Option) -> OpenStage { + pub fn begin(&self, name: &str, src: &(impl ProcSource + ?Sized), device: Option) -> OpenStage { OpenStage { name: name.to_owned(), started: self.clock.now(), host: HostSample::take(src), device } } - pub fn end(&self, open: OpenStage, src: &dyn ProcSource, device: Option) -> Stage { + pub fn end(&self, open: OpenStage, src: &(impl ProcSource + ?Sized), device: Option) -> Stage { let after = HostSample::take(src); let stage = Stage { name: open.name, diff --git a/crates/leleka-memory/src/lib.rs b/crates/leleka-memory/src/lib.rs index cd533954..aee3a427 100644 --- a/crates/leleka-memory/src/lib.rs +++ b/crates/leleka-memory/src/lib.rs @@ -16,6 +16,7 @@ pub mod plan; pub mod pressure; pub mod pressure_port; pub mod procfs; +mod settings; pub mod smi; pub mod telemetry; pub mod winproc; diff --git a/crates/leleka-memory/src/lock.rs b/crates/leleka-memory/src/lock.rs index 63039d5b..5d469261 100644 --- a/crates/leleka-memory/src/lock.rs +++ b/crates/leleka-memory/src/lock.rs @@ -91,5 +91,4 @@ mod page_locking; mod tests; mod lock_mode; -#[allow(unused_imports)] pub use lock_mode::*; diff --git a/crates/leleka-memory/src/plan.rs b/crates/leleka-memory/src/plan.rs index 6e24e179..23bb3d1d 100644 --- a/crates/leleka-memory/src/plan.rs +++ b/crates/leleka-memory/src/plan.rs @@ -155,8 +155,6 @@ pub struct Refusal { mod tests; mod policy; -#[allow(unused_imports)] pub use policy::*; mod auto_prefix_budget; -#[allow(unused_imports)] pub use auto_prefix_budget::*; diff --git a/crates/leleka-memory/src/settings.rs b/crates/leleka-memory/src/settings.rs new file mode 100644 index 00000000..239c29e6 --- /dev/null +++ b/crates/leleka-memory/src/settings.rs @@ -0,0 +1,16 @@ +//! The only place of this crate that reads the process environment: the operator's switches, as typed values. + +use std::ffi::OsString; +use std::path::PathBuf; +use std::sync::OnceLock; + +/// `LELEKA_NO_TRIM_FILE`: bring-up A/B inside one engine; no working-set trim while this file exists. Read once. +pub(crate) fn no_trim_file() -> Option<&'static PathBuf> { + static NO_TRIM_FILE: OnceLock> = OnceLock::new(); + NO_TRIM_FILE.get_or_init(|| std::env::var_os("LELEKA_NO_TRIM_FILE").map(PathBuf::from)).as_ref() +} + +/// The `PATH` of this process, when it is set (where `nvidia-smi` is looked for). +pub(crate) fn search_path() -> Option { + std::env::var_os("PATH") +} diff --git a/crates/leleka-memory/src/smi.rs b/crates/leleka-memory/src/smi.rs index e85407bc..3a60918a 100644 --- a/crates/leleka-memory/src/smi.rs +++ b/crates/leleka-memory/src/smi.rs @@ -72,7 +72,7 @@ pub fn parse_csv(text: &str, index: u32) -> Option { /// The first existing `nvidia-smi` in `PATH`, then in [`EXTRA_LOCATIONS`]. pub fn find_binary() -> Option { - let from_path = std::env::var_os("PATH").and_then(|paths| { + let from_path = crate::settings::search_path().and_then(|paths| { std::env::split_paths(&paths).map(|dir| dir.join("nvidia-smi")).find(|candidate| candidate.is_file()) }); from_path.or_else(|| EXTRA_LOCATIONS.iter().map(std::path::PathBuf::from).find(|candidate| candidate.is_file())) @@ -97,7 +97,7 @@ fn spawn_query(binary: &std::path::Path, index: u32) -> Option Option { let mut child = spawn_query(binary, index)?; let mut stdout = child.stdout.take()?; - let started = Instant::now(); + let started = SystemClock.now(); loop { match child.try_wait() { Ok(Some(status)) => { diff --git a/crates/leleka-memory/src/telemetry.rs b/crates/leleka-memory/src/telemetry.rs index c8b617eb..fa1a9220 100644 --- a/crates/leleka-memory/src/telemetry.rs +++ b/crates/leleka-memory/src/telemetry.rs @@ -272,8 +272,6 @@ pub struct Sampler { mod tests; mod lock; -#[allow(unused_imports)] pub use lock::*; mod render; -#[allow(unused_imports)] pub use render::*; diff --git a/crates/leleka-memory/src/telemetry/lock.rs b/crates/leleka-memory/src/telemetry/lock.rs index e9f1f6a2..a8ee46b1 100644 --- a/crates/leleka-memory/src/telemetry/lock.rs +++ b/crates/leleka-memory/src/telemetry/lock.rs @@ -244,7 +244,7 @@ pub fn parse_stat_cpu(text: &str) -> Option<(u64, u64)> { Some((total.saturating_sub(idle), total)) } -pub fn read_cpu(src: &dyn ProcSource) -> Option { +pub fn read_cpu(src: &(impl ProcSource + ?Sized)) -> Option { let process_ticks = parse_self_stat_ticks(&src.read("/proc/self/stat").ok()?)?; let (system_busy, system_total) = parse_stat_cpu(&src.read("/proc/stat").ok()?)?; Some(CpuReading { process_ticks, system_busy, system_total }) diff --git a/crates/model-format/src/bulk_read.rs b/crates/model-format/src/bulk_read.rs index 31ad6807..0d088940 100644 --- a/crates/model-format/src/bulk_read.rs +++ b/crates/model-format/src/bulk_read.rs @@ -88,8 +88,6 @@ struct Shared<'a, F> { mod tests; mod strategy; -#[allow(unused_imports)] pub use strategy::*; mod for_each_chunk; -#[allow(unused_imports)] pub use for_each_chunk::*; diff --git a/crates/model-format/src/bulk_read/for_each_chunk.rs b/crates/model-format/src/bulk_read/for_each_chunk.rs index 68a62388..56ec82ee 100644 --- a/crates/model-format/src/bulk_read/for_each_chunk.rs +++ b/crates/model-format/src/bulk_read/for_each_chunk.rs @@ -14,6 +14,7 @@ pub fn for_each_chunk(file: &File, start: u64, len: u64, plan: Plan, sink: F) where F: Fn(u64, &[u8]) -> io::Result<()> + Sync, { + // Measurement timer, not decision logic (instant-now exception in architecture.json). let began = Instant::now(); let file_len = span_file_len(file, start, len)?; let chunk = (plan.chunk.max(ALIGN) / ALIGN * ALIGN) as u64; diff --git a/crates/model-format/src/bulk_read/strategy.rs b/crates/model-format/src/bulk_read/strategy.rs index 793f0764..cf5f0f47 100644 --- a/crates/model-format/src/bulk_read/strategy.rs +++ b/crates/model-format/src/bulk_read/strategy.rs @@ -18,7 +18,7 @@ impl Plan { /// `LELEKA_LOAD_CHUNK_MIB=N`, `LELEKA_LOAD_AHEAD_MIB=N`): the switches that let one binary be measured in each /// form. pub fn from_env() -> Plan { - Plan::with_overrides(Plan::default(), |name| crate::settings::var(name).ok()) + Plan::with_overrides(Plan::default(), crate::settings::load_variable) } pub fn with_overrides(mut plan: Plan, var: impl Fn(&str) -> Option) -> Plan { diff --git a/crates/model-format/src/gguf.rs b/crates/model-format/src/gguf.rs index 151a6bec..2e6bb604 100644 --- a/crates/model-format/src/gguf.rs +++ b/crates/model-format/src/gguf.rs @@ -163,51 +163,35 @@ pub(crate) struct GgufSourceFence<'source> { } #[cfg(test)] -#[path = "gguf_owned_read_test.rs"] mod owned_read_test; -#[path = "gguf_resident.rs"] mod resident; pub(crate) use resident::{ResidentLoadError, ResidentTensor}; -#[path = "gguf_digest_capture.rs"] mod digest_capture; pub(crate) use digest_capture::open_expert_capture; pub(crate) use digest_capture::open_incremental_expert_capture; -#[path = "gguf_expert_file_source.rs"] mod expert_file_source; pub use expert_file_source::ExpertFileOwner; -#[path = "gguf_native_head.rs"] mod native_head_model; pub use native_head_model::{NativeHeadGgufModel, NativeHeadTensor}; mod stream_buffer_bytes; -#[allow(unused_imports)] pub use stream_buffer_bytes::*; mod verified_gguf_file; -#[allow(unused_imports)] -pub use verified_gguf_file::*; mod parse_artifact_digest; -#[allow(unused_imports)] pub use parse_artifact_digest::*; mod read_metadata_snapshot_with_architecture; -#[allow(unused_imports)] pub use read_metadata_snapshot_with_architecture::*; mod open_regular; -#[allow(unused_imports)] pub use open_regular::*; mod index_parse; -#[allow(unused_imports)] pub use index_parse::*; mod read_index_file; -#[allow(unused_imports)] pub use read_index_file::*; mod cursor; -#[allow(unused_imports)] -pub use cursor::*; mod value_width; -#[allow(unused_imports)] pub use value_width::*; diff --git a/crates/model-format/src/gguf_digest_capture.rs b/crates/model-format/src/gguf/digest_capture.rs similarity index 98% rename from crates/model-format/src/gguf_digest_capture.rs rename to crates/model-format/src/gguf/digest_capture.rs index 28d6d6cb..1f5e693d 100644 --- a/crates/model-format/src/gguf_digest_capture.rs +++ b/crates/model-format/src/gguf/digest_capture.rs @@ -67,7 +67,6 @@ fn read_provisional_index(file: &mut File, size: u64, strict: bool) -> Result= crate::bulk_read::MIN_PARALLEL_BYTES - && crate::settings::var("LELEKA_LOAD_READ").as_deref() != Ok("legacy") + && !crate::settings::legacy_sequential_read() { crate::bulk_read::read_into(file, absolute, bytes, crate::bulk_read::Plan::from_env())?; return Ok(()); diff --git a/crates/model-format/src/gguf_resident.rs b/crates/model-format/src/gguf/resident.rs similarity index 96% rename from crates/model-format/src/gguf_resident.rs rename to crates/model-format/src/gguf/resident.rs index 26d15eac..a24989d3 100644 --- a/crates/model-format/src/gguf_resident.rs +++ b/crates/model-format/src/gguf/resident.rs @@ -43,7 +43,6 @@ pub(crate) struct FileSpan { } #[cfg(test)] -#[path = "gguf_resident_sdet.rs"] mod sdet; #[cfg(test)] @@ -189,15 +188,7 @@ mod retained_lease_test { } } -#[path = "gguf_resident/next_source_id.rs"] mod next_source_id; -#[allow(unused_imports)] pub use next_source_id::*; -#[path = "gguf_resident/verified_gguf_file.rs"] mod verified_gguf_file; -#[allow(unused_imports)] -pub use verified_gguf_file::*; -#[path = "gguf_resident/verified_gguf_capture_retention.rs"] mod verified_gguf_capture_retention; -#[allow(unused_imports)] -pub use verified_gguf_capture_retention::*; diff --git a/crates/model-format/src/gguf_resident/next_source_id.rs b/crates/model-format/src/gguf/resident/next_source_id.rs similarity index 100% rename from crates/model-format/src/gguf_resident/next_source_id.rs rename to crates/model-format/src/gguf/resident/next_source_id.rs diff --git a/crates/model-format/src/gguf_resident_sdet.rs b/crates/model-format/src/gguf/resident/sdet.rs similarity index 100% rename from crates/model-format/src/gguf_resident_sdet.rs rename to crates/model-format/src/gguf/resident/sdet.rs diff --git a/crates/model-format/src/gguf_resident/verified_gguf_capture_retention.rs b/crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs similarity index 100% rename from crates/model-format/src/gguf_resident/verified_gguf_capture_retention.rs rename to crates/model-format/src/gguf/resident/verified_gguf_capture_retention.rs diff --git a/crates/model-format/src/gguf_resident/verified_gguf_file.rs b/crates/model-format/src/gguf/resident/verified_gguf_file.rs similarity index 100% rename from crates/model-format/src/gguf_resident/verified_gguf_file.rs rename to crates/model-format/src/gguf/resident/verified_gguf_file.rs diff --git a/crates/model-format/src/gguf/tests.rs b/crates/model-format/src/gguf/tests.rs index 896beac9..31c5d997 100644 --- a/crates/model-format/src/gguf/tests.rs +++ b/crates/model-format/src/gguf/tests.rs @@ -77,11 +77,7 @@ impl Drop for OwnedFixture { } } -#[path = "tests/admits_flash_metadata_and_rejects.rs"] mod admits_flash_metadata_and_rejects; -#[path = "tests/buffered_cursor_preserves_offsets_parsin.rs"] mod buffered_cursor_preserves_offsets_parsin; -#[path = "tests/empty_owned_tensor_validation_preserves.rs"] mod empty_owned_tensor_validation_preserves; -#[path = "tests/original_first_source_fence_retains.rs"] mod original_first_source_fence_retains; diff --git a/crates/model-format/src/huge_pages.rs b/crates/model-format/src/huge_pages.rs index 9340b94c..3f0517b2 100644 --- a/crates/model-format/src/huge_pages.rs +++ b/crates/model-format/src/huge_pages.rs @@ -41,7 +41,7 @@ pub fn mode() -> Mode { if !cfg!(target_os = "linux") { return Mode::Off; } - match crate::settings::var("LELEKA_HUGEPAGES").ok().as_deref() { + match crate::settings::huge_pages_text().as_deref() { Some("on") => Mode::On, Some("thp") => Mode::Thp, Some("off") => Mode::Off, @@ -49,7 +49,7 @@ pub fn mode() -> Mode { eprintln!("leleka-hugepages: unknown LELEKA_HUGEPAGES={other:?} (on | thp | off): off"); Mode::Off } - _ if crate::settings::var("LELEKA_BANK_THP").is_ok_and(|v| v == "on") => Mode::Thp, + _ if crate::settings::bank_thp_on() => Mode::Thp, _ => Mode::Off, } }) @@ -326,6 +326,7 @@ mod linux { let mut text = line("after fill", &before); let aligned: u64 = thp_ranges().iter().map(|r| r.1 as u64).sum(); if before.thp_bytes < aligned { + // Measurement timer, not decision logic (instant-now exception in architecture.json). let t = std::time::Instant::now(); let (failed, last_error) = collapse(&thp_ranges()); let after = coverage().unwrap_or(before); diff --git a/crates/model-format/src/kar.rs b/crates/model-format/src/kar.rs index 97ae9c3e..51deaaf1 100644 --- a/crates/model-format/src/kar.rs +++ b/crates/model-format/src/kar.rs @@ -240,11 +240,9 @@ const WARM_ROW_NS: u128 = 20_000; const COLD_SKIP_CALLS: u32 = 256; static COLD_SKIP: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0); -#[path = "kar_nested.rs"] mod nested; pub use nested::{KarNestedRecord, NESTING_TOPDOWN}; -#[path = "kar_extents.rs"] mod extents; pub use extents::{ CensusRecord, EXTENT_ALIGN, Extent, KarCensus, PLE_EXTENTS_SHA256, PLE_PART_NAMES, PLE_PLANES, PLE_ROW_PLANE_BYTES, @@ -269,23 +267,15 @@ mod extents_tests; mod row_read_tests; mod inspection; -#[allow(unused_imports)] pub use inspection::*; mod decode_record_range; -#[allow(unused_imports)] pub use decode_record_range::*; mod inspect_file; -#[allow(unused_imports)] pub use inspect_file::*; mod read_region; -#[allow(unused_imports)] pub use read_region::*; mod kar_ple_profile; -#[allow(unused_imports)] pub use kar_ple_profile::*; mod verified_kar_ple_artifact; -#[allow(unused_imports)] -pub use verified_kar_ple_artifact::*; mod independent_handles; -#[allow(unused_imports)] pub use independent_handles::*; diff --git a/crates/model-format/src/kar_extents.rs b/crates/model-format/src/kar/extents.rs similarity index 96% rename from crates/model-format/src/kar_extents.rs rename to crates/model-format/src/kar/extents.rs index 3654c3a8..20698628 100644 --- a/crates/model-format/src/kar_extents.rs +++ b/crates/model-format/src/kar/extents.rs @@ -18,7 +18,6 @@ use super::{ KarError, KarInspection, KarNestedRecord, KarTensorSource, PLE_ROWS, Sha256, VerifiedPart, read_at, round_up, }; use sha2::Digest; -use std::fmt::Write as _; /// Granularity of a sparse copy: the page size of the memfd (and of `mlock`). pub const EXTENT_ALIGN: u64 = 4096; @@ -125,11 +124,6 @@ pub struct ClassTotals { pub extent_bytes: u64, } -#[path = "kar_extents/extent.rs"] mod extent; -#[allow(unused_imports)] pub use extent::*; -#[path = "kar_extents/kar_inspection.rs"] mod kar_inspection; -#[allow(unused_imports)] -pub use kar_inspection::*; diff --git a/crates/model-format/src/kar_extents/extent.rs b/crates/model-format/src/kar/extents/extent.rs similarity index 99% rename from crates/model-format/src/kar_extents/extent.rs rename to crates/model-format/src/kar/extents/extent.rs index 721e544f..cedf1b41 100644 --- a/crates/model-format/src/kar_extents/extent.rs +++ b/crates/model-format/src/kar/extents/extent.rs @@ -1,7 +1,6 @@ //! Methods of `Extent`: `new`, `end`. Methods of `VerifiedPart`: `reads`. //! Functions: `extents_bytes`, `normalize_extents`, `extents_cover`, `extents_overlap` and 5 more. -use std::fmt::Write as _; use super::{ DOMAIN, Digest, EXTENT_ALIGN, Extent, HASH_CHUNK, KarError, KarNestedRecord, PLE_ROW_PLANE_BYTES, PLE_ROW_SCALE_BYTES, ServeReads, Sha256, VerifiedPart, read_at, round_up, diff --git a/crates/model-format/src/kar_extents/kar_inspection.rs b/crates/model-format/src/kar/extents/kar_inspection.rs similarity index 100% rename from crates/model-format/src/kar_extents/kar_inspection.rs rename to crates/model-format/src/kar/extents/kar_inspection.rs diff --git a/crates/model-format/src/kar/independent_handles.rs b/crates/model-format/src/kar/independent_handles.rs index 464e66e7..01f429c3 100644 --- a/crates/model-format/src/kar/independent_handles.rs +++ b/crates/model-format/src/kar/independent_handles.rs @@ -101,6 +101,7 @@ fn read_warm( COLD_SKIP.fetch_sub(1, Ordering::Relaxed); return Ok(false); } + // Measurement timer, not decision logic (instant-now exception in architecture.json). let started = std::time::Instant::now(); read_rows_chunk(first, parts, &rows[..1], &mut packets[..1])?; if started.elapsed().as_nanos() <= WARM_ROW_NS { @@ -167,12 +168,7 @@ pub(super) fn check_archive_state( /// keep `ctime` stable, for example). Read once; the default is on. pub(super) fn identity_recheck_enabled() -> bool { static ENABLED: std::sync::OnceLock = std::sync::OnceLock::new(); - *ENABLED.get_or_init(|| { - !matches!( - crate::settings::var("LELEKA_KAR_IDENTITY_RECHECK").as_deref().map(str::trim), - Ok("off" | "0" | "no" | "false") - ) - }) + *ENABLED.get_or_init(|| !crate::settings::kar_identity_recheck_disabled()) } pub(super) fn read_rows_chunk( diff --git a/crates/model-format/src/kar_nested.rs b/crates/model-format/src/kar/nested.rs similarity index 99% rename from crates/model-format/src/kar_nested.rs rename to crates/model-format/src/kar/nested.rs index f22b3aa0..3e1e24f6 100644 --- a/crates/model-format/src/kar_nested.rs +++ b/crates/model-format/src/kar/nested.rs @@ -266,5 +266,5 @@ impl WeightSource for KarInspection { } #[cfg(test)] -#[path = "weight_source/kar_inspection_tests.rs"] +#[path = "../weight_source/kar_inspection_tests.rs"] mod weight_source_tests; diff --git a/crates/model-format/src/kar_kernel_model.rs b/crates/model-format/src/kar_kernel_model.rs index 6a755608..3b8b07ae 100644 --- a/crates/model-format/src/kar_kernel_model.rs +++ b/crates/model-format/src/kar_kernel_model.rs @@ -115,8 +115,6 @@ pub const MAX_SWIGLU_VALUES: u64 = 1 << 20; mod tests; mod window_plan; -#[allow(unused_imports)] pub use window_plan::*; mod decode_params_valid; -#[allow(unused_imports)] pub use decode_params_valid::*; diff --git a/crates/model-format/src/kar_levels.rs b/crates/model-format/src/kar_levels.rs index dc0c3058..07f06ccf 100644 --- a/crates/model-format/src/kar_levels.rs +++ b/crates/model-format/src/kar_levels.rs @@ -175,11 +175,7 @@ pub trait RangeSource { use crate::kar::KarError; mod class_levels; -#[allow(unused_imports)] -pub use class_levels::*; mod selection; -#[allow(unused_imports)] pub use selection::*; mod expert_scratch; -#[allow(unused_imports)] pub use expert_scratch::*; diff --git a/crates/model-format/src/native_dense_plan.rs b/crates/model-format/src/native_dense_plan.rs index a12317e6..c7347dc5 100644 --- a/crates/model-format/src/native_dense_plan.rs +++ b/crates/model-format/src/native_dense_plan.rs @@ -315,7 +315,7 @@ fn matrix_compatible(tensor: &TensorRow, reference: &Canonical) -> bool { /// Everything `NativeDense::load` does before its first `cudaMalloc`, in the Original's order and with its messages. pub fn plan_load( shards: &[ShardInfo], - canonical: &dyn Fn(&str) -> Option, + canonical: &(impl Fn(&str) -> Option + ?Sized), include_ple_key: bool, ) -> Result { if shards.is_empty() { diff --git a/crates/model-format/src/pinned_arena_plan.rs b/crates/model-format/src/pinned_arena_plan.rs index 93bb036a..ecec1192 100644 --- a/crates/model-format/src/pinned_arena_plan.rs +++ b/crates/model-format/src/pinned_arena_plan.rs @@ -8,8 +8,6 @@ //! trusts the caller); reads use positional I/O (`read_exact_at`) instead of one `FILE*` per thread, which has the same //! effect (no shared seek position) and reaches the disk with the requested chunk size. -use std::fmt::Write as _; - /// Seed constant exactly as written in pinned.cu (`1469598103934665603`, one digit short of the textbook FNV offset). pub const FNV_SEED: u64 = 1_469_598_103_934_665_603; const FNV_PRIME: u64 = 1_099_511_628_211; @@ -105,36 +103,19 @@ pub struct LoadStats { mod tests; mod fnv1a64; -#[allow(unused_imports)] pub use fnv1a64::arena_lock_enabled; -#[allow(unused_imports)] pub use fnv1a64::arena_pin_cap_gib; -#[allow(unused_imports)] -use fnv1a64::atoi; -#[allow(unused_imports)] pub use fnv1a64::decide_pin; -#[allow(unused_imports)] pub use fnv1a64::fnv1a64; #[cfg(unix)] -#[allow(unused_imports)] pub use fnv1a64::open_shared_arena_file; -#[allow(unused_imports)] pub use fnv1a64::pin_sliced; -#[allow(unused_imports)] pub use fnv1a64::plan_shared_file; -#[allow(unused_imports)] pub use fnv1a64::shared_mapping_note; -#[allow(unused_imports)] pub use fnv1a64::sliced_note; -#[allow(unused_imports)] pub use fnv1a64::uniform_bounds; mod expert_parallel_load; #[cfg(unix)] -#[allow(unused_imports)] pub use expert_parallel_load::load_experts; #[cfg(unix)] -#[allow(unused_imports)] pub use expert_parallel_load::load_experts_ranges; -#[cfg(unix)] -#[allow(unused_imports)] -use expert_parallel_load::read_up_to; diff --git a/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs b/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs index 2ec1b079..664a2783 100644 --- a/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs +++ b/crates/model-format/src/pinned_arena_plan/expert_parallel_load.rs @@ -1,7 +1,6 @@ //! Methods of `LoadShared`: `fill`. //! Functions: `load_experts`, `load_experts_ranges`, `load_failure`, `carve_windows` and 4 more. -use std::fmt::Write as _; use super::{ExpertLayout, FNV_SEED, LoadStats, ReadPlan, fnv1a64}; /// `load_experts`: `layers` uniform ranges of `blobs_per_layer * blob_bytes`. @@ -27,6 +26,7 @@ pub fn load_experts_ranges( let ReadPlan { threads, chunk_bytes: chunk } = plan; let mut st = LoadStats { ok: true, layers: layer_off.len() as u64, bytes: layer_bytes.iter().sum(), ..Default::default() }; + // Measurement timer, not decision logic (instant-now exception in architecture.json). let t0 = std::time::Instant::now(); if layer_off.len() != layer_bytes.len() || chunk == 0 { return load_failure(st, "layer offset and size lists differ, or the chunk is empty".into()); diff --git a/crates/model-format/src/ple_reader.rs b/crates/model-format/src/ple_reader.rs index 5d98485d..cb98e071 100644 --- a/crates/model-format/src/ple_reader.rs +++ b/crates/model-format/src/ple_reader.rs @@ -203,14 +203,7 @@ pub struct PleReader { mod tests; mod file_page_source; -#[allow(unused_imports)] pub use file_page_source::*; mod read_queue; -#[allow(unused_imports)] -pub use read_queue::*; mod row_reading; -#[allow(unused_imports)] -pub use row_reading::*; mod ple_reader_debug_drop; -#[allow(unused_imports)] -pub use ple_reader_debug_drop::*; diff --git a/crates/model-format/src/ple_reader/file_page_source.rs b/crates/model-format/src/ple_reader/file_page_source.rs index 583632e2..75edaf71 100644 --- a/crates/model-format/src/ple_reader/file_page_source.rs +++ b/crates/model-format/src/ple_reader/file_page_source.rs @@ -220,13 +220,13 @@ impl AlignedBuf { /// Whether `source` serves one page-aligned page read at the page holding /// `offset`, through a 4 KiB-aligned buffer. Used to accept an unbuffered /// (O_DIRECT) handle only once it demonstrably works on this filesystem. -pub fn probe_aligned_read(source: &dyn PageSource, offset: u64) -> bool { +pub fn probe_aligned_read(source: &(impl PageSource + ?Sized), offset: u64) -> bool { let mut buf = AlignedBuf::new(PAGE); let page = offset / PAGE as u64 * PAGE as u64; matches!(read_full_at(source, buf.window(PAGE), page), Ok(n) if n > 0) } -pub(super) fn read_full_at(source: &dyn PageSource, buf: &mut [u8], offset: u64) -> io::Result { +pub(super) fn read_full_at(source: &(impl PageSource + ?Sized), buf: &mut [u8], offset: u64) -> io::Result { let mut total = 0; while total < buf.len() { match source.read_at(&mut buf[total..], offset + total as u64) { diff --git a/crates/model-format/src/ple_reader/read_queue.rs b/crates/model-format/src/ple_reader/read_queue.rs index c4a09c49..5e66995a 100644 --- a/crates/model-format/src/ple_reader/read_queue.rs +++ b/crates/model-format/src/ple_reader/read_queue.rs @@ -171,6 +171,7 @@ impl Shared { /// Take the next job (marking it in flight) or `None` when there is none. pub(super) fn start(&self, st: &mut State) -> Option<(Job, Instant, Duration)> { let job = st.queue.pop_front()?; + // Measurement timer, not decision logic (instant-now exception in architecture.json). let now = Instant::now(); st.inflight += 1; st.keep.last_read = Some(now); diff --git a/crates/model-format/src/ple_reader/row_reading.rs b/crates/model-format/src/ple_reader/row_reading.rs index e1bc037e..710fe992 100644 --- a/crates/model-format/src/ple_reader/row_reading.rs +++ b/crates/model-format/src/ple_reader/row_reading.rs @@ -57,6 +57,7 @@ impl PleReader { let mut st = lock(&shared.state); let id = st.next_ticket; st.next_ticket = st.next_ticket.wrapping_add(1).max(1); + // Measurement timer, not decision logic (instant-now exception in architecture.json). let now = Instant::now(); let rearm = !st.keep.period.is_zero() && st.keep.last_issue.is_none_or(|last| now.duration_since(last) > st.keep.window); diff --git a/crates/model-format/src/ple_reader/tests.rs b/crates/model-format/src/ple_reader/tests.rs index 100459a9..cd9ff032 100644 --- a/crates/model-format/src/ple_reader/tests.rs +++ b/crates/model-format/src/ple_reader/tests.rs @@ -131,9 +131,6 @@ fn flaky_reader(threads: Option, panic: bool) -> Arc { Arc::new(PleReader::open(source, c).unwrap()) } -#[path = "tests/max_inflight_bounds_concurrent_reads.rs"] mod max_inflight_bounds_concurrent_reads; -#[path = "tests/prefetched_keys_are_matched.rs"] mod prefetched_keys_are_matched; -#[path = "tests/rows_match_the_oracle_including.rs"] mod rows_match_the_oracle_including; diff --git a/crates/model-format/src/qwen4exp.rs b/crates/model-format/src/qwen4exp.rs index abb49986..82d7027d 100644 --- a/crates/model-format/src/qwen4exp.rs +++ b/crates/model-format/src/qwen4exp.rs @@ -232,7 +232,6 @@ pub struct RoutedMoeSourceScope<'source> { resident_experts: Option<&'source expert_source_bank::ResidentExpertBank>, } -#[path = "qwen4exp_expert_source_bank.rs"] mod expert_source_bank; pub use expert_source_bank::{ ResidentExpertBankLease, ResidentExpertBankMember, ResidentExpertBankSpan, ResidentExpertSourceError, @@ -244,31 +243,19 @@ pub(crate) use expert_source_bank::test_resident_source_memory_admission; pub use expert_source_bank::ProvisionalExpertSource; -#[path = "qwen4exp_file_expert_source.rs"] mod file_expert_source; pub use file_expert_source::{FileExpertExtent, FileExpertSourceLease}; mod binding_topology; -#[allow(unused_imports)] -pub use binding_topology::*; mod qwen4_exp_artifact; -#[allow(unused_imports)] -pub use qwen4_exp_artifact::*; mod validate_owner_index_split; -#[allow(unused_imports)] pub use validate_owner_index_split::*; mod validate_logical_views; -#[allow(unused_imports)] pub use validate_logical_views::*; mod expected_inventory; -#[allow(unused_imports)] pub use expected_inventory::*; mod validate_role_inventory; -#[allow(unused_imports)] pub use validate_role_inventory::*; mod plan_stream_rows; -#[allow(unused_imports)] pub use plan_stream_rows::*; mod routed_moe_source_opening; -#[allow(unused_imports)] -pub use routed_moe_source_opening::*; diff --git a/crates/model-format/src/qwen4exp_expert_source_bank.rs b/crates/model-format/src/qwen4exp/expert_source_bank.rs similarity index 87% rename from crates/model-format/src/qwen4exp_expert_source_bank.rs rename to crates/model-format/src/qwen4exp/expert_source_bank.rs index 649fd78d..fce59644 100644 --- a/crates/model-format/src/qwen4exp_expert_source_bank.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank.rs @@ -54,7 +54,6 @@ pub(super) struct ResidentExpertBank { copied_bytes: Cell, } -#[path = "qwen4exp_digest_capture.rs"] mod digest_capture; pub use digest_capture::ProvisionalExpertSource; @@ -82,15 +81,7 @@ pub struct ResidentExpertBankSpan { length: usize, } -#[path = "qwen4exp_expert_source_bank/retention_metadata_bytes.rs"] mod retention_metadata_bytes; -#[allow(unused_imports)] pub use retention_metadata_bytes::*; -#[path = "qwen4exp_expert_source_bank/qwen4_exp_artifact.rs"] mod qwen4_exp_artifact; -#[allow(unused_imports)] -pub use qwen4_exp_artifact::*; -#[path = "qwen4exp_expert_source_bank/resident_expert_bank_lease.rs"] mod resident_expert_bank_lease; -#[allow(unused_imports)] -pub use resident_expert_bank_lease::*; diff --git a/crates/model-format/src/qwen4exp_digest_capture.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture.rs similarity index 76% rename from crates/model-format/src/qwen4exp_digest_capture.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/digest_capture.rs index 5a6a6553..67d7eb31 100644 --- a/crates/model-format/src/qwen4exp_digest_capture.rs +++ b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture.rs @@ -49,26 +49,12 @@ struct IncrementalCapture { test_available: Option, } #[cfg(test)] -#[path = "qwen4exp_digest_capture_incremental_sdet.rs"] mod incremental_sdet; -#[path = "qwen4exp_digest_capture/capture_admit.rs"] mod capture_admit; -#[allow(unused_imports)] pub use capture_admit::*; -#[path = "qwen4exp_digest_capture/provisional_expert_source.rs"] mod provisional_expert_source; -#[allow(unused_imports)] pub use provisional_expert_source::*; -#[path = "qwen4exp_digest_capture/qwen4_exp_artifact.rs"] mod qwen4_exp_artifact; -#[allow(unused_imports)] -pub use qwen4_exp_artifact::*; -#[path = "qwen4exp_digest_capture/provisional_expert_source_incremental.rs"] mod provisional_expert_source_incremental; -#[allow(unused_imports)] -pub use provisional_expert_source_incremental::*; -#[path = "qwen4exp_digest_capture/provisional_expert_source_test_hooks.rs"] mod provisional_expert_source_test_hooks; -#[allow(unused_imports)] -pub use provisional_expert_source_test_hooks::*; diff --git a/crates/model-format/src/qwen4exp_digest_capture/capture_admit.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs similarity index 100% rename from crates/model-format/src/qwen4exp_digest_capture/capture_admit.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/capture_admit.rs diff --git a/crates/model-format/src/qwen4exp_digest_capture_incremental_sdet.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/incremental_sdet.rs similarity index 100% rename from crates/model-format/src/qwen4exp_digest_capture_incremental_sdet.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/incremental_sdet.rs diff --git a/crates/model-format/src/qwen4exp_digest_capture/provisional_expert_source.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs similarity index 100% rename from crates/model-format/src/qwen4exp_digest_capture/provisional_expert_source.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source.rs diff --git a/crates/model-format/src/qwen4exp_digest_capture/provisional_expert_source_incremental.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs similarity index 100% rename from crates/model-format/src/qwen4exp_digest_capture/provisional_expert_source_incremental.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_incremental.rs diff --git a/crates/model-format/src/qwen4exp_digest_capture/provisional_expert_source_test_hooks.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs similarity index 100% rename from crates/model-format/src/qwen4exp_digest_capture/provisional_expert_source_test_hooks.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/provisional_expert_source_test_hooks.rs diff --git a/crates/model-format/src/qwen4exp_digest_capture/qwen4_exp_artifact.rs b/crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs similarity index 100% rename from crates/model-format/src/qwen4exp_digest_capture/qwen4_exp_artifact.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/digest_capture/qwen4_exp_artifact.rs diff --git a/crates/model-format/src/qwen4exp_expert_source_bank/qwen4_exp_artifact.rs b/crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs similarity index 100% rename from crates/model-format/src/qwen4exp_expert_source_bank/qwen4_exp_artifact.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/qwen4_exp_artifact.rs diff --git a/crates/model-format/src/qwen4exp_expert_source_bank/resident_expert_bank_lease.rs b/crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs similarity index 100% rename from crates/model-format/src/qwen4exp_expert_source_bank/resident_expert_bank_lease.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/resident_expert_bank_lease.rs diff --git a/crates/model-format/src/qwen4exp_expert_source_bank/retention_metadata_bytes.rs b/crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs similarity index 100% rename from crates/model-format/src/qwen4exp_expert_source_bank/retention_metadata_bytes.rs rename to crates/model-format/src/qwen4exp/expert_source_bank/retention_metadata_bytes.rs diff --git a/crates/model-format/src/qwen4exp_file_expert_source.rs b/crates/model-format/src/qwen4exp/file_expert_source.rs similarity index 100% rename from crates/model-format/src/qwen4exp_file_expert_source.rs rename to crates/model-format/src/qwen4exp/file_expert_source.rs diff --git a/crates/model-format/src/settings.rs b/crates/model-format/src/settings.rs index 24f8d322..da8e430e 100644 --- a/crates/model-format/src/settings.rs +++ b/crates/model-format/src/settings.rs @@ -1,11 +1,29 @@ -//! The only place of this crate that reads the process environment (`env-read` ratchet of `architecture.json`). -//! The reads keep their call sites and their parsing; a later step replaces these functions by a parsed settings value. +//! The only place of this crate that reads the process environment: the operator's load switches, as typed values. -use std::env::{self, VarError}; -use std::ffi::OsStr; +/// One of the `LELEKA_LOAD_*` variables of the bulk reader (`READ`, `THREADS`, `CHUNK_MIB`, `AHEAD_MIB`), as text. +pub(crate) fn load_variable(name: &str) -> Option { + std::env::var(name).ok() +} -/// `std::env::var`: the text of an environment variable. -#[inline] -pub(crate) fn var>(key: K) -> Result { - env::var(key) +/// `LELEKA_LOAD_READ=legacy`: keep the sequential read loop instead of the parallel bulk reader. +pub(crate) fn legacy_sequential_read() -> bool { + std::env::var("LELEKA_LOAD_READ").as_deref() == Ok("legacy") +} + +/// `LELEKA_HUGEPAGES` (`on | thp | off`), as text, when it is set to valid text. +pub(crate) fn huge_pages_text() -> Option { + std::env::var("LELEKA_HUGEPAGES").ok() +} + +/// `LELEKA_BANK_THP=on`: back the expert bank with transparent huge pages when `LELEKA_HUGEPAGES` says nothing. +pub(crate) fn bank_thp_on() -> bool { + std::env::var("LELEKA_BANK_THP").is_ok_and(|v| v == "on") +} + +/// `LELEKA_KAR_IDENTITY_RECHECK=off|0|no|false`: the per-read comparison with the verified file state is off. +pub(crate) fn kar_identity_recheck_disabled() -> bool { + std::env::var("LELEKA_KAR_IDENTITY_RECHECK") + .as_deref() + .map(str::trim) + .is_ok_and(|text| matches!(text, "off" | "0" | "no" | "false")) } diff --git a/crates/model-format/tests/kar_extents/builder_makes_archives.rs b/crates/model-format/tests/builder_makes_archives.rs similarity index 100% rename from crates/model-format/tests/kar_extents/builder_makes_archives.rs rename to crates/model-format/tests/builder_makes_archives.rs diff --git a/crates/model-format/tests/kar_extents.rs b/crates/model-format/tests/kar_extents.rs index 165db855..478a9792 100644 --- a/crates/model-format/tests/kar_extents.rs +++ b/crates/model-format/tests/kar_extents.rs @@ -364,5 +364,4 @@ fn standard_profile(bytes: &[u8]) -> KarPleProfile { KarPleProfile::with_total_rows(spec, 1777).unwrap() } -#[path = "kar_extents/builder_makes_archives.rs"] mod builder_makes_archives; diff --git a/crates/model-format/tests/qwen_artifact_binding/fixtures.rs b/crates/model-format/tests/qwen_artifact_binding/fixtures.rs index bc887437..ff433fad 100644 --- a/crates/model-format/tests/qwen_artifact_binding/fixtures.rs +++ b/crates/model-format/tests/qwen_artifact_binding/fixtures.rs @@ -52,17 +52,9 @@ struct MetadataLocation { } mod geometry; -#[allow(unused_imports)] pub use geometry::byte_len; -#[allow(unused_imports)] -pub use geometry::geometry; -#[allow(unused_imports)] -pub use geometry::index; -#[allow(unused_imports)] pub use geometry::logical_indexes; mod metadata; -#[allow(unused_imports)] pub use metadata::metadata; -#[allow(unused_imports)] use metadata::string; mod tiny_owner; diff --git a/crates/native-cpu-expert/src/rust_bench_frontend.rs b/crates/native-cpu-expert/src/rust_bench_frontend.rs index 9454223d..db1d17f4 100644 --- a/crates/native-cpu-expert/src/rust_bench_frontend.rs +++ b/crates/native-cpu-expert/src/rust_bench_frontend.rs @@ -10,9 +10,7 @@ use std::{ ffi::{CString, c_char, c_int, c_void}, time::Instant, }; -#[path = "rust_bench_gpu.rs"] pub mod gpu; -#[path = "rust_bench_model.rs"] mod model; use gpu::ParityGpu; unsafe extern "C" { @@ -85,48 +83,25 @@ const USAGE: &str = concat!( ); mod numerical; -#[allow(unused_imports)] use numerical::bits; -#[allow(unused_imports)] use numerical::dot; -#[allow(unused_imports)] use numerical::elapsed; -#[allow(unused_imports)] use numerical::ggml_rows; -#[allow(unused_imports)] use numerical::iq4nl_hq; -#[allow(unused_imports)] use numerical::name; -#[allow(unused_imports)] use numerical::native_fmt; -#[allow(unused_imports)] use numerical::numerical; -#[allow(unused_imports)] use numerical::outputs; -#[allow(unused_imports)] use numerical::refs; -#[allow(unused_imports)] use numerical::rel; -#[allow(unused_imports)] use numerical::type_of; -#[allow(unused_imports)] use numerical::zeros; mod cpu_blob; -#[allow(unused_imports)] use cpu_blob::cpu_blob; mod float_reference; -#[allow(unused_imports)] use float_reference::check_bf16; -#[allow(unused_imports)] use float_reference::check_blob; -#[allow(unused_imports)] use float_reference::check_q5_one; -#[allow(unused_imports)] -use float_reference::float_reference; mod parity_run; -#[allow(unused_imports)] pub use parity_run::run; -#[allow(unused_imports)] -use parity_run::run_modes; -#[allow(unused_imports)] pub use parity_run::unbound_main; diff --git a/crates/native-cpu-expert/src/rust_bench_gpu.rs b/crates/native-cpu-expert/src/rust_bench_frontend/gpu.rs similarity index 100% rename from crates/native-cpu-expert/src/rust_bench_gpu.rs rename to crates/native-cpu-expert/src/rust_bench_frontend/gpu.rs diff --git a/crates/native-cpu-expert/src/rust_bench_model.rs b/crates/native-cpu-expert/src/rust_bench_frontend/model.rs similarity index 99% rename from crates/native-cpu-expert/src/rust_bench_model.rs rename to crates/native-cpu-expert/src/rust_bench_frontend/model.rs index 078a98c8..e5ccfce3 100644 --- a/crates/native-cpu-expert/src/rust_bench_model.rs +++ b/crates/native-cpu-expert/src/rust_bench_frontend/model.rs @@ -85,7 +85,6 @@ impl Drop for Mapping { } } } -#[path = "rust_bench_model/cursor.rs"] mod cursor; use cursor::{Cursor, copy}; struct Tensor { diff --git a/crates/native-cpu-expert/src/rust_bench_model/cursor.rs b/crates/native-cpu-expert/src/rust_bench_frontend/model/cursor.rs similarity index 100% rename from crates/native-cpu-expert/src/rust_bench_model/cursor.rs rename to crates/native-cpu-expert/src/rust_bench_frontend/model/cursor.rs diff --git a/crates/native-cpu-expert/src/rust_general_pool.rs b/crates/native-cpu-expert/src/rust_general_pool.rs index 26d3620e..bdfdd016 100644 --- a/crates/native-cpu-expert/src/rust_general_pool.rs +++ b/crates/native-cpu-expert/src/rust_general_pool.rs @@ -111,13 +111,9 @@ pub struct ExpertPool { mod exec; mod job_default; -#[allow(unused_imports)] use job_default::alloc_with; -#[allow(unused_imports)] use job_default::cells; -#[allow(unused_imports)] pub use job_default::install_release_gpu_waits; -#[allow(unused_imports)] use job_default::now_ms; mod epoch_scheduling; mod expert_pool; diff --git a/crates/native-cpu-expert/src/rust_ggml.rs b/crates/native-cpu-expert/src/rust_ggml.rs index 6106d251..ed3106b8 100644 --- a/crates/native-cpu-expert/src/rust_ggml.rs +++ b/crates/native-cpu-expert/src/rust_ggml.rs @@ -125,23 +125,13 @@ mod tests { } mod kind; -#[allow(unused_imports)] -use kind::alloc; -#[allow(unused_imports)] use kind::bf16_bits; mod native_format; -#[allow(unused_imports)] pub use native_format::dot; -#[allow(unused_imports)] use native_format::float_dot; -#[allow(unused_imports)] use native_format::iq4nl_dot; -#[allow(unused_imports)] use native_format::q1_dot; -#[allow(unused_imports)] use native_format::q2_generic; mod quantize_raw; -#[allow(unused_imports)] pub(super) use quantize_raw::dot_raw; -#[allow(unused_imports)] pub(super) use quantize_raw::quantize_raw; diff --git a/crates/native-cpu-expert/src/rust_iq.rs b/crates/native-cpu-expert/src/rust_iq.rs index bcc379cf..fbb2080b 100644 --- a/crates/native-cpu-expert/src/rust_iq.rs +++ b/crates/native-cpu-expert/src/rust_iq.rs @@ -8,43 +8,21 @@ use std::arch::x86_64::*; mod tests; mod u16; -#[allow(unused_imports)] use u16::decode; -#[allow(unused_imports)] use u16::decoded; -#[allow(unused_imports)] pub(super) use u16::dot_multi256; -#[allow(unused_imports)] pub(super) use u16::dot_multi512; -#[allow(unused_imports)] -use u16::dot_multi512_tn; -#[allow(unused_imports)] use u16::factor; -#[allow(unused_imports)] pub(super) use u16::format_bytes; -#[allow(unused_imports)] use u16::iq3_half; -#[allow(unused_imports)] -use u16::iq3_multi_fast; -#[allow(unused_imports)] use u16::u16; -#[allow(unused_imports)] -use u16::u32; mod dot_multi512; -#[allow(unused_imports)] use dot_multi512::dot_multi512_impl; -#[allow(unused_imports)] pub(super) use dot_multi512::dot_single; -#[allow(unused_imports)] +#[cfg(test)] use dot_multi512::dot_single_generic; -#[allow(unused_imports)] +#[cfg(test)] use dot_multi512::dot_single_iq3; -#[allow(unused_imports)] -use dot_multi512::iq3_single_fast; -#[allow(unused_imports)] pub(super) use dot_multi512::iq4nl; -#[allow(unused_imports)] -use dot_multi512::iq4xs; mod iq4nl_n; -#[allow(unused_imports)] use iq4nl_n::iq4nl_n; diff --git a/crates/native-cpu-expert/src/rust_legacy.rs b/crates/native-cpu-expert/src/rust_legacy.rs index 2cf586b2..df7800bb 100644 --- a/crates/native-cpu-expert/src/rust_legacy.rs +++ b/crates/native-cpu-expert/src/rust_legacy.rs @@ -34,46 +34,22 @@ pub(super) struct SingleScratch { mod tests; mod set_oracle_q8_zero; -#[allow(unused_imports)] -use set_oracle_q8_zero::dot32; -#[allow(unused_imports)] pub(super) use set_oracle_q8_zero::half; -#[allow(unused_imports)] pub(super) use set_oracle_q8_zero::legacy_supported; -#[allow(unused_imports)] pub use set_oracle_q8_zero::oracle_q8_zero_enabled; -#[allow(unused_imports)] use set_oracle_q8_zero::row; -#[allow(unused_imports)] -use set_oracle_q8_zero::row_oracle; -#[allow(unused_imports)] +#[cfg(test)] use set_oracle_q8_zero::row256; -#[allow(unused_imports)] -use set_oracle_q8_zero::row512; -#[allow(unused_imports)] pub use set_oracle_q8_zero::set_oracle_q8_zero; -#[allow(unused_imports)] -use set_oracle_q8_zero::unpack32; mod pair_rows; -#[allow(unused_imports)] use pair_rows::{GateUpOut, act_refs, down_row, gate_up_pair}; mod admit; -#[allow(unused_imports)] -use admit::admit; -#[allow(unused_imports)] pub use admit::down_rows; -#[allow(unused_imports)] pub use admit::expert; -#[allow(unused_imports)] pub use admit::expert_quantized; -#[allow(unused_imports)] pub use admit::expert_scalar; -#[allow(unused_imports)] pub use admit::gate_up_rows; mod gate_each; -#[allow(unused_imports)] pub(super) use gate_each::down_each; -#[allow(unused_imports)] pub(super) use gate_each::gate_each; -#[allow(unused_imports)] pub(super) use gate_each::whole_single; diff --git a/crates/native-cpu-expert/src/rust_native_general.rs b/crates/native-cpu-expert/src/rust_native_general.rs index fa7f736d..e9ab7111 100644 --- a/crates/native-cpu-expert/src/rust_native_general.rs +++ b/crates/native-cpu-expert/src/rust_native_general.rs @@ -20,47 +20,25 @@ pub struct NativeActivation { mod tests; mod native_activation_quantize; -#[allow(unused_imports)] pub(super) use native_activation_quantize::group_dot; -#[allow(unused_imports)] pub(super) use native_activation_quantize::group_dot_bytes; -#[allow(unused_imports)] -use native_activation_quantize::group_dot_policy; -#[allow(unused_imports)] pub(super) use native_activation_quantize::gu_multi_route; -#[allow(unused_imports)] pub use native_activation_quantize::native_down_rows; -#[allow(unused_imports)] pub use native_activation_quantize::native_gu_rows; mod group_dot_bytes_policy; -#[allow(unused_imports)] use group_dot_bytes_policy::group_dot_bytes_policy; -#[allow(unused_imports)] pub use group_dot_bytes_policy::iq_gu_rows; -#[allow(unused_imports)] pub use group_dot_bytes_policy::iq_rows; -#[allow(unused_imports)] pub use group_dot_bytes_policy::kq_rows; -#[allow(unused_imports)] pub(super) use group_dot_bytes_policy::{DotPolicy, DotRoute, EncodedRow}; -#[allow(unused_imports)] pub use group_dot_bytes_policy::{EncodedRows, GateUpBlob}; -#[allow(unused_imports)] use group_dot_bytes_policy::{check_gu, check_rows, check_weights, kq_dot, store, typed}; mod iq4nl_rows; -#[allow(unused_imports)] pub use iq4nl_rows::cpu_avx2_ok; -#[allow(unused_imports)] pub use iq4nl_rows::cpu_avx512_ok; -#[allow(unused_imports)] pub use iq4nl_rows::iq_supported; -#[allow(unused_imports)] pub use iq4nl_rows::iq4nl_rows; -#[allow(unused_imports)] pub use iq4nl_rows::kq_gu_rows; -#[allow(unused_imports)] pub use iq4nl_rows::kq_supported; -#[allow(unused_imports)] pub use iq4nl_rows::native_experts_available; -#[allow(unused_imports)] pub use iq4nl_rows::q2_rows; diff --git a/crates/native-cpu-expert/src/rust_pool.rs b/crates/native-cpu-expert/src/rust_pool.rs index d9d2e698..4326fcf0 100644 --- a/crates/native-cpu-expert/src/rust_pool.rs +++ b/crates/native-cpu-expert/src/rust_pool.rs @@ -90,13 +90,10 @@ pub(super) struct NativePool { mod exec; mod native_act_default; -#[allow(unused_imports)] use native_act_default::all_finite; -#[allow(unused_imports)] use native_act_default::allocated; mod epoch_scheduling; mod stage; -#[allow(unused_imports)] use epoch_scheduling::tasks_per_thread; mod native_pool; mod trace; diff --git a/crates/native-cpu-expert/src/rust_weight_iq.rs b/crates/native-cpu-expert/src/rust_weight_iq.rs index 26dd45c6..ac3e4295 100644 --- a/crates/native-cpu-expert/src/rust_weight_iq.rs +++ b/crates/native-cpu-expert/src/rust_weight_iq.rs @@ -31,43 +31,20 @@ unsafe extern "C" { } mod alloc; -#[allow(unused_imports)] -use alloc::alloc; -#[allow(unused_imports)] pub(super) use alloc::free; -#[allow(unused_imports)] use alloc::grid; -#[allow(unused_imports)] -use alloc::grid_kind; -#[allow(unused_imports)] pub(super) use alloc::init; -#[allow(unused_imports)] use alloc::put_h; -#[allow(unused_imports)] -use alloc::signs; -#[allow(unused_imports)] use alloc::totals; -#[allow(unused_imports)] use alloc::{CandidateStep, QuantTarget, quant_candidates}; mod iq2_xxs; -#[allow(unused_imports)] use iq2_xxs::iq2_xs; -#[allow(unused_imports)] use iq2_xxs::iq2_xxs; mod iq3; -#[allow(unused_imports)] -use iq3::compare_pair; -#[allow(unused_imports)] use iq3::iq2_s; -#[allow(unused_imports)] use iq3::iq3; -#[allow(unused_imports)] use iq3::pairs; mod grid; -#[allow(unused_imports)] use grid::iq1_s; mod iq1_m; -#[allow(unused_imports)] -use iq1_m::iq1_m; -#[allow(unused_imports)] pub(super) use iq1_m::row; diff --git a/crates/native-cpu-expert/src/rust_weight_quant.rs b/crates/native-cpu-expert/src/rust_weight_quant.rs index eab61b04..d173b1c5 100644 --- a/crates/native-cpu-expert/src/rust_weight_quant.rs +++ b/crates/native-cpu-expert/src/rust_weight_quant.rs @@ -7,65 +7,30 @@ const EPS: f32 = 1e-15; const FP4: [i8; 16] = [0, 1, 2, 3, 4, 6, 8, 12, 0, -1, -2, -3, -4, -6, -8, -12]; mod nearest; -#[allow(unused_imports)] use nearest::h; -#[allow(unused_imports)] use nearest::max_signed; -#[allow(unused_imports)] pub(super) use nearest::nearest; -#[allow(unused_imports)] use nearest::put_h; -#[allow(unused_imports)] use nearest::q3; -#[allow(unused_imports)] use nearest::qkx; -#[allow(unused_imports)] pub(super) use nearest::qx; -#[allow(unused_imports)] -use nearest::weight; mod qp; -#[allow(unused_imports)] use qp::e8_half; -#[allow(unused_imports)] use qp::pack_ue4; -#[allow(unused_imports)] use qp::pack4; -#[allow(unused_imports)] pub(super) use qp::qp; -#[allow(unused_imports)] use qp::small; -#[allow(unused_imports)] use qp::ue4; mod best_fp4; -#[allow(unused_imports)] -use best_fp4::best_fp4; -#[allow(unused_imports)] use best_fp4::fp4; -#[allow(unused_imports)] -use best_fp4::pack_k2; -#[allow(unused_imports)] -use best_fp4::pack_scale3; -#[allow(unused_imports)] use best_fp4::pack_scale4; -#[allow(unused_imports)] use best_fp4::q2k; -#[allow(unused_imports)] use best_fp4::q3k; -#[allow(unused_imports)] use best_fp4::ternary; -#[allow(unused_imports)] -use best_fp4::unpack_scale3; -#[allow(unused_imports)] use best_fp4::unpack_scale4; mod q45k; -#[allow(unused_imports)] use q45k::best_iq4; -#[allow(unused_imports)] use q45k::q6k; -#[allow(unused_imports)] use q45k::q45k; mod iq4; -#[allow(unused_imports)] -use iq4::iq4; -#[allow(unused_imports)] pub(super) use iq4::row_without_iq; diff --git a/crates/npu-service/src/engine/execution.rs b/crates/npu-service/src/engine/execution.rs index 13ec8fc2..a6c11ba4 100644 --- a/crates/npu-service/src/engine/execution.rs +++ b/crates/npu-service/src/engine/execution.rs @@ -51,6 +51,7 @@ impl Engine { } pub(super) fn run_at(&mut self, list: &[Product], i: usize) -> Result { + // Measurement timer, not decision logic (instant-now exception in architecture.json). let started = Instant::now(); let Self { runtime, diff --git a/crates/obs/src/level.rs b/crates/obs/src/level.rs index 13983f90..ac896a16 100644 --- a/crates/obs/src/level.rs +++ b/crates/obs/src/level.rs @@ -2,7 +2,6 @@ //! Implements `From for V`, `From for V` and 8 more. use std::fmt::Write as _; -use std::io::Write as _; use super::{ Field, Format, IsTerminal, KeyClass, Level, MAX_LINE, MAX_MSG, MAX_VALUE, Rendered, SETTINGS, Settings, V, classify_key, format_utc_ms, redact, @@ -103,6 +102,11 @@ impl Settings { } } +/// `LELEKA_REQUEST_LOG`: the file that receives a copy of every request line, when the operator names one. +pub(super) fn request_log_path() -> Option { + std::env::var_os("LELEKA_REQUEST_LOG").filter(|path| !path.is_empty()) +} + pub fn settings() -> &'static Settings { SETTINGS.get_or_init(|| Settings::from_env(|name| std::env::var(name).ok(), std::io::stderr().is_terminal())) } diff --git a/crates/obs/src/lib.rs b/crates/obs/src/lib.rs index 35065f46..dbddfe89 100644 --- a/crates/obs/src/lib.rs +++ b/crates/obs/src/lib.rs @@ -19,8 +19,7 @@ pub mod time; pub use redact::{KeyClass, classify_key, register_secret}; pub use time::{format_utc_ms, now_ms, parse_duration_ms, parse_utc_ms}; -use std::fmt::Write as _; -use std::io::{IsTerminal, Write as _}; +use std::io::IsTerminal; use std::sync::{Mutex, OnceLock}; /// Longest string value in a line; longer ones are cut and end in `~`. @@ -267,48 +266,18 @@ mod tests { } mod level; -#[allow(unused_imports)] -use level::clean_key; -#[allow(unused_imports)] -use level::clean_key_dash; -#[allow(unused_imports)] -use level::json_line; -#[allow(unused_imports)] -use level::json_string; -#[allow(unused_imports)] -use level::render_fields; -#[allow(unused_imports)] pub use level::settings; -#[allow(unused_imports)] -use level::text_line; -#[allow(unused_imports)] pub use level::{EventHead, format_line}; mod write_stderr; -#[allow(unused_imports)] pub use write_stderr::debug; -#[allow(unused_imports)] pub use write_stderr::emit; -#[allow(unused_imports)] pub use write_stderr::emit_always; -#[allow(unused_imports)] pub use write_stderr::emit_keyed; -#[allow(unused_imports)] pub use write_stderr::emit_msg; -#[allow(unused_imports)] pub use write_stderr::error; -#[allow(unused_imports)] pub use write_stderr::info; -#[allow(unused_imports)] pub use write_stderr::legacy_line; -#[allow(unused_imports)] pub use write_stderr::new_request_id; -#[allow(unused_imports)] pub use write_stderr::record; -#[allow(unused_imports)] -use write_stderr::request_sink; -#[allow(unused_imports)] pub use write_stderr::trace_msg; -#[allow(unused_imports)] pub use write_stderr::warn; -#[allow(unused_imports)] -use write_stderr::write_stderr; diff --git a/crates/obs/src/write_stderr.rs b/crates/obs/src/write_stderr.rs index e859d4f0..157ce4a8 100644 --- a/crates/obs/src/write_stderr.rs +++ b/crates/obs/src/write_stderr.rs @@ -50,7 +50,7 @@ impl FileSink { pub(super) fn request_sink() -> Option<&'static FileSink> { static SINK: OnceLock> = OnceLock::new(); - SINK.get_or_init(|| std::env::var_os("LELEKA_REQUEST_LOG").filter(|p| !p.is_empty()).map(FileSink::new)).as_ref() + SINK.get_or_init(|| crate::level::request_log_path().map(FileSink::new)).as_ref() } /// Log an event, rate limited per `comp:ev`. Below the configured level nothing happens. diff --git a/crates/serving-policy/src/cvec.rs b/crates/serving-policy/src/cvec.rs index 37158a85..c1179941 100644 --- a/crates/serving-policy/src/cvec.rs +++ b/crates/serving-policy/src/cvec.rs @@ -75,8 +75,6 @@ pub struct Tables { mod tests; mod cursor; -#[allow(unused_imports)] pub use cursor::*; mod build_tables; -#[allow(unused_imports)] pub use build_tables::*; diff --git a/crates/serving-policy/src/shared.rs b/crates/serving-policy/src/shared.rs index b5ed8d51..34c5ca38 100644 --- a/crates/serving-policy/src/shared.rs +++ b/crates/serving-policy/src/shared.rs @@ -58,8 +58,6 @@ pub struct MergedDefaults { mod tests; mod shared_defaults; -#[allow(unused_imports)] pub use shared_defaults::*; mod sampling_defaults; -#[allow(unused_imports)] pub use sampling_defaults::*; diff --git a/crates/tokenizer/src/construction.rs b/crates/tokenizer/src/construction.rs index ea245c07..031a24f9 100644 --- a/crates/tokenizer/src/construction.rs +++ b/crates/tokenizer/src/construction.rs @@ -204,7 +204,7 @@ fn marks_of(tokens: &[String], types: &[u32]) -> Result { /// Kill switch for an operator who suspects the fast path: `LELEKA_TOKENIZER_REFERENCE=1` runs the original /// implementation only. fn fast_path(vocab: &HashMap, merges: &[String], byte_chars: &[char; 256]) -> Option { - if std::env::var_os("LELEKA_TOKENIZER_REFERENCE").is_some_and(|v| v == "1") { + if crate::settings::reference_only() { return None; } let pairs: Vec<(String, String)> = merges @@ -217,8 +217,5 @@ fn fast_path(vocab: &HashMap, merges: &[String], byte_chars: &[char /// `LELEKA_TOKENIZER_SEGMENT_CACHE_MIB=n` sizes the segment cache (0 turns it off). fn segment_cache_budget() -> usize { - std::env::var("LELEKA_TOKENIZER_SEGMENT_CACHE_MIB") - .ok() - .and_then(|value| value.parse::().ok()) - .map_or(cache::DEFAULT_BUDGET, |mib| mib << 20) + crate::settings::segment_cache_mib().map_or(cache::DEFAULT_BUDGET, |mib| mib << 20) } diff --git a/crates/tokenizer/src/fast.rs b/crates/tokenizer/src/fast.rs index af85cc24..170b0a49 100644 --- a/crates/tokenizer/src/fast.rs +++ b/crates/tokenizer/src/fast.rs @@ -56,8 +56,4 @@ pub struct Scratch { } mod unicode_ranges; -#[allow(unused_imports)] -pub use unicode_ranges::*; mod piece_merging; -#[allow(unused_imports)] -pub use piece_merging::*; diff --git a/crates/tokenizer/src/gguf_bpe.rs b/crates/tokenizer/src/gguf_bpe.rs index b1986bb3..705598c7 100644 --- a/crates/tokenizer/src/gguf_bpe.rs +++ b/crates/tokenizer/src/gguf_bpe.rs @@ -76,12 +76,7 @@ mod tests; mod build; mod error_messages; -#[allow(unused_imports)] pub use error_messages::*; mod codec; -#[allow(unused_imports)] -pub use codec::*; mod symbols; mod utf8_stream; -#[allow(unused_imports)] -pub use utf8_stream::*; diff --git a/crates/tokenizer/src/gguf_bpe/codec.rs b/crates/tokenizer/src/gguf_bpe/codec.rs index d4e579c3..bbd3d656 100644 --- a/crates/tokenizer/src/gguf_bpe/codec.rs +++ b/crates/tokenizer/src/gguf_bpe/codec.rs @@ -2,7 +2,6 @@ //! back to text, and look tokens up. //! Apart from `symbols` and `build`, which hold the vocabulary tables; this file is the public use of them. -#[allow(unused_imports)] use super::{build, symbols::Symbols, *}; impl GgufBpe { diff --git a/crates/tokenizer/src/lib.rs b/crates/tokenizer/src/lib.rs index 719269ae..120daae6 100644 --- a/crates/tokenizer/src/lib.rs +++ b/crates/tokenizer/src/lib.rs @@ -16,6 +16,7 @@ use serde::Deserialize; mod cache; mod fast; +mod settings; mod marks; pub use cache::{DEFAULT_BUDGET as DEFAULT_SEGMENT_CACHE_BYTES, MIN_SEGMENT_BYTES}; diff --git a/crates/tokenizer/src/settings.rs b/crates/tokenizer/src/settings.rs new file mode 100644 index 00000000..6c7618f8 --- /dev/null +++ b/crates/tokenizer/src/settings.rs @@ -0,0 +1,12 @@ +//! The only place of this crate that reads the process environment: the operator's tokenizer switches, as typed values. + +/// `LELEKA_TOKENIZER_REFERENCE=1`: run the original implementation only (a kill switch for the fast path). +pub(crate) fn reference_only() -> bool { + std::env::var_os("LELEKA_TOKENIZER_REFERENCE").is_some_and(|v| v == "1") +} + +/// `LELEKA_TOKENIZER_SEGMENT_CACHE_MIB=n`: the size of the segment cache in MiB (0 turns it off); `None` when unset or +/// not a number. +pub(crate) fn segment_cache_mib() -> Option { + std::env::var("LELEKA_TOKENIZER_SEGMENT_CACHE_MIB").ok().and_then(|value| value.parse::().ok()) +} diff --git a/docs/architecture/tech-debt.md b/docs/architecture/tech-debt.md index 1fb4c48b..458e9d20 100644 --- a/docs/architecture/tech-debt.md +++ b/docs/architecture/tech-debt.md @@ -205,6 +205,27 @@ their doc comment now says by which phase), `ConversationManager` (a domain type | `path-include` (engine 100, `desktop-core` 2) | not in the owner's list for this pass | `mod x;` through the directory layout with `git mv`, one directory at a time | | generated doc headers (`Methods of ...`, `Functions: ...`) in about 430 files of these crates | the sentence on why the file is separate needs the author's knowledge | by directory, together with the next feature that touches it | +### (c3) Stage 10 for the low-level crates (owner order 2026-11-14, branches `claude/debt-low` and `claude/debt-hot-low`) + +The order: every ratchet of `architecture-baseline.json` goes to zero in the code, or to a named entry of the `exceptions` list of `architecture.json` +(crate, file, ratchet, reason; the gate reads it, an entry that excuses nothing or has no reason is an error). Numbers are production code of the +low-level crates (`cuda-driver`, `cuda-model`, `model-format`, `native-cpu-expert`, `leleka-memory`, `memory-os`, `libc-shim`, `cpu-sys`, the gpt-oss +workers and the small libraries), before -> after, from `scripts/check-architecture.py`. + +| Ratchet | Before | After | How | +|---|---|---|---| +| `allow-unused-imports` | 552 | 0 | `scripts/dev/prune_unused_imports.py`: strips the allow, compiles with one job per feature set (`cuda-driver`, `sm86`, all features), deletes the imports the compiler reports in every compilation unit, puts `#[cfg(test)]` on the ones only the library's unit tests use. Most of the 410 `cuda-driver` allows sat on `pub use` re-exports that needed no allow at all | +| `glob-super-import` | 3 | 2 (cuda-driver, see below) | `root_exports.rs` names its paths (`crate::x`, `leleka_cuda_model::serving_context`) | +| `path-include` | 132 | 0 counted (1 in `cuda-driver`, see below) | `scripts/dev/path_to_layout.py`: walks the module tree (a file loaded by `#[path]` resolves its children next to itself, a default file in a directory of its name), moves the module files to `/.rs` with `git mv`, drops the attribute, rewrites `include_*!` paths and the paths scripts quote (`scripts/dev/update_path_refs.py`). 502 files moved (`cuda-driver` 472, `model-format` 27, `native-cpu-expert` 3); module paths did not change. The gate now treats `#[cfg(test)] #[path = "../tests/x.rs"] mod x;` as test code | +| `env-read` | 30 | 0 outside EXC_ENV exceptions | one reader per crate: new typed `settings.rs` in `cpu-worker`, `tokenizer`, `gptoss-npu`, `gpu-npu-worker`, `igpu`, `npu-service`, `leleka-memory`, `gptoss`, `model-format` (functions named after the variable, returning parsed values); `obs` parses `LELEKA_LOG*` in `level.rs`; `cuda-model` has `env_switch::EnvSwitch` (the name, a typed rule, the answer cached on first read). Exceptions: the readers above, `cpu-kernels` (parses the ISA request), `libc-shim` and `memory-os` (platform adapters), the `npu-worker` and `native-parity-bench` roots | +| `dyn-trait` | 52 outside `cuda-driver` | 0 outside EXC_DYN exceptions | callbacks and probes became generics (`&mut (impl FnMut(..) + ?Sized)`, `&(impl ProcSource + ?Sized)`); what stays is a port boundary (`MemoryPressure`, `ProcSource`, `PageLocking`, `ModelBytes`, `PageSource`, `PrefillAccelerator`, `LayerCache`, the GPU probe closure), a trait method that must be dyn-compatible, `Box` of a library boundary, or the type-erased job of the worker pool | +| `instant-now` | 54 outside the driver and the CPU pool | 0 outside EXC_INSTANT exceptions | the clock adapter (`obs/time/clock.rs`) and measurement timers (stage laps and wall times printed in the workers' timing lines, load reports); each carries a comment that says so. `leleka-memory` reads `SystemClock` | +| `process-global` | 50 outside the driver and the CPU pool | 0 outside EXC_GLOBAL exceptions | immutable tables (regex, half table), operator settings read once, the process-wide logger, the process singletons the S13/S14 injection is for (`Governor::global()`, `Inventory`, the serving context, the verify stamps) | + +The test run (`cargo test`, slim profile) of `cuda-model`, `obs`, `leleka-memory`, `tokenizer`, `model-format`, `gptoss`, `cpu-worker`, `igpu`, +`memory-os`, `experimental-ref` and `npu-service`: all green except the three known `qwen_artifact_binding` tests of `model-format` +(`cargo check --workspace --all-targets` is clean; `cuda-driver` and `native-cpu-expert` follow the hot-path branch, see below). + ### (e) Stage 10 pass: control-plane, desktop-core, deploy and the small crates (owner order 2026-11-14, branch `claude/debt-control`) Crates: `leleka-control-plane`, `leleka-engine-host`, `leleka-deploy`, `leleka-gateway-domain`, `leleka-gateway-text`, `leleka-backend-api`, `leleka-runtime-client`, `leleka-npu-service`. Numbers are from `scripts/check-architecture.py`; a site that must stay is a named entry of `exceptions` in `architecture.json` (crate, file, ratchet, reason), not a baseline number. diff --git a/scripts/archcheck/measure.py b/scripts/archcheck/measure.py index 200801b3..87e573a5 100644 --- a/scripts/archcheck/measure.py +++ b/scripts/archcheck/measure.py @@ -76,9 +76,11 @@ def production_lines(text): following = lines[index + 1] if index + 1 < len(lines) else "" if line.startswith("#[cfg(test)]") and following.startswith("mod "): break - opens_test_block = following.startswith("mod ") and following.rstrip().endswith("{") - if _is_test_cfg(line) and line.startswith("#[cfg(") and opens_test_block: - index = _after_block(lines, index + 1) + skipped_to = _test_module_declaration_end(lines, index) + if skipped_to is None and _opens_test_block(line, following): + skipped_to = _after_block(lines, index + 1) + if skipped_to is not None: + index = skipped_to continue if not line.lstrip().startswith("//"): kept.append(line) @@ -86,6 +88,26 @@ def production_lines(text): return kept +def _opens_test_block(line, following): + """A test cfg line whose next line opens an inline `mod x {` block.""" + opens_block = following.startswith("mod ") and following.rstrip().endswith("{") + return _is_test_cfg(line) and line.startswith("#[cfg(") and opens_block + + +def _test_module_declaration_end(lines, index): + """Index after a `mod x;` declaration that a test cfg line starts and further attributes (`#[path = ...]`) follow; + the declaration is test code, the production code after it still counts. None when `index` starts no such one.""" + following = lines[index + 1] if index + 1 < len(lines) else "" + if not (_is_test_cfg(lines[index]) and lines[index].startswith("#[cfg(") and following.startswith("#[")): + return None + cursor = index + 1 + while cursor < len(lines) and lines[cursor].startswith("#["): + cursor += 1 + declaration = lines[cursor] if cursor < len(lines) else "" + names_a_module = declaration.startswith(("mod ", "pub mod ", "pub(crate) mod ")) + return cursor + 1 if names_a_module and declaration.rstrip().endswith(";") else None + + def _after_block(lines, start): """Index of the line after the column-0 `}` that closes the block opened at `start`.""" for index in range(start + 1, len(lines)): diff --git a/scripts/build-original-verify-ptx.sh b/scripts/build-original-verify-ptx.sh index 2bb78e5f..51f592ed 100644 --- a/scripts/build-original-verify-ptx.sh +++ b/scripts/build-original-verify-ptx.sh @@ -151,7 +151,7 @@ required = { ), } -symbols = (Path.cwd() / 'crates/cuda-driver/src/mtp_original_full_symbols.rs').read_text(encoding='utf-8') +symbols = (Path.cwd() / 'crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols.rs').read_text(encoding='utf-8') for asset, exports in __import__('re').findall(r'include_bytes!\(\"([^\"]+\.ptx)\"\).*?&\[(.*?)\]\)', symbols, __import__('re').S): required[asset] = tuple(__import__('re').findall(r'c\"([^\"]+)\"', exports)) diff --git a/scripts/chain/reset_chain_pin.py b/scripts/chain/reset_chain_pin.py index 49b1a65d..568566b3 100644 --- a/scripts/chain/reset_chain_pin.py +++ b/scripts/chain/reset_chain_pin.py @@ -4,7 +4,7 @@ import re import sys ptx = "crates/cuda-driver/src/chain_window.ptx" -rs = "crates/cuda-driver/src/original_verify_window_chain.rs" +rs = "crates/cuda-driver/src/original_verify/chain.rs" with open(ptx, "w", newline="\n") as f: f.write("// UNSEALED placeholder: chain_window.ptx (compile_assets.py / seal_pins.py install the real PTX)\n") s = open(rs, newline="").read() diff --git a/scripts/check_architecture_test.py b/scripts/check_architecture_test.py index 72915a28..cea652ac 100644 --- a/scripts/check_architecture_test.py +++ b/scripts/check_architecture_test.py @@ -236,6 +236,9 @@ class Measurement(unittest.TestCase): unused = dict(listed, file="src/lib.rs", ratchet="x") self.assertEqual(len(rules.exception_findings([unused, dict(listed, reason="")], excused, {"e"})), 2) + def test_a_test_module_declaration_with_a_path_attribute_is_not_production(self): + text = "\n".join(["#[cfg(test)]", '#[path = "../tests/x.rs"]', "mod tests;", "let a = 1;"]) + "\n" + self.assertEqual(measure.production_lines(text), ["let a = 1;"]) if __name__ == "__main__": unittest.main() diff --git a/scripts/decode-sm120/reset_pin.py b/scripts/decode-sm120/reset_pin.py index fc402c86..5961b381 100644 --- a/scripts/decode-sm120/reset_pin.py +++ b/scripts/decode-sm120/reset_pin.py @@ -5,7 +5,7 @@ import sys name = sys.argv[1] ptx = f"crates/cuda-driver/src/{name}.ptx" -rs = "crates/cuda-driver/src/original_verify_window_sm120.rs" +rs = "crates/cuda-driver/src/original_verify/sm120.rs" with open(ptx, "w", newline="\n") as f: f.write(f"// UNSEALED placeholder: {name}.ptx (compile_assets.py / seal_pins.py install the real PTX)\n") s = open(rs, newline="").read() diff --git a/scripts/dev/path_to_layout.py b/scripts/dev/path_to_layout.py new file mode 100644 index 00000000..3f6ad5e6 --- /dev/null +++ b/scripts/dev/path_to_layout.py @@ -0,0 +1,188 @@ +"""Replace `#[path = "x.rs"] mod name;` by the directory layout (`parent/name.rs`) with `git mv` (STRA-338 stage 10). + +Usage: python scripts/dev/path_to_layout.py CRATE_DIR [--apply | --fix-includes] + +The module paths do not change, only where the files live. Walking the module tree from the crate roots, a module whose +declaration carries a `#[path]` (except a `tests.rs` file and a `../` path that leaves the module's directory) gets the +location its parent's directory gives it: `/.rs`, and the children that were resolved next to the +old file move into the directory named after the new one. Then + + * the `#[path]` of every normalised declaration is dropped, the others are rewritten relative to the moved parent; + * `include_str!`, `include_bytes!` and `include!` paths of a moved file are rewritten to reach the same file. + +A file loaded through `#[path]` (like a crate root or `mod.rs`) resolves its own `mod x;` next to itself; a file at its +default place resolves them in a directory named after it. The tool tracks both for the old and the new tree. +Without --apply the plan is printed. A target that already exists is reported and left. After --apply, run +--fix-includes: it rewrites the `include_str!` of source files that other files read and that moved (read from +`git diff -M`). Offline refactoring aid, not part of the product. +""" +import os +import pathlib +import re +import subprocess +import sys + +ROOTS = ("lib.rs", "main.rs", "mod.rs") +PATH_ATTR = re.compile(r'^(\s*)#\[path\s*=\s*"([^"]+)"\]\s*$') +MOD_DECL = re.compile(r"^\s*(?:pub(?:\([^)]*\))?\s+)?mod\s+([A-Za-z_][A-Za-z0-9_]*)\s*;\s*$") +INCLUDE = re.compile(r'(include_str!|include_bytes!|include!)\(\s*"([^"]+)"\s*\)') + + +def is_root(path): + return path.name in ROOTS or path.parent.name == "bin" and path.parent.parent.name == "src" + + +def directory(path, flat): + """Where the `mod x;` declarations of a file are resolved.""" + return path.parent if flat else path.parent / path.stem + + +def declarations(path): + """[(mod name, line index of the mod line, line index of its #[path] line or None, path string or None)].""" + rows = path.read_text(encoding="utf-8").split("\n") + found, path_line, path_value = [], None, None + for index, row in enumerate(rows): + attr = PATH_ATTR.match(row) + if attr: + path_line, path_value = index, attr.group(2) + continue + decl = MOD_DECL.match(row) + if decl: + found.append((decl.group(1), index, path_line, path_value)) + path_line = path_value = None + elif not row.strip().startswith("#[") and row.strip() and not row.strip().startswith("//"): + path_line = path_value = None + return found + + +class Plan: + """The module tree walked from the crate roots: for every module file its old and its new place.""" + + def __init__(self): + self.new, self.flats, self.decls, self.skipped = {}, {}, {}, [] + + def old_child(self, old, old_flat, name, value): + """(file, flat) of the module a declaration names in the old tree.""" + if value: + base = pathlib.Path(os.path.normpath(old.parent / value)) + return (base, True) if base.is_file() else (None, False) + plain = directory(old, old_flat) / f"{name}.rs" + nested = directory(old, old_flat) / name / "mod.rs" + return (plain, False) if plain.is_file() else (nested, True) if nested.is_file() else (None, False) + + def place(self, canonical, child, dirs, normalise, has_attr): + """(new file, flat, normalised) for a child that is not placed yet; flat None keeps the old kind.""" + old_dir, new_dir = dirs + if normalise and child == canonical: + return canonical, False, True + if normalise and not canonical.exists() and canonical not in self.new.values(): + return canonical, False, True + if not has_attr and old_dir != new_dir: + return new_dir / child.relative_to(old_dir), None, False + return child, None, False + + def walk(self, old, new, old_flat, new_flat): + if old in self.new: + return + self.new[old], self.flats[old] = new, new_flat + dirs = directory(old, old_flat), directory(new, new_flat) + rows = [] + for name, mod_line, path_line, value in declarations(old): + child, child_flat = self.old_child(old, old_flat, name, value) + if child is None: + continue + normalise = value is not None and ".." not in value and not value.endswith("tests.rs") + if child in self.new: + target, normalised = self.new[child], False + else: + canonical = dirs[1] / f"{name}.rs" + target, flat, normalised = self.place(canonical, child, dirs, normalise, value is not None) + if normalise and not normalised: + self.skipped.append((str(old), name, "target exists or is taken")) + self.walk(child, target, child_flat, child_flat if flat is None else flat) + rows.append((name, mod_line, path_line, value, target, normalised)) + self.decls[old] = rows + + +def collect(crate_dir): + src = pathlib.Path(crate_dir).resolve() / "src" + plan = Plan() + for root in (p for p in sorted(src.rglob("*.rs")) if is_root(p)): + plan.walk(root, root, True, True) + return plan + + +def relative(target, start): + return pathlib.PurePosixPath(os.path.relpath(target, start).replace("\\", "/")).as_posix() + + +def git(root, *args): + subprocess.run(["git", *args], cwd=root, check=True, capture_output=True) + + +def rewrite_file(old, new, rows_info, text): + rows, drop = text.split("\n"), set() + for _name, _mod_line, path_line, _value, target, normalised in rows_info: + if path_line is None: + continue + if normalised: + drop.add(path_line) + else: + indent = PATH_ATTR.match(rows[path_line]).group(1) + rows[path_line] = f'{indent}#[path = "{relative(target, new.parent)}"]' + text = "\n".join(r for i, r in enumerate(rows) if i not in drop) + if old != new: + text = INCLUDE.sub(lambda m: f'{m.group(1)}("{relative(old.parent / m.group(2), new.parent)}")', text) + return text + + +def apply_plan(plan, root, apply): + moves = {old: new for old, new in plan.new.items() if old != new} + for old, new in sorted(moves.items()): + print(f"mv {old.relative_to(root).as_posix()} -> {new.relative_to(root).as_posix()}") + print(f"{len(moves)} files move; left as they are: {plan.skipped}") + if not apply: + return + contents = {old: old.read_text(encoding="utf-8") for old in plan.new} + for old, new in sorted(moves.items()): + new.parent.mkdir(parents=True, exist_ok=True) + git(root, "mv", str(old), str(new)) + for old, new in plan.new.items(): + text = rewrite_file(old, new, plan.decls.get(old, []), contents[old]) + with open(new, "wb") as handle: + handle.write(text.encode("utf-8")) + + +def fix_includes(crate_dir): + """Rewrite `include_str!`, `include_bytes!` and `include!` of `.rs` files that moved (read from `git diff -M`).""" + root = pathlib.Path(crate_dir).resolve().parents[1] + out = subprocess.run(["git", "diff", "-M", "--name-status", "HEAD"], cwd=root, capture_output=True, text=True).stdout + moved = {} + for line in out.splitlines(): + parts = line.split("\t") + if parts[0].startswith("R"): + moved[pathlib.Path(os.path.normpath(root / parts[1]))] = root / parts[2] + changed = 0 + for path in pathlib.Path(crate_dir).resolve().rglob("*.rs"): + text = path.read_text(encoding="utf-8") + + def fix(match): + target = pathlib.Path(os.path.normpath(path.parent / match.group(2))) + if match.group(2).endswith(".rs") and not target.exists() and target in moved: + return f'{match.group(1)}("{relative(moved[target], path.parent)}")' + return match.group(0) + + new_text = INCLUDE.sub(fix, text) + if new_text != text: + changed += 1 + with open(path, "wb") as handle: + handle.write(new_text.encode("utf-8")) + print(f"include paths fixed in {changed} files") + + +if __name__ == "__main__": + crate = sys.argv[1] + if "--fix-includes" in sys.argv: + fix_includes(crate) + else: + apply_plan(collect(crate), pathlib.Path(crate).resolve().parents[1], "--apply" in sys.argv) diff --git a/scripts/dev/prune_unused_imports.py b/scripts/dev/prune_unused_imports.py new file mode 100644 index 00000000..cf1b4e00 --- /dev/null +++ b/scripts/dev/prune_unused_imports.py @@ -0,0 +1,142 @@ +"""Remove `#[allow(unused_imports)]` from a crate and delete the imports the compiler reports as unused (STRA-338 stage 10). + +Usage: + python scripts/dev/prune_unused_imports.py strip CRATE_DIR remove every bare `#[allow(unused_imports)]` line + python scripts/dev/prune_unused_imports.py check PACKAGE CONFIG LOG cargo check one feature set (CONFIG: cuda|sm86|all|...) + python scripts/dev/prune_unused_imports.py report LOG... count the unused-import diagnostics per file + python scripts/dev/prune_unused_imports.py fix LOG... apply the removals that every LOG agrees on + +The suggestions are the ones `cargo fix` would apply, but a span is removed only when every log (feature set) flags it in +every compilation unit that holds it, and an import that only the library's unit tests use gets `#[cfg(test)]`. +Offline refactoring aid, not part of the product. +""" +import json +import pathlib +import re +import subprocess +import sys + +ROOT = pathlib.Path(__file__).resolve().parents[2] +CONFIGS = { + "default": "", + "cuda": "--features cuda-driver", + "sm86": "--features cuda-driver,sm86", + "probe": "--features cuda-driver,expert-tier-probe", + "all": "--all-features", +} + + +def write(path, data): + with open(path, "wb") as handle: + handle.write(data) + + +def strip(crate_dir): + changed = 0 + for path in sorted(pathlib.Path(crate_dir).rglob("*.rs")): + if "target" in path.parts: + continue + rows = path.read_bytes().decode("utf-8").split("\n") + kept = [r for r in rows if r.strip() != "#[allow(unused_imports)]"] + if len(kept) != len(rows): + changed += len(rows) - len(kept) + write(path, "\n".join(kept).encode("utf-8")) + print(f"removed {changed} lines") + + +def check(package, config, log): + flags = CONFIGS.get(config, config) + packages = " ".join(f"-p {name}" for name in package.split(",")) + cmd = f"check -j1 {packages} --all-targets {flags} --message-format=json" + subprocess.run(["bash", str(ROOT / "scripts/dev/wsl-cargo.sh"), log, *cmd.split()], check=True, cwd=ROOT) + + +def diagnostics(log): + """{(file, start, end, replacement): {unit}} of the unused-import removal suggestions of one log. A unit is the + compilation that reported it: `lib`, `lib-test` or `:` (an integration test, an example). Cargo runs with + one job, so the messages of one rustc process come right before its `compiler-artifact` line, which names the unit.""" + found, buffered = {}, [] + for line in pathlib.Path(ROOT / log).read_text(encoding="utf-8", errors="replace").splitlines(): + if not line.startswith("{"): + continue + record = json.loads(line) + if record.get("reason") == "compiler-message": + message = record["message"] + if (message.get("code") or {}).get("code") == "unused_imports": + buffered.append(message) + elif record.get("reason") == "compiler-artifact": + kind = record["target"]["kind"][0] + if kind == "lib": + unit = "lib-test" if record["profile"]["test"] else "lib" + else: + unit = f"{kind}:{record['target']['name']}" + for message in buffered: + for child in message["children"]: + for span in child["spans"]: + if span.get("suggested_replacement") is not None: + key = (span["file_name"], span["byte_start"], span["byte_end"], span["suggested_replacement"]) + found.setdefault(key, set()).add(unit) + buffered = [] + return found + + +def report(logs): + per = {} + for log in logs: + for file, *_ in diagnostics(log): + per[file] = per.get(file, 0) + 1 + for file, n in sorted(per.items(), key=lambda kv: -kv[1]): + print(n, file) + print("total", sum(per.values()), "in", len(per), "files") + + +def decide(logs): + """(remove, test_only): spans every log flags. `remove`: flagged in every unit that compiles the span. + `test_only`: flagged in the library but used by the library's unit tests (needs `#[cfg(test)]`).""" + maps = [diagnostics(log) for log in logs] + keys = set.intersection(*[set(m) for m in maps]) + remove, test_only = set(), set() + for key in keys: + units = [m[key] for m in maps] + outside_lib = "/tests/" in key[0] or "/examples/" in key[0] + both = all(("lib" in u) == ("lib-test" in u) for u in units) or all(u == {"lib-test"} for u in units) + only_lib = all("lib" in u and "lib-test" not in u for u in units) + if outside_lib or both: + remove.add(key) + elif only_lib: + test_only.add(key) + return remove, test_only + + +def fix(logs): + remove, test_only = decide(logs) + edits = {} + for key in remove: + edits.setdefault(key[0], []).append((key[1], key[2], key[3])) + held = [] + for key in test_only: + text = (ROOT / key[0]).read_bytes()[key[1] : key[2]].decode() + if re.match(r"(pub(\([^)]*\))?\s+)?use\s[^{}]*;\s*$", text.strip()): + edits.setdefault(key[0], []).append((key[1], key[1], "#[cfg(test)]\n")) + else: + held.append((key[0], text.strip()[:60])) + for file, items in edits.items(): + data = (ROOT / file).read_bytes() + for start, end, replacement in sorted(items, reverse=True): + data = data[:start] + replacement.encode() + data[end:] + write(ROOT / file, data) + print(f"removed {len(remove)}, gated `#[cfg(test)]` {len(test_only) - len(held)}, left {len(held)}") + for item in held: + print(" left:", item) + + +if __name__ == "__main__": + action, args = sys.argv[1], sys.argv[2:] + if action == "strip": + strip(args[0]) + elif action == "check": + check(*args) + elif action == "report": + report(args) + elif action == "fix": + fix(args) diff --git a/scripts/dev/update_path_refs.py b/scripts/dev/update_path_refs.py new file mode 100644 index 00000000..8233c0f1 --- /dev/null +++ b/scripts/dev/update_path_refs.py @@ -0,0 +1,57 @@ +"""After `git mv` of Rust files, rewrite the repository-relative paths that tools and gates quote (STRA-338 stage 10). + +Usage: python scripts/dev/update_path_refs.py REV [--apply] + +Reads the renames of `.rs` files from `git diff -M --name-status REV` (REV is the commit before the moves) and replaces +each old path by the new one in `scripts/`, `.github/` and the JSON files at the repository root (the limits gate keys +its allowlist and baselines by file path). Docs are not touched: a document that cites a path keeps the path of its time. +Offline refactoring aid, not part of the product. +""" +import pathlib +import subprocess +import sys + +ROOT = pathlib.Path(__file__).resolve().parents[2] +EXTENSIONS = {".py", ".sh", ".json", ".yml", ".yaml", ".toml", ".ps1"} + + +def renames(rev): + out = subprocess.run(["git", "diff", "-M", "--name-status", rev], cwd=ROOT, capture_output=True, text=True).stdout + pairs = {} + for line in out.splitlines(): + parts = line.split("\t") + if parts[0].startswith("R") and parts[1].endswith(".rs"): + pairs[parts[1]] = parts[2] + return pairs + + +def targets(): + roots = [ROOT / "scripts", ROOT / ".github"] + files = [p for r in roots if r.exists() for p in r.rglob("*") if p.is_file() and p.suffix in EXTENSIONS] + return files + [p for p in ROOT.glob("*.json")] + + +def main(rev, apply): + pairs = renames(rev) + ordered = sorted(pairs, key=len, reverse=True) + touched = 0 + for path in targets(): + data = path.read_bytes() + try: + text = data.decode("utf-8") + except UnicodeDecodeError: + continue + new = text + for old in ordered: + if old in new: + new = new.replace(old, pairs[old]) + if new != text: + touched += 1 + print("updated", path.relative_to(ROOT).as_posix()) + if apply: + path.write_bytes(new.encode("utf-8")) + print(f"{len(pairs)} renamed Rust files; {touched} files quote a moved path") + + +if __name__ == "__main__": + main(sys.argv[1], "--apply" in sys.argv) diff --git a/scripts/gpu-bringup/bringup_lib.py b/scripts/gpu-bringup/bringup_lib.py index 8a9e6311..7acdbc0a 100644 --- a/scripts/gpu-bringup/bringup_lib.py +++ b/scripts/gpu-bringup/bringup_lib.py @@ -80,7 +80,7 @@ class Asset: atomic_group: Optional[str] = None # all members must be sealed together notes: List[str] = field(default_factory=list) seal_fields: bool = False # the plan entry carries seal_sha256/seal_length slots to fill - entries_from_symbols: bool = False # entry names live in crates/cuda-driver/src/mtp_original_full_symbols.rs + entries_from_symbols: bool = False # entry names live in crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols.rs flag_overrides: List[str] = field(default_factory=list) # operator overrides applied (recorded in the manifest) @property @@ -269,9 +269,9 @@ ROPE_FASTMATH_SOURCES = ("qsa_prompt_indexer", "qsa_decode_postops") # decimal-pin hits expected in the Rust tree for the committed digests (found by scanning, see seal_pins) ROPE_REPIN_EXPECT = { "qsa_prompt_indexer": {}, - "qsa_prompt_postops": {"crates/cuda-driver/src/original_verify_window_qsa.rs": 1}, - "qsa_decode_postops": {"crates/cuda-driver/src/original_verify_window_qsa.rs": 1}, - "qsa_prompt_resolver": {"crates/cuda-driver/src/original_verify_window_qsa.rs": 1}, + "qsa_prompt_postops": {"crates/cuda-driver/src/original_verify/qsa.rs": 1}, + "qsa_decode_postops": {"crates/cuda-driver/src/original_verify/qsa.rs": 1}, + "qsa_prompt_resolver": {"crates/cuda-driver/src/original_verify/qsa.rs": 1}, } # hex pins in the window plan (sealed_assets_bound) ROPE_HEX_DOC = "docs/cuda-seal-plan-additions-window.json" @@ -577,7 +577,7 @@ def fill_derived_entries(root: Path, asset: Asset) -> None: asset.entries_derived = True -SYMBOLS_FILE = "crates/cuda-driver/src/mtp_original_full_symbols.rs" +SYMBOLS_FILE = "crates/cuda-driver/src/mtp_dense_kv/original_int8/prefill/scalar/full_forward/symbols.rs" def _symbols_text(root: Path) -> str: diff --git a/scripts/gpu-bringup/extra-seal-plan.json b/scripts/gpu-bringup/extra-seal-plan.json index 606f5e92..391c3385 100644 --- a/scripts/gpu-bringup/extra-seal-plan.json +++ b/scripts/gpu-bringup/extra-seal-plan.json @@ -148,7 +148,7 @@ "atomic_group": "reseal-fastmath", "mandatory": true, "repin_expect": { - "crates/cuda-driver/src/original_verify_window_proj.rs": 1 + "crates/cuda-driver/src/original_verify/proj.rs": 1 }, "include_profile": "standard", "entries_from_symbols": true @@ -195,7 +195,7 @@ "atomic_group": "reseal-fastmath", "mandatory": true, "repin_expect": { - "crates/cuda-driver/src/original_verify_window_moe.rs": 1 + "crates/cuda-driver/src/original_verify/moe.rs": 1 }, "include_profile": "standard", "entries_from_symbols": true @@ -217,7 +217,7 @@ "atomic_group": "reseal-fastmath", "mandatory": true, "repin_expect": { - "crates/cuda-driver/src/original_verify_window_gr.rs": 1 + "crates/cuda-driver/src/original_verify/gr.rs": 1 }, "include_profile": "standard", "entries_from_symbols": true @@ -239,7 +239,7 @@ "atomic_group": "reseal-fastmath", "mandatory": true, "repin_expect": { - "crates/cuda-driver/src/original_verify_window_gr.rs": 1 + "crates/cuda-driver/src/original_verify/gr.rs": 1 }, "include_profile": "standard", "entries_from_symbols": true @@ -259,7 +259,7 @@ "atomic_group": "reseal-fastmath", "mandatory": true, "repin_expect": { - "crates/cuda-driver/src/original_verify_window_gr.rs": 1, + "crates/cuda-driver/src/original_verify/gr.rs": 1, "crates/cuda-driver/src/ple_batch_queue.rs": 1 }, "rust_fields_to_fill": { @@ -760,7 +760,7 @@ "group": "chain-window", "optional": false, "repin_expect": { - "crates/cuda-driver/src/original_verify_window_chain.rs": 1 + "crates/cuda-driver/src/original_verify/chain.rs": 1 } }, { @@ -898,7 +898,7 @@ ], "encoding": "concat_include_str", "rust_fields_to_fill": { - "crates/cuda-driver/src/original_verify/original_verify_window_down.rs": [ + "crates/cuda-driver/src/original_verify/down.rs": [ "DOWN_SUB16.sha" ] }, @@ -1021,7 +1021,7 @@ ], "encoding": "concat_include_str", "rust_fields_to_fill": { - "crates/cuda-driver/src/original_verify_window_qsa/fused_prelude.rs": [ + "crates/cuda-driver/src/original_verify/qsa/fused_prelude.rs": [ "KV_ROWS.sha" ] }, @@ -1046,7 +1046,7 @@ ], "encoding": "concat_include_str", "rust_fields_to_fill": { - "crates/cuda-driver/src/original_verify_window_qsa/fused_prelude.rs": [ + "crates/cuda-driver/src/original_verify/qsa/fused_prelude.rs": [ "INDEX_ROWS.sha" ] }, @@ -1128,7 +1128,7 @@ ], "encoding": "concat_include_str", "rust_fields_to_fill": { - "crates/cuda-driver/src/original_verify_window_ops/wait_rows.rs": [ + "crates/cuda-driver/src/original_verify/window_ops/wait_rows.rs": [ "WAIT_COPY_ROWS.sha" ] }, @@ -1177,7 +1177,7 @@ ], "encoding": "concat_include_str", "rust_fields_to_fill": { - "crates/cuda-driver/src/original_verify_window_gr/fused_down.rs": [ + "crates/cuda-driver/src/original_verify/gr/fused_down.rs": [ "GR_DOWN_FUSED.sha" ] }, @@ -1203,7 +1203,7 @@ ], "encoding": "concat_include_str", "rust_fields_to_fill": { - "crates/cuda-driver/src/original_verify_window_gr/head_chain.rs": [ + "crates/cuda-driver/src/original_verify/gr/head_chain.rs": [ "HEAD_CHAIN.sha" ] }, diff --git a/scripts/gpu-bringup/tests/test_gpu_bringup.py b/scripts/gpu-bringup/tests/test_gpu_bringup.py index 52735fa6..8ba6c6f3 100644 --- a/scripts/gpu-bringup/tests/test_gpu_bringup.py +++ b/scripts/gpu-bringup/tests/test_gpu_bringup.py @@ -334,7 +334,7 @@ class RustPinForms(unittest.TestCase): self.assertTrue(R.read_field(t, s, V), (name, s)) def test_already_sealed_consumers_are_recognised_as_resealable(self): - t = (REPO / "crates/cuda-driver/src/gdn_fused_t1.rs").read_text() + t = (REPO / "crates/cuda-driver/src/qwen_dispatch/gdn_fused_t1.rs").read_text() t2 = R.apply_field(R.apply_field(t, "FUSED_PTX_LEN", V), "FUSED_PTX_SHA256", V) self.assertEqual(R.read_plain(t2, "FUSED_PTX_LEN"), 1234) self.assertNotEqual(t, t2) @@ -611,7 +611,7 @@ class RealTreeFakeSeal(unittest.TestCase): queue = (scratch / "crates/cuda-driver/src/ple_batch_queue.rs").read_text() self.assertEqual(R.read_plain(queue, "PTX_BYTES"), ple["raw_bytes"]) self.assertEqual(R.read_plain(queue, "PTX_SHA256"), bytes.fromhex(ple["raw_sha256"])) - gr = (scratch / "crates/cuda-driver/src/original_verify_window_gr.rs").read_text() + gr = (scratch / "crates/cuda-driver/src/original_verify/gr.rs").read_text() self.assertEqual(len(R.find_decimal_pins(gr, bytes.fromhex(ple["raw_sha256"]))), 1) # idempotent on the second run of identical output code, _, err = run_quiet(S.main, ["--ptx-dir", str(out), "--root", str(scratch), "--allow-fake", "--write",