Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

Misc cleanup (#646)

uuuvn721aedbcfcea
diff --git a/crates/backend-uzu/build/main.rs b/crates/backend-uzu/build/main.rs
index 51828c1e2..0f3456948 100644
--- a/crates/backend-uzu/build/main.rs
+++ b/crates/backend-uzu/build/main.rs
@@ -55,7 +55,6 @@ async fn main() -> anyhow::Result<ExitCode> {
let enum_paths = EnumPaths::from_gpu_types(&gpu_types).context("Failed to build enum path map")?;
- #[allow(unused_mut)]
let mut compilers: Vec<Box<dyn Compiler>> = Vec::new();
if backend_cpu {
diff --git a/crates/backend-uzu/src/backends/common/encoder.rs b/crates/backend-uzu/src/backends/common/encoder.rs
index 99bb99c76..1710f3fc3 100644
--- a/crates/backend-uzu/src/backends/common/encoder.rs
+++ b/crates/backend-uzu/src/backends/common/encoder.rs
@@ -192,15 +192,14 @@ impl<B: Backend> Pending<B> {
pub fn wait_until_completed(self) -> Result<Completed<B>, B::Error> {
Ok(Completed {
command_buffer: self.command_buffer.wait_until_completed()?,
- allocation_pool: self.allocation_pool,
+ _allocation_pool: self.allocation_pool,
})
}
}
pub struct Completed<B: Backend> {
command_buffer: <B::CommandBuffer as CommandBuffer>::Completed,
- #[allow(unused)]
- allocation_pool: Arc<AllocationPool<B>>,
+ _allocation_pool: Arc<AllocationPool<B>>,
}
impl<B: Backend> Completed<B> {
diff --git a/crates/backend-uzu/src/backends/cpu/kernel/embedding/full_precision_embedding.rs b/crates/backend-uzu/src/backends/cpu/kernel/embedding/full_precision_embedding.rs
index 3245146fb..2920a3654 100644
--- a/crates/backend-uzu/src/backends/cpu/kernel/embedding/full_precision_embedding.rs
+++ b/crates/backend-uzu/src/backends/cpu/kernel/embedding/full_precision_embedding.rs
@@ -7,13 +7,13 @@ use crate::array::ArrayElement;
#[kernel(FullPrecisionEmbeddingLookup)]
#[variants(T, f32, f16, bf16)]
pub fn full_precision_embedding_lookup<T: ArrayElement + Float>(
- #[allow(unused)] token_ids: *const u32,
- #[allow(unused)] weights: *const T,
- #[allow(unused)] output: *mut T,
- #[allow(unused)] batch_size: u32,
- #[allow(unused)] vocab_size: u32,
- #[allow(unused)] model_dim: u32,
- #[allow(unused)] input_scale: f32,
+ token_ids: *const u32,
+ weights: *const T,
+ output: *mut T,
+ batch_size: u32,
+ vocab_size: u32,
+ model_dim: u32,
+ input_scale: f32,
) {
for batch_idx in 0..batch_size {
let token_id = unsafe { *token_ids.add(batch_idx as usize) };
diff --git a/crates/backend-uzu/src/backends/cpu/kernel/embedding/quant_embedding.rs b/crates/backend-uzu/src/backends/cpu/kernel/embedding/quant_embedding.rs
index 9d97c24e1..8a071e503 100644
--- a/crates/backend-uzu/src/backends/cpu/kernel/embedding/quant_embedding.rs
+++ b/crates/backend-uzu/src/backends/cpu/kernel/embedding/quant_embedding.rs
@@ -11,35 +11,23 @@ use crate::{
#[kernel(QuantizedEmbeddingLookup)]
#[variants(T, f32, f16, bf16)]
pub fn quantized_embedding_lookup<T: ArrayElement + Float>(
- #[allow(unused)] token_ids: *const u32,
- #[allow(unused)] weights: *const u8,
- #[allow(unused)] scales: *const T,
- #[allow(unused)]
- #[optional(quantization_method == QuantizationMethod::ScaleZeroPoint)]
- zero_points: Option<*const u8>,
- #[allow(unused)]
- #[optional(quantization_method == QuantizationMethod::ScaleBias)]
- biases: Option<*const T>,
- #[allow(unused)] output: *mut T,
+ token_ids: *const u32,
+ weights: *const u8,
+ scales: *const T,
+ #[optional(quantization_method == QuantizationMethod::ScaleZeroPoint)] zero_points: Option<*const u8>,
+ #[optional(quantization_method == QuantizationMethod::ScaleBias)] biases: Option<*const T>,
+ output: *mut T,
#[allow(unused)]
#[optional(use_hadamard)]
output_hadamard_factors: Option<*const i32>,
- #[allow(unused)] batch_size: u32,
- #[allow(unused)] vocab_size: u32,
- #[allow(unused)] model_dim: u32,
- #[allow(unused)] input_scale: f32,
- #[allow(unused)]
- #[specialize]
- group_size: u32,
- #[allow(unused)]
- #[specialize]
- quantization_mode: QuantizationMode,
- #[allow(unused)]
- #[specialize]
- quantization_method: QuantizationMethod,
- #[allow(unused)]
- #[specialize]
- use_hadamard: bool,
+ batch_size: u32,
+ vocab_size: u32,
+ model_dim: u32,
+ input_scale: f32,
+ #[specialize] group_size: u32,
+ #[specialize] quantization_mode: QuantizationMode,
+ #[specialize] quantization_method: QuantizationMethod,
+ #[specialize] use_hadamard: bool,
) {
if use_hadamard {
unimplemented!("not supported yet");
diff --git a/crates/backend-uzu/src/backends/cpu/kernel/gdn/tree_verify/out.rs b/crates/backend-uzu/src/backends/cpu/kernel/gdn/tree_verify/out.rs
index c18492cc3..7bb84ebb5 100644
--- a/crates/backend-uzu/src/backends/cpu/kernel/gdn/tree_verify/out.rs
+++ b/crates/backend-uzu/src/backends/cpu/kernel/gdn/tree_verify/out.rs
@@ -28,9 +28,7 @@ pub fn build_tree_out<QKT: ArrayElement + Float, OutputT: ArrayElement + Float>(
#[allow(unused)]
#[specialize]
transposed_h0: bool,
- #[allow(unused)]
- #[specialize]
- use_h0: bool,
+ #[specialize] use_h0: bool,
) {
let batch_size = batch_size as usize;
let tree_size = tree_size as usize;
diff --git a/crates/backend-uzu/src/backends/cpu/kernel/tensor_add_bias/tensor_add_bias.rs b/crates/backend-uzu/src/backends/cpu/kernel/tensor_add_bias/tensor_add_bias.rs
index 86da05d80..a8bf72eb0 100644
--- a/crates/backend-uzu/src/backends/cpu/kernel/tensor_add_bias/tensor_add_bias.rs
+++ b/crates/backend-uzu/src/backends/cpu/kernel/tensor_add_bias/tensor_add_bias.rs
@@ -8,16 +8,12 @@ use crate::array::ArrayElement;
#[variants(T, f32, f16, bf16)]
#[variants(BiasT, f32, f16, bf16)]
pub fn tensor_add_bias<T: ArrayElement + Float, BiasT: ArrayElement + Float>(
- #[allow(unused)]
- #[optional(!in_place)]
- input: Option<*const T>,
- #[allow(unused)] bias: *const BiasT,
- #[allow(unused)]
- #[optional(indexed)]
- bias_row_indices: Option<*const u32>,
- #[allow(unused)] output: *mut T,
- #[allow(unused)] num_cols: u32,
- #[allow(unused)] length: u32,
+ #[optional(!in_place)] input: Option<*const T>,
+ bias: *const BiasT,
+ #[optional(indexed)] bias_row_indices: Option<*const u32>,
+ output: *mut T,
+ num_cols: u32,
+ length: u32,
#[specialize] in_place: bool,
#[specialize] indexed: bool,
) {
diff --git a/crates/backend-uzu/src/backends/cpu/kernel/tensor_add_swap/tensor_add_swap.rs b/crates/backend-uzu/src/backends/cpu/kernel/tensor_add_swap/tensor_add_swap.rs
index 26f840797..5ad4589e0 100644
--- a/crates/backend-uzu/src/backends/cpu/kernel/tensor_add_swap/tensor_add_swap.rs
+++ b/crates/backend-uzu/src/backends/cpu/kernel/tensor_add_swap/tensor_add_swap.rs
@@ -7,9 +7,9 @@ use crate::array::ArrayElement;
#[kernel(TensorAddSwap)]
#[variants(T, f32, f16, bf16)]
pub fn tensor_add_swap<T: ArrayElement + Float>(
- #[allow(unused)] skip_buffer: *mut T,
- #[allow(unused)] main_buffer: *mut T,
- #[allow(unused)] length: u32,
+ skip_buffer: *mut T,
+ main_buffer: *mut T,
+ length: u32,
) {
unsafe {
for i in 0..length {
diff --git a/crates/backend-uzu/src/backends/cpu/kernel/tensor_copy/tensor_copy.rs b/crates/backend-uzu/src/backends/cpu/kernel/tensor_copy/tensor_copy.rs
index 4460b6877..ba4e982d6 100644
--- a/crates/backend-uzu/src/backends/cpu/kernel/tensor_copy/tensor_copy.rs
+++ b/crates/backend-uzu/src/backends/cpu/kernel/tensor_copy/tensor_copy.rs
@@ -7,9 +7,9 @@ use crate::array::ArrayElement;
#[kernel(TensorCopy)]
#[variants(T, f32, f16, bf16)]
pub fn tensor_copy<T: ArrayElement + Float>(
- #[allow(unused)] src_buffer: *const T,
- #[allow(unused)] dst_buffer: *mut T,
- #[allow(unused)] length: u32,
+ src_buffer: *const T,
+ dst_buffer: *mut T,
+ length: u32,
) {
unsafe {
for i in 0usize..(length as usize) {
diff --git a/crates/backend-uzu/src/encodable_block/mixer/attention/mode.rs b/crates/backend-uzu/src/encodable_block/mixer/attention/mode.rs
index bcbde99d4..cc77db861 100644
--- a/crates/backend-uzu/src/encodable_block/mixer/attention/mode.rs
+++ b/crates/backend-uzu/src/encodable_block/mixer/attention/mode.rs
@@ -214,7 +214,6 @@ impl<B: Backend> Attention<B> {
self.out_projection.encode(attention_output, batch_dim.size(), encoder)
}
- #[allow(dead_code)]
pub(crate) fn append_kv(
&self,
hidden: Allocation<B>,
diff --git a/crates/backend-uzu/src/encodable_block/mixer/attention/state.rs b/crates/backend-uzu/src/encodable_block/mixer/attention/state.rs
index 3150c43a7..3b482ae36 100644
--- a/crates/backend-uzu/src/encodable_block/mixer/attention/state.rs
+++ b/crates/backend-uzu/src/encodable_block/mixer/attention/state.rs
@@ -135,7 +135,6 @@ impl<B: Backend> AttentionState<B> {
})
}
- #[allow(dead_code)]
pub(super) fn append_full(
&mut self,
length: usize,
diff --git a/crates/backend-uzu/src/tests/mod.rs b/crates/backend-uzu/src/tests/mod.rs
index bd7370a90..4721d1dd5 100644
--- a/crates/backend-uzu/src/tests/mod.rs
+++ b/crates/backend-uzu/src/tests/mod.rs
@@ -1,5 +1,3 @@
-#![allow(dead_code)] // TODO
-
#[cfg(not(backend = "cpu"))]
compile_error!("uzu tests require cpu backend");
diff --git a/flake.lock b/flake.lock
index 05c424f67..23adf7853 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
"nodes": {
"crane": {
"locked": {
- "lastModified": 1778106249,
- "narHash": "sha256-cM/AuKy5tMhwOOQIbha8ZRRMHVfNf7cv2aljIw+qoCg=",
+ "lastModified": 1784564969,
+ "narHash": "sha256-TkTWNhJV/8Wk3czlbz4bwHZkFCaCHPsOy+oJe4PUiXg=",
"owner": "ipetkov",
"repo": "crane",
- "rev": "6d015ea29630b7ad2402841386da2cb617a470a7",
+ "rev": "7930f6c291de6f83c257839d434592aa085f290a",
"type": "github"
},
"original": {
@@ -35,11 +35,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1777954456,
- "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=",
+ "lastModified": 1784796856,
+ "narHash": "sha256-wWFrV5/Qbm+lyt5x20E/bSbfJiGKMo4RCxZV8cl/WZI=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1",
+ "rev": "e2587caef70cea85dd97d7daab492899902dbf5d",
"type": "github"
},
"original": {
@@ -64,11 +64,11 @@
]
},
"locked": {
- "lastModified": 1778469574,
- "narHash": "sha256-NTZzJ7xJvMXOonYqut3WLUhryeZj5QuuL0ANcqS7d30=",
+ "lastModified": 1785044261,
+ "narHash": "sha256-ehF/c4fLdgmNu7YXEClnmwhoBYddhYIVoSQpsZoorC4=",
"owner": "oxalica",
"repo": "rust-overlay",
- "rev": "4852a8aa041c94af55e136cde5b8b6d42c3563e8",
+ "rev": "fe2124391e739e7b3e8720cd8a73f06edd0aceba",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index f4345dc15..c8f7239c4 100644
--- a/flake.nix
+++ b/flake.nix
@@ -72,6 +72,7 @@
rustToolchain
cargo-deny
cargo-nextest
+ cargo-hack
cargo-expand
cargo-flamegraph
cargo-show-asm