diff --git a/architecture.json b/architecture.json index eb6427da..add91ac1 100644 --- a/architecture.json +++ b/architecture.json @@ -50,7 +50,11 @@ "allow": ["^(quantize_)?q[0-9]_[0-9k]\\.rs$"] }, "_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": [], + "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"} + ], "source_patterns": [ {"id": "env-read", "regex": "\\benv::var(_os)?\\(", "why": "configuration must be parsed once into a Settings struct (S13), not read all over the code"}, {"id": "instant-now", "regex": "\\bInstant::now\\(\\)", "why": "time must come from an injected Clock in core logic (S14)"}, 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/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/batch_gr_preview.rs b/crates/cuda-driver/src/batch_gr_preview.rs index 13cebb44..982bcfab 100644 --- a/crates/cuda-driver/src/batch_gr_preview.rs +++ b/crates/cuda-driver/src/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/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_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..c03c5355 100644 --- a/crates/cuda-driver/src/closed_kernels_gpu_smoke.rs +++ b/crates/cuda-driver/src/closed_kernels_gpu_smoke.rs @@ -98,19 +98,11 @@ fn closed_gpu_s_gemv_matches_the_shim_executed_golden() { 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..addf2721 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", 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..d6cd91e4 100644 --- a/crates/cuda-driver/src/ffi.rs +++ b/crates/cuda-driver/src/ffi.rs @@ -155,17 +155,13 @@ pub(crate) mod original_file_source; 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/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_closed_queue.rs b/crates/cuda-driver/src/gdn_closed_queue.rs index 66c0d76b..0230e6d5 100644 --- a/crates/cuda-driver/src/gdn_closed_queue.rs +++ b/crates/cuda-driver/src/gdn_closed_queue.rs @@ -259,13 +259,10 @@ 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_gpu.rs b/crates/cuda-driver/src/gdn_closed_queue_gpu.rs index 82983e0a..297947ca 100644 --- a/crates/cuda-driver/src/gdn_closed_queue_gpu.rs +++ b/crates/cuda-driver/src/gdn_closed_queue_gpu.rs @@ -78,33 +78,16 @@ fn queued_gdn_row_matches_scalar_calls_orders_refusals_and_cleans_up() { 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_fused_t1.rs b/crates/cuda-driver/src/gdn_fused_t1.rs index 6917697f..5846fec5 100644 --- a/crates/cuda-driver/src/gdn_fused_t1.rs +++ b/crates/cuda-driver/src/gdn_fused_t1.rs @@ -316,13 +316,10 @@ 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; @@ -330,7 +327,5 @@ mod gdn_fused_prefix; 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_native_batch.rs b/crates/cuda-driver/src/gdn_native_batch.rs index 8623e5dd..06c88ae6 100644 --- a/crates/cuda-driver/src/gdn_native_batch.rs +++ b/crates/cuda-driver/src/gdn_native_batch.rs @@ -346,15 +346,11 @@ pub use prompt_device::{GdnPromptOptions, OriginalGdnPromptDevice, OriginalGdnPr #[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; @@ -362,5 +358,4 @@ mod context; 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_gpu.rs b/crates/cuda-driver/src/gdn_native_batch_gpu.rs index a03069fc..a525687f 100644 --- a/crates/cuda-driver/src/gdn_native_batch_gpu.rs +++ b/crates/cuda-driver/src/gdn_native_batch_gpu.rs @@ -134,41 +134,21 @@ fn run_cases(context: &Context<'_>, batch: &mut GdnPrefillBatch<'_>) -> Result<( #[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_prompt_device/original_gdn_prompt_device.rs b/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device.rs index 046d752e..ba349e89 100644 --- a/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device.rs +++ b/crates/cuda-driver/src/gdn_prompt_device/original_gdn_prompt_device.rs @@ -23,6 +23,5 @@ mod prompt_block_produce; 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/gr_batch_read.rs b/crates/cuda-driver/src/gr_batch_read.rs index b41903df..e731cff4 100644 --- a/crates/cuda-driver/src/gr_batch_read.rs +++ b/crates/cuda-driver/src/gr_batch_read.rs @@ -379,13 +379,10 @@ mod installed { } #[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_native_batch.rs b/crates/cuda-driver/src/gr_native_batch.rs index 46930a93..a878c301 100644 --- a/crates/cuda-driver/src/gr_native_batch.rs +++ b/crates/cuda-driver/src/gr_native_batch.rs @@ -48,9 +48,7 @@ pub struct GrNativeBatch<'ctx> { #[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; 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/grouped_gu21_gu23_gpu.rs b/crates/cuda-driver/src/grouped_gu21_gu23_gpu.rs index 183eeb8c..ad3854b6 100644 --- a/crates/cuda-driver/src/grouped_gu21_gu23_gpu.rs +++ b/crates/cuda-driver/src/grouped_gu21_gu23_gpu.rs @@ -104,9 +104,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_nc4_gpu.rs b/crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu.rs index 7e8f6e4b..92d5e345 100644 --- a/crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu.rs +++ b/crates/cuda-driver/src/grouped_gu21_gu23_nc4_gpu.rs @@ -53,19 +53,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/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..cbd8da88 100644 --- a/crates/cuda-driver/src/lib.rs +++ b/crates/cuda-driver/src/lib.rs @@ -263,27 +263,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 +285,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..8580fd26 100644 --- a/crates/cuda-driver/src/mmq.rs +++ b/crates/cuda-driver/src/mmq.rs @@ -299,17 +299,12 @@ 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_ffi.rs b/crates/cuda-driver/src/mmq_ffi.rs index 2dbe9709..134828dc 100644 --- a/crates/cuda-driver/src/mmq_ffi.rs +++ b/crates/cuda-driver/src/mmq_ffi.rs @@ -56,7 +56,6 @@ pub(crate) struct MmqGatherShape { #[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; diff --git a/crates/cuda-driver/src/mmq_native_resident_gpu.rs b/crates/cuda-driver/src/mmq_native_resident_gpu.rs index d9e4337d..881554cd 100644 --- a/crates/cuda-driver/src/mmq_native_resident_gpu.rs +++ b/crates/cuda-driver/src/mmq_native_resident_gpu.rs @@ -305,31 +305,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_numeric_gpu.rs b/crates/cuda-driver/src/mmq_numeric_gpu.rs index b6e7d8f2..f381744e 100644 --- a/crates/cuda-driver/src/mmq_numeric_gpu.rs +++ b/crates/cuda-driver/src/mmq_numeric_gpu.rs @@ -171,21 +171,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_original_chunk_stream.rs b/crates/cuda-driver/src/mmq_original_chunk_stream.rs index 83b8ea75..f2dc12f1 100644 --- a/crates/cuda-driver/src/mmq_original_chunk_stream.rs +++ b/crates/cuda-driver/src/mmq_original_chunk_stream.rs @@ -88,7 +88,6 @@ pub(super) struct ChunkStream { #[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; diff --git a/crates/cuda-driver/src/mmq_original_group.rs b/crates/cuda-driver/src/mmq_original_group.rs index 4925d030..5c49fea4 100644 --- a/crates/cuda-driver/src/mmq_original_group.rs +++ b/crates/cuda-driver/src/mmq_original_group.rs @@ -142,21 +142,13 @@ 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; diff --git a/crates/cuda-driver/src/mmq_original_group/copy_ring_layer.rs b/crates/cuda-driver/src/mmq_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_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_host_stage.rs b/crates/cuda-driver/src/mmq_original_host_stage.rs index 3b3a0b1f..3de9e6f1 100644 --- a/crates/cuda-driver/src/mmq_original_host_stage.rs +++ b/crates/cuda-driver/src/mmq_original_host_stage.rs @@ -81,15 +81,9 @@ 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/verify_enabled.rs b/crates/cuda-driver/src/mmq_original_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_original_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.rs b/crates/cuda-driver/src/mmq_original_ring.rs index 4e5c9baf..42f299e5 100644 --- a/crates/cuda-driver/src/mmq_original_ring.rs +++ b/crates/cuda-driver/src/mmq_original_ring.rs @@ -140,11 +140,8 @@ mod skip_expert_dma; 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; diff --git a/crates/cuda-driver/src/mmq_original_ring/original_mmq_copy_schedule.rs b/crates/cuda-driver/src/mmq_original_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_original_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_stream_all.rs b/crates/cuda-driver/src/mmq_original_stream_all.rs index 0a882aab..3e1b775c 100644 --- a/crates/cuda-driver/src/mmq_original_stream_all.rs +++ b/crates/cuda-driver/src/mmq_original_stream_all.rs @@ -33,7 +33,5 @@ struct Producer<'producer, 'layer, 'ctx> { 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_resident.rs b/crates/cuda-driver/src/mmq_resident.rs index c66b6d4f..ae64a16e 100644 --- a/crates/cuda-driver/src/mmq_resident.rs +++ b/crates/cuda-driver/src/mmq_resident.rs @@ -85,9 +85,7 @@ 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; diff --git a/crates/cuda-driver/src/mmq_resident_gpu.rs b/crates/cuda-driver/src/mmq_resident_gpu.rs index 78a86425..4df84845 100644 --- a/crates/cuda-driver/src/mmq_resident_gpu.rs +++ b/crates/cuda-driver/src/mmq_resident_gpu.rs @@ -97,55 +97,30 @@ 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/moe_group_projection.rs b/crates/cuda-driver/src/moe_group_projection.rs index d6dce209..0a67a2eb 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, diff --git a/crates/cuda-driver/src/moe_prefill_batch.rs b/crates/cuda-driver/src/moe_prefill_batch.rs index 9bf0eee8..37ce5059 100644 --- a/crates/cuda-driver/src/moe_prefill_batch.rs +++ b/crates/cuda-driver/src/moe_prefill_batch.rs @@ -239,15 +239,11 @@ 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. @@ -264,9 +260,6 @@ mod moe_batch_prefix; 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/moe_prefill_batch_gpu.rs index f77aba6c..febd6f7b 100644 --- a/crates/cuda-driver/src/moe_prefill_batch_gpu.rs +++ b/crates/cuda-driver/src/moe_prefill_batch_gpu.rs @@ -80,43 +80,26 @@ fn strata_prefill_moe_program_runs_in_order_refuses_earliest_and_cleans_up() { #[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/mtp_input_workspace.rs b/crates/cuda-driver/src/mtp_input_workspace.rs index 61df5298..a7b9e4dd 100644 --- a/crates/cuda-driver/src/mtp_input_workspace.rs +++ b/crates/cuda-driver/src/mtp_input_workspace.rs @@ -97,5 +97,4 @@ mod mtp_input_completion; 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/mtp_input_workspace_gpu.rs index 2c3bd045..d527258f 100644 --- a/crates/cuda-driver/src/mtp_input_workspace_gpu.rs +++ b/crates/cuda-driver/src/mtp_input_workspace_gpu.rs @@ -69,31 +69,14 @@ fn check_report(report: &Report, allocated: [usize; 3], poisoned: bool) { } #[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_original_full_forward.rs b/crates/cuda-driver/src/mtp_original_full_forward.rs index b931bff9..f1edae73 100644 --- a/crates/cuda-driver/src/mtp_original_full_forward.rs +++ b/crates/cuda-driver/src/mtp_original_full_forward.rs @@ -210,7 +210,6 @@ 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 { @@ -336,17 +335,11 @@ mod original_mtp_full_forward; 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; diff --git a/crates/cuda-driver/src/mtp_original_full_round.rs b/crates/cuda-driver/src/mtp_original_full_round.rs index ba6a3a62..fed06e0d 100644 --- a/crates/cuda-driver/src/mtp_original_full_round.rs +++ b/crates/cuda-driver/src/mtp_original_full_round.rs @@ -114,21 +114,15 @@ 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_original_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_original_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_symbols.rs b/crates/cuda-driver/src/mtp_original_full_symbols.rs index 365339e6..fc36f7c5 100644 --- a/crates/cuda-driver/src/mtp_original_full_symbols.rs +++ b/crates/cuda-driver/src/mtp_original_full_symbols.rs @@ -2,30 +2,19 @@ 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"]); diff --git a/crates/cuda-driver/src/mtp_original_int8.rs b/crates/cuda-driver/src/mtp_original_int8.rs index 368b3352..711cc14f 100644 --- a/crates/cuda-driver/src/mtp_original_int8.rs +++ b/crates/cuda-driver/src/mtp_original_int8.rs @@ -209,17 +209,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; diff --git a/crates/cuda-driver/src/mtp_original_prefill.rs b/crates/cuda-driver/src/mtp_original_prefill.rs index cd01fd50..34765885 100644 --- a/crates/cuda-driver/src/mtp_original_prefill.rs +++ b/crates/cuda-driver/src/mtp_original_prefill.rs @@ -172,11 +172,8 @@ pub use scalar::{ #[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; diff --git a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill.rs b/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill.rs index ac1b2c41..c79edddb 100644 --- a/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill.rs +++ b/crates/cuda-driver/src/mtp_original_prefill/original_mtp_prefill.rs @@ -24,7 +24,6 @@ mod record_operands; 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_ring_state.rs b/crates/cuda-driver/src/mtp_original_ring_state.rs index a079a4c4..5cc68ef7 100644 --- a/crates/cuda-driver/src/mtp_original_ring_state.rs +++ b/crates/cuda-driver/src/mtp_original_ring_state.rs @@ -37,13 +37,9 @@ pub(super) struct PreparedState<'ctx> { #[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_scalar_prefill/original_mtp_scalar_prefill.rs b/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill.rs index ea1666a8..b817a3eb 100644 --- a/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill.rs +++ b/crates/cuda-driver/src/mtp_original_scalar_prefill/original_mtp_scalar_prefill.rs @@ -28,8 +28,7 @@ mod original_mtp_scalar_prefill_close; 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_session.rs b/crates/cuda-driver/src/mtp_original_session.rs index 2a91ea6a..86526957 100644 --- a/crates/cuda-driver/src/mtp_original_session.rs +++ b/crates/cuda-driver/src/mtp_original_session.rs @@ -71,11 +71,8 @@ pub(crate) struct OriginalMtpSessionRopePlan<'ctx> { 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/native_head.rs b/crates/cuda-driver/src/native_head.rs index 206401a9..44f76381 100644 --- a/crates/cuda-driver/src/native_head.rs +++ b/crates/cuda-driver/src/native_head.rs @@ -23,97 +23,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_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..7a5737dc 100644 --- a/crates/cuda-driver/src/native_prompt_device.rs +++ b/crates/cuda-driver/src/native_prompt_device.rs @@ -102,25 +102,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/original_expert_stager.rs b/crates/cuda-driver/src/original_expert_stager.rs index 2394a8af..e1ac8229 100644 --- a/crates/cuda-driver/src/original_expert_stager.rs +++ b/crates/cuda-driver/src/original_expert_stager.rs @@ -124,14 +124,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_expert_stager_ffi.rs b/crates/cuda-driver/src/original_expert_stager_ffi.rs index afec2221..14b44c75 100644 --- a/crates/cuda-driver/src/original_expert_stager_ffi.rs +++ b/crates/cuda-driver/src/original_expert_stager_ffi.rs @@ -67,7 +67,6 @@ 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; 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_file_expert_source_ffi.rs b/crates/cuda-driver/src/original_file_expert_source_ffi.rs index c934caf3..f5e607af 100644 --- a/crates/cuda-driver/src/original_file_expert_source_ffi.rs +++ b/crates/cuda-driver/src/original_file_expert_source_ffi.rs @@ -50,17 +50,10 @@ 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_gpu_schedule.rs b/crates/cuda-driver/src/original_gpu_schedule.rs index b931580a..cedc5d8f 100644 --- a/crates/cuda-driver/src/original_gpu_schedule.rs +++ b/crates/cuda-driver/src/original_gpu_schedule.rs @@ -212,29 +212,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/platform.rs b/crates/cuda-driver/src/original_gpu_schedule_ffi/platform.rs index 2bf1ff75..5a0e553b 100644 --- a/crates/cuda-driver/src/original_gpu_schedule_ffi/platform.rs +++ b/crates/cuda-driver/src/original_gpu_schedule_ffi/platform.rs @@ -75,14 +75,10 @@ pub(crate) struct Api { #[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; 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_loaded.rs b/crates/cuda-driver/src/original_mtp_actor_loaded.rs index 8c071127..029f54ae 100644 --- a/crates/cuda-driver/src/original_mtp_actor_loaded.rs +++ b/crates/cuda-driver/src/original_mtp_actor_loaded.rs @@ -77,9 +77,7 @@ pub struct OriginalMtpActor<'ctx> { #[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; diff --git a/crates/cuda-driver/src/original_mtp_bank_gpu.rs b/crates/cuda-driver/src/original_mtp_bank_gpu.rs index 14708338..8bd7840e 100644 --- a/crates/cuda-driver/src/original_mtp_bank_gpu.rs +++ b/crates/cuda-driver/src/original_mtp_bank_gpu.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_round_lifecycle.rs b/crates/cuda-driver/src/original_mtp_round_lifecycle.rs index da815c17..fcceb460 100644 --- a/crates/cuda-driver/src/original_mtp_round_lifecycle.rs +++ b/crates/cuda-driver/src/original_mtp_round_lifecycle.rs @@ -84,7 +84,6 @@ struct OriginalMtpResumePlan { #[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; 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/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..2698f171 100644 --- a/crates/cuda-driver/src/original_session_state.rs +++ b/crates/cuda-driver/src/original_session_state.rs @@ -4,16 +4,13 @@ //! 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 +157,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_stream_all.rs b/crates/cuda-driver/src/original_stream_all.rs index 01321e09..7fac04d2 100644 --- a/crates/cuda-driver/src/original_stream_all.rs +++ b/crates/cuda-driver/src/original_stream_all.rs @@ -130,7 +130,5 @@ pub(crate) trait OriginalStreamAllGroupProducer<'ctx> { #[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_stream_all_options.rs b/crates/cuda-driver/src/original_stream_all/original_stream_all_options.rs index 3f534071..b1ff3d06 100644 --- a/crates/cuda-driver/src/original_stream_all/original_stream_all_options.rs +++ b/crates/cuda-driver/src/original_stream_all/original_stream_all_options.rs @@ -11,7 +11,6 @@ use super::{ #[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; diff --git a/crates/cuda-driver/src/original_stream_all/original_stream_all_options/original_expert_stager.rs b/crates/cuda-driver/src/original_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_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_verify.rs b/crates/cuda-driver/src/original_verify.rs index 90baea3b..ac48def4 100644 --- a/crates/cuda-driver/src/original_verify.rs +++ b/crates/cuda-driver/src/original_verify.rs @@ -227,7 +227,7 @@ pub use gpu_plan::{MAX_PCIE_FETCHES, OriginalVerifyGpuPlan, OriginalVerifyPcieSo #[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, @@ -257,30 +257,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/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/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_gpu_plan.rs b/crates/cuda-driver/src/original_verify_gpu_plan.rs index c2877be5..edbda930 100644 --- a/crates/cuda-driver/src/original_verify_gpu_plan.rs +++ b/crates/cuda-driver/src/original_verify_gpu_plan.rs @@ -54,9 +54,7 @@ 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; @@ -64,9 +62,8 @@ mod cpu_sink_publish_gpu_plan; 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_schedule.rs b/crates/cuda-driver/src/original_verify_schedule.rs index 8e1471b4..712fb43b 100644 --- a/crates/cuda-driver/src/original_verify_schedule.rs +++ b/crates/cuda-driver/src/original_verify_schedule.rs @@ -79,7 +79,6 @@ pub struct OriginalVerifier<'ctx, R: OriginalVerifyGraphResources<'ctx> + Origin #[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; diff --git a/crates/cuda-driver/src/original_verify_window_gr.rs b/crates/cuda-driver/src/original_verify_window_gr.rs index a4d11499..75038aca 100644 --- a/crates/cuda-driver/src/original_verify_window_gr.rs +++ b/crates/cuda-driver/src/original_verify_window_gr.rs @@ -332,23 +332,14 @@ 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; @@ -357,21 +348,15 @@ 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_moe.rs b/crates/cuda-driver/src/original_verify_window_moe.rs index 38bd890e..a51efc61 100644 --- a/crates/cuda-driver/src/original_verify_window_moe.rs +++ b/crates/cuda-driver/src/original_verify_window_moe.rs @@ -350,51 +350,30 @@ 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_ops.rs b/crates/cuda-driver/src/original_verify_window_ops.rs index 0d056b03..4dd95420 100644 --- a/crates/cuda-driver/src/original_verify_window_ops.rs +++ b/crates/cuda-driver/src/original_verify_window_ops.rs @@ -104,11 +104,10 @@ 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; @@ -128,5 +127,5 @@ mod side_shared_expert; 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/hits_combine.rs b/crates/cuda-driver/src/original_verify_window_ops/hits_combine.rs index 6a73d72a..b7546e29 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 @@ -15,7 +15,9 @@ 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. diff --git a/crates/cuda-driver/src/original_verify_window_ops/window_ops_kernels_and_pcie_plan.rs b/crates/cuda-driver/src/original_verify_window_ops/window_ops_kernels_and_pcie_plan.rs index 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_proj.rs b/crates/cuda-driver/src/original_verify_window_proj.rs index 51d4ef43..2b18a730 100644 --- a/crates/cuda-driver/src/original_verify_window_proj.rs +++ b/crates/cuda-driver/src/original_verify_window_proj.rs @@ -27,74 +27,34 @@ 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_qsa.rs b/crates/cuda-driver/src/original_verify_window_qsa.rs index e4ad99fd..5d32abe5 100644 --- a/crates/cuda-driver/src/original_verify_window_qsa.rs +++ b/crates/cuda-driver/src/original_verify_window_qsa.rs @@ -290,21 +290,13 @@ 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; 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..7b747fef 100644 --- a/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs +++ b/crates/cuda-driver/src/ple_batch_ffi/driver_backed.rs @@ -83,7 +83,6 @@ pub(crate) struct KernelModule { #[path = "driver_backed/library.rs"] mod library; -#[allow(unused_imports)] use library::check; #[path = "driver_backed/blas.rs"] mod blas; 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_closed_queue.rs b/crates/cuda-driver/src/ple_closed_queue.rs index 7e5e115e..cfb15a9d 100644 --- a/crates/cuda-driver/src/ple_closed_queue.rs +++ b/crates/cuda-driver/src/ple_closed_queue.rs @@ -82,11 +82,8 @@ mod compose_phases; 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/ple_closed_queue_compose_close.rs b/crates/cuda-driver/src/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/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/prefill_stage_gdn_gpu.rs b/crates/cuda-driver/src/prefill_stage_gdn_gpu.rs index 43381329..6337624d 100644 --- a/crates/cuda-driver/src/prefill_stage_gdn_gpu.rs +++ b/crates/cuda-driver/src/prefill_stage_gdn_gpu.rs @@ -6,26 +6,17 @@ 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"] diff --git a/crates/cuda-driver/src/prefill_stage_gdn_gpu/gdn_stage_kernels_equal.rs b/crates/cuda-driver/src/prefill_stage_gdn_gpu/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/prefill_stage_gdn_gpu/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_gr_gpu.rs b/crates/cuda-driver/src/prefill_stage_gr_gpu.rs index 8a2edaec..926d5e30 100644 --- a/crates/cuda-driver/src/prefill_stage_gr_gpu.rs +++ b/crates/cuda-driver/src/prefill_stage_gr_gpu.rs @@ -6,24 +6,16 @@ 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"] diff --git a/crates/cuda-driver/src/qsa_late_gpu.rs b/crates/cuda-driver/src/qsa_late_gpu.rs index 6e1f2985..d94d087c 100644 --- a/crates/cuda-driver/src/qsa_late_gpu.rs +++ b/crates/cuda-driver/src/qsa_late_gpu.rs @@ -115,49 +115,20 @@ 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_mapped_journal/original_qsa_mapped_prefix/qsa_mapped_journal_append_and_resolve.rs b/crates/cuda-driver/src/qsa_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_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_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_prompt_attention.rs b/crates/cuda-driver/src/qsa_prompt_attention.rs index 71802e12..6ea07cd5 100644 --- a/crates/cuda-driver/src/qsa_prompt_attention.rs +++ b/crates/cuda-driver/src/qsa_prompt_attention.rs @@ -54,5 +54,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.rs b/crates/cuda-driver/src/qsa_prompt_device.rs index 1c8e3df6..042d6960 100644 --- a/crates/cuda-driver/src/qsa_prompt_device.rs +++ b/crates/cuda-driver/src/qsa_prompt_device.rs @@ -77,13 +77,9 @@ pub use resident_device::{ #[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; diff --git a/crates/cuda-driver/src/qsa_prompt_device/device_prepare.rs b/crates/cuda-driver/src/qsa_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_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_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_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_index.rs b/crates/cuda-driver/src/qsa_prompt_index.rs index 47b1838b..566a9596 100644 --- a/crates/cuda-driver/src/qsa_prompt_index.rs +++ b/crates/cuda-driver/src/qsa_prompt_index.rs @@ -50,7 +50,6 @@ 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}; @@ -88,11 +87,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_kv.rs b/crates/cuda-driver/src/qsa_prompt_kv.rs index f858d1f7..4081c2d8 100644 --- a/crates/cuda-driver/src/qsa_prompt_kv.rs +++ b/crates/cuda-driver/src/qsa_prompt_kv.rs @@ -91,19 +91,12 @@ 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_resident_device.rs b/crates/cuda-driver/src/qsa_resident_device.rs index 44ee17ea..3e68a1c9 100644 --- a/crates/cuda-driver/src/qsa_resident_device.rs +++ b/crates/cuda-driver/src/qsa_resident_device.rs @@ -33,7 +33,6 @@ pub struct OriginalQsaResidentPromptDevice<'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; diff --git a/crates/cuda-driver/src/qsa_resident_index.rs b/crates/cuda-driver/src/qsa_resident_index.rs index a6a4fad4..aba0563d 100644 --- a/crates/cuda-driver/src/qsa_resident_index.rs +++ b/crates/cuda-driver/src/qsa_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}, @@ -63,7 +62,6 @@ 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; diff --git a/crates/cuda-driver/src/qsa_resident_index_program.rs b/crates/cuda-driver/src/qsa_resident_index_program.rs index 81e725d7..551b3344 100644 --- a/crates/cuda-driver/src/qsa_resident_index_program.rs +++ b/crates/cuda-driver/src/qsa_resident_index_program.rs @@ -11,8 +11,6 @@ mod arena_plan; 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_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/qsa_verification_commit.rs b/crates/cuda-driver/src/qsa_verification_commit.rs index 84790efd..1a93b9e8 100644 --- a/crates/cuda-driver/src/qsa_verification_commit.rs +++ b/crates/cuda-driver/src/qsa_verification_commit.rs @@ -66,9 +66,7 @@ pub struct OriginalVerifyQsaJournal<'ctx> { #[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; diff --git a/crates/cuda-driver/src/qsa_verification_commit/original_verify_qsa_journal.rs b/crates/cuda-driver/src/qsa_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_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/qwen_dispatch.rs b/crates/cuda-driver/src/qwen_dispatch.rs index 80ebc0dc..f3925c6d 100644 --- a/crates/cuda-driver/src/qwen_dispatch.rs +++ b/crates/cuda-driver/src/qwen_dispatch.rs @@ -86,30 +86,20 @@ pub(crate) mod ple_closed_queue; 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/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/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_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_shared_tail.rs b/crates/cuda-driver/src/qwen_shared_tail.rs index 1915001a..b119cd78 100644 --- a/crates/cuda-driver/src/qwen_shared_tail.rs +++ b/crates/cuda-driver/src/qwen_shared_tail.rs @@ -118,15 +118,9 @@ mod shared_expert_workspace; 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/shared_expert_workspace_compose.rs b/crates/cuda-driver/src/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_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_gpu.rs b/crates/cuda-driver/src/qwen_shared_tail_gpu.rs index 0aa6e0d8..b74b1dc8 100644 --- a/crates/cuda-driver/src/qwen_shared_tail_gpu.rs +++ b/crates/cuda-driver/src/qwen_shared_tail_gpu.rs @@ -118,37 +118,21 @@ fn assert_totals(report: &Report) { #[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/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/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..56dc727f 100644 --- a/crates/cuda-driver/src/routed_resident_queue.rs +++ b/crates/cuda-driver/src/routed_resident_queue.rs @@ -75,7 +75,5 @@ 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/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_resident_queue_gpu.rs b/crates/cuda-driver/src/routed_resident_queue_gpu.rs index aaddc3c8..22993e9f 100644 --- a/crates/cuda-driver/src/routed_resident_queue_gpu.rs +++ b/crates/cuda-driver/src/routed_resident_queue_gpu.rs @@ -57,29 +57,15 @@ fn original_first_routed_resident_pipeline_all_products_refusals_reset_and_clean #[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/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/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/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/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/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/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/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/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/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/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/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/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/gguf.rs b/crates/model-format/src/gguf.rs index 151a6bec..eef0c201 100644 --- a/crates/model-format/src/gguf.rs +++ b/crates/model-format/src/gguf.rs @@ -185,29 +185,18 @@ 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_resident.rs b/crates/model-format/src/gguf_resident.rs index 26d15eac..8838c295 100644 --- a/crates/model-format/src/gguf_resident.rs +++ b/crates/model-format/src/gguf_resident.rs @@ -191,13 +191,8 @@ 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/kar.rs b/crates/model-format/src/kar.rs index 97ae9c3e..d3de3621 100644 --- a/crates/model-format/src/kar.rs +++ b/crates/model-format/src/kar.rs @@ -269,23 +269,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 index 3654c3a8..444dd623 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; @@ -127,9 +126,6 @@ pub struct ClassTotals { #[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 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_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 fc5b33ac..2093d0cd 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/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..387ee57e 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`. 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/qwen4exp.rs b/crates/model-format/src/qwen4exp.rs index abb49986..b2137188 100644 --- a/crates/model-format/src/qwen4exp.rs +++ b/crates/model-format/src/qwen4exp.rs @@ -249,26 +249,15 @@ 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_digest_capture.rs b/crates/model-format/src/qwen4exp_digest_capture.rs index 5a6a6553..167c808c 100644 --- a/crates/model-format/src/qwen4exp_digest_capture.rs +++ b/crates/model-format/src/qwen4exp_digest_capture.rs @@ -54,21 +54,13 @@ 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_expert_source_bank.rs b/crates/model-format/src/qwen4exp_expert_source_bank.rs index 649fd78d..4619257e 100644 --- a/crates/model-format/src/qwen4exp_expert_source_bank.rs +++ b/crates/model-format/src/qwen4exp_expert_source_bank.rs @@ -84,13 +84,8 @@ pub struct ResidentExpertBankSpan { #[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/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..9c7a743c 100644 --- a/crates/native-cpu-expert/src/rust_bench_frontend.rs +++ b/crates/native-cpu-expert/src/rust_bench_frontend.rs @@ -85,48 +85,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_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.rs b/crates/npu-service/src/engine.rs index fcd1525b..dc1f6dd3 100644 --- a/crates/npu-service/src/engine.rs +++ b/crates/npu-service/src/engine.rs @@ -120,8 +120,5 @@ struct Profile { } mod weights; -#[allow(unused_imports)] pub use weights::*; mod execution; -#[allow(unused_imports)] -pub use execution::*; diff --git a/crates/obs/src/lib.rs b/crates/obs/src/lib.rs index 35065f46..a464833b 100644 --- a/crates/obs/src/lib.rs +++ b/crates/obs/src/lib.rs @@ -20,7 +20,7 @@ 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 +267,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/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/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/scripts/dev/path_to_layout.py b/scripts/dev/path_to_layout.py new file mode 100644 index 00000000..916958c3 --- /dev/null +++ b/scripts/dev/path_to_layout.py @@ -0,0 +1,152 @@ +"""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] + +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 counted `#[path]` (one that is not `tests.rs` and not the `dir/name.rs` form) gets the location its +parent's directory gives it: `/.rs`, and the directory that holds its children moves with it. Then + + * the `#[path]` of every declaration whose target is now the default location 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. + +Without --apply the plan is printed. A module that two parents declare is moved for the first parent only; a target that +already exists is reported and left. 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") +COUNTED = re.compile(r'#\[path\s*=\s*"(?![^"]*tests\.rs")(?![A-Za-z0-9_]+/[A-Za-z0-9_]+\.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 module_dir(path): + return path.parent if is_root(path) 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: + def __init__(self, src): + self.src, self.new, self.visited = src, {}, set() + self.decls = {} # old file -> [(name, mod line, path line, path value, old child)] + self.skipped = [] + + def old_child(self, old_parent, name, value): + base = old_parent.parent / value if value else module_dir(old_parent) / f"{name}.rs" + base = pathlib.Path(os.path.normpath(base)) + if base.is_file(): + return base + alt = module_dir(old_parent) / name / "mod.rs" + return alt if not value and alt.is_file() else None + + def walk(self, old, new): + if old in self.visited: + return + self.visited.add(old) + self.new[old] = new + rows = [] + for name, mod_line, path_line, value in declarations(old): + child = self.old_child(old, name, value) + if child is None: + continue + canonical = module_dir(new) / f"{name}.rs" + counted = value is not None and ".." not in value and COUNTED.search(f'#[path = "{value}"') is not None + if child in self.new: + target = self.new[child] + elif counted and child != canonical and not canonical.exists() and canonical not in self.new.values(): + target = canonical + else: + if counted and child != canonical: + self.skipped.append((str(old), name, "target exists or is taken")) + target = self.keep(old, new, child) + rows.append((name, mod_line, path_line, value, child, target)) + self.walk(child, target) + self.decls[old] = rows + + def keep(self, old, new, child): + """The child stays where it is, unless its parent's directory moved: then the directory content moves along.""" + old_dir, new_dir = module_dir(old), module_dir(new) + if old_dir != new_dir and child.is_relative_to(old_dir): + return new_dir / child.relative_to(old_dir) + return child + + +def collect(crate_dir): + src = pathlib.Path(crate_dir).resolve() / "src" + plan = Plan(src) + roots = [p for p in sorted(src.rglob("*.rs")) if is_root(p)] + for root in roots: + plan.walk(root, root) + 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(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()}") + if not apply: + print(f"{len(moves)} files would move; skipped: {plan.skipped}") + 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(): + rows = contents[old].split("\n") + drop = [] + for name, mod_line, path_line, value, child, target in plan.decls.get(old, []): + default = module_dir(new) / f"{name}.rs" + if path_line is None: + continue + if target == default: + drop.append(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 set(drop)) + if old != new: + text = INCLUDE.sub(lambda m: f'{m.group(1)}("{relative(old.parent / m.group(2), new.parent)}")', text) + with open(new, "wb") as handle: + handle.write(text.encode("utf-8")) + print(f"moved {len(moves)} files; skipped {plan.skipped}") + + +if __name__ == "__main__": + crate = sys.argv[1] + plan = collect(crate) + rewrite(plan, 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/wsl-cargo.sh b/scripts/dev/wsl-cargo.sh index ba3fe6f9..6ac656c1 100644 --- a/scripts/dev/wsl-cargo.sh +++ b/scripts/dev/wsl-cargo.sh @@ -4,4 +4,4 @@ log="$1"; shift root="$(cd "$(dirname "$0")/../.." && pwd)" wslroot="/mnt/$(echo "${root}" | sed -E 's#^/([a-zA-Z])/#\L\1/#')" -MSYS_NO_PATHCONV=1 wsl -d Ubuntu -e bash -lc "source ~/.cargo/env; cd '${wslroot}'; export CARGO_INCREMENTAL=0 CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-4} CARGO_TARGET_DIR=\$PWD/target/wsl; cargo $* > '${wslroot}/${log}' 2>&1; echo \"EXIT \$?\" >> '${wslroot}/${log}'" +MSYS_NO_PATHCONV=1 wsl -d Ubuntu -e bash -lc "source ~/.cargo/env; cd '${wslroot}'; export CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=${CARGO_PROFILE_DEV_DEBUG:-0} CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-4} CARGO_TARGET_DIR=\$PWD/target/wsl; cargo $* > '${wslroot}/${log}' 2>&1; echo \"EXIT \$?\" >> '${wslroot}/${log}'"