Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

workspace dependencies

Aleksei Savin12749cd9d1df
diff --git a/.gitignore b/.gitignore
index 40031b7d5..69b6e8ae6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,3 +35,4 @@ external/
crates/uzu/examples/quick_chat.rs
.cursor
tools
+.claude
diff --git a/Cargo.lock b/Cargo.lock
index b0e8a95a1..d5f40d829 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2114,7 +2114,7 @@ dependencies = [
[[package]]
name = "matmul-benchmark"
-version = "0.1.0"
+version = "0.1.7"
dependencies = [
"autocxx",
"autocxx-build",
diff --git a/Cargo.toml b/Cargo.toml
index e772382bd..69e611aca 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,5 +15,60 @@ license = "MIT"
authors = ["Mirai Tech <https://trymirai.com>"]
repository = "https://github.com/trymirai/uzu"
+[workspace.dependencies]
+benchmarks = { path = "crates/benchmarks" }
+uzu = { path = "crates/uzu" }
+xgrammar = { package = "xgrammar-rs", version = "0.1.29", features = ["hf"] }
+half = { version = "2.6.0", features = ["bytemuck", "num-traits"] }
+ndarray = "0.17.1"
+serde = { version = "1.0.219", features = ["derive"] }
+serde_json = "1.0.148"
+thiserror = "2.0.16"
+tokenizers = "0.22.2"
+mpsgraph = "0.2.0"
+objc2 = "0.6.2"
+objc2-foundation = "0.3.1"
+metal = "0.32.0"
+block = "0.1.6"
+bytemuck = "1.23.2"
+num-traits = "0.2.19"
+regex = "1.11.2"
+libc = "0.2.175"
+bitflags = "2.9.4"
+minijinja = "2.12.0"
+minijinja-contrib = { version = "2.12.0", features = ["pycompat"] }
+clap = { version = "4.5.47", features = ["derive"] }
+rand = "0.9.2"
+sysinfo = "0.37.2"
+itertools = "0.14.0"
+schemars = { version = "1.0.5", features = ["derive"] }
+is_close = "0.1.3"
+serde_json5 = "0.2.1"
+anyhow = "1.0.100"
+bindgen = "0.72.1"
+walkdir = "2.5.0"
+depfile = "0.1.1"
+tempfile = "3.24.0"
+clang-ast = "0.1.35"
+futures = "0.3"
+tokio = { version = "1.48.0", features = ["full"] }
+blake3 = "1.8.2"
+quote = "1.0.42"
+proc-macro2 = "1.0.104"
+syn = "2.0.113"
+prettyplease = "0.2.37"
+mach2 = "0.6.0"
+ctrlc = "3.4.1"
+indicatif = "0.18.0"
+inquire = "0.7.5"
+console = "0.16.0"
+rocket = { version = "0.5.1", features = ["json"] }
+uuid = { version = "1.17.0", features = ["v4"] }
+comfy-table = "7.2.1"
+autocxx = "0.30.0"
+cxx = "1.0.187"
+cmake = "0.1.57"
+autocxx-build = "0.30.0"
+
[profile.release]
lto = "thin"
diff --git a/crates/benchmarks/Cargo.toml b/crates/benchmarks/Cargo.toml
index 6c45b5944..7501b6c94 100644
--- a/crates/benchmarks/Cargo.toml
+++ b/crates/benchmarks/Cargo.toml
@@ -1,15 +1,15 @@
[package]
name = "benchmarks"
version.workspace = true
-edition = "2024"
+edition.workspace = true
[dependencies]
-uzu = { path = "../uzu" }
-serde = { version = "1.0.219", features = ["derive"] }
-serde_json = "1.0.148"
-sysinfo = "0.37.2"
-libc = "0.2.178"
-mach2 = "0.6.0"
-half = { version = "2.6.0", features = ["bytemuck", "num-traits"] }
-objc2 = "0.6.2"
-metal = "0.32.0"
+metal.workspace = true
+uzu.workspace = true
+serde.workspace = true
+serde_json.workspace = true
+sysinfo.workspace = true
+libc.workspace = true
+mach2.workspace = true
+half.workspace = true
+objc2.workspace = true
diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml
index 371f2cef1..21c8a693f 100644
--- a/crates/cli/Cargo.toml
+++ b/crates/cli/Cargo.toml
@@ -1,23 +1,23 @@
[package]
name = "cli"
version.workspace = true
-edition = "2024"
+edition.workspace = true
[[bin]]
-name = "uzu_cli"
+name = "cli"
path = "src/main.rs"
[dependencies]
-clap = { version = "4.5.39", features = ["derive"] }
-uzu = { path = "../uzu" }
-benchmarks = { path = "../benchmarks" }
-ctrlc = "3.4.1"
-indicatif = "0.18.0"
-inquire = "0.7.5"
-console = "0.16.0"
-rocket = { version = "0.5.1", features = ["json"] }
-tokio = { version = "1.45.1", features = ["full"] }
-serde = { version = "1.0.219", features = ["derive"] }
-serde_json = "1.0.148"
-uuid = { version = "1.17.0", features = ["v4"] }
-comfy-table = "7.2.1"
+clap.workspace = true
+uzu.workspace = true
+benchmarks.workspace = true
+ctrlc.workspace = true
+indicatif.workspace = true
+inquire.workspace = true
+console.workspace = true
+rocket.workspace = true
+tokio.workspace = true
+serde.workspace = true
+serde_json.workspace = true
+uuid.workspace = true
+comfy-table.workspace = true
diff --git a/crates/matmul-benchmark/Cargo.toml b/crates/matmul-benchmark/Cargo.toml
index 98d7dbd3c..fb32521d5 100644
--- a/crates/matmul-benchmark/Cargo.toml
+++ b/crates/matmul-benchmark/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "matmul-benchmark"
-version = "0.1.0"
-edition = "2024"
+version.workspace = true
+edition.workspace = true
build = "build.rs"
links = "mlx"
@@ -10,17 +10,17 @@ name = "matmul-benchmark"
path = "src/main.rs"
[dependencies]
-autocxx = "0.30.0"
-cxx = "1.0.187"
-uzu = { path = "../uzu" }
-metal = "0.32.0"
-mpsgraph = "0.2.0"
-half = "2.4"
-objc2 = "0.6"
-serde = { version = "1.0", features = ["derive"] }
-serde_json = "1.0"
+autocxx.workspace = true
+cxx.workspace = true
+uzu = { workspace = true }
+metal.workspace = true
+mpsgraph.workspace = true
+half.workspace = true
+objc2.workspace = true
+serde.workspace = true
+serde_json.workspace = true
[build-dependencies]
-walkdir = "2.5.0"
-cmake = "0.1.57"
-autocxx-build = "0.30.0"
+walkdir.workspace = true
+cmake.workspace = true
+autocxx-build.workspace = true
diff --git a/crates/matmul-benchmark/src/main.rs b/crates/matmul-benchmark/src/main.rs
index 716629e68..576878b5e 100644
--- a/crates/matmul-benchmark/src/main.rs
+++ b/crates/matmul-benchmark/src/main.rs
@@ -507,8 +507,7 @@ fn benchmark_uzu(
},
}
- let mut kernel = MatmulKernel::new(ctx, dtype.to_uzu(), false, true)
- .expect("kernel new");
+ let mut kernel = MatmulKernel::new(dtype.to_uzu()).expect("kernel new");
for _ in 0..warmup_iters {
let cb = ctx.command_queue.new_command_buffer().to_owned();
@@ -523,6 +522,7 @@ fn benchmark_uzu(
b: &b_buf,
c: None,
d: &d_buf,
+ bias: None,
batch: m as i32,
input_dim: k as i32,
output_dim: n as i32,
@@ -532,8 +532,9 @@ fn benchmark_uzu(
batch_count: 1,
alpha: 1.0,
beta: 0.0,
+ transpose_a: false,
+ transpose_b: true,
},
- None,
)
.expect("encode");
enc.end_encoding();
@@ -555,6 +556,7 @@ fn benchmark_uzu(
b: &b_buf,
c: None,
d: &d_buf,
+ bias: None,
batch: m as i32,
input_dim: k as i32,
output_dim: n as i32,
@@ -564,8 +566,9 @@ fn benchmark_uzu(
batch_count: 1,
alpha: 1.0,
beta: 0.0,
+ transpose_a: false,
+ transpose_b: true,
},
- None,
)
.expect("encode");
enc.end_encoding();
@@ -782,8 +785,7 @@ fn run_accuracy_test_f16(
.device
.new_buffer((m * n * 2) as u64, MTLResourceOptions::StorageModeShared);
- let mut kernel =
- MatmulKernel::new(ctx, DataType::F16, false, true).unwrap();
+ let mut kernel = MatmulKernel::new(DataType::F16).unwrap();
let cb = ctx.command_queue.new_command_buffer().to_owned();
let enc = cb.new_compute_command_encoder();
kernel
@@ -796,6 +798,7 @@ fn run_accuracy_test_f16(
b: &b_buf,
c: None,
d: &d_buf,
+ bias: None,
batch: m as i32,
input_dim: k as i32,
output_dim: n as i32,
@@ -805,8 +808,9 @@ fn run_accuracy_test_f16(
batch_count: 1,
alpha: 1.0,
beta: 0.0,
+ transpose_a: false,
+ transpose_b: true,
},
- None,
)
.unwrap();
enc.end_encoding();
@@ -848,8 +852,7 @@ fn run_accuracy_test_f32(
.device
.new_buffer((m * n * 4) as u64, MTLResourceOptions::StorageModeShared);
- let mut kernel =
- MatmulKernel::new(ctx, DataType::F32, false, true).unwrap();
+ let mut kernel = MatmulKernel::new(DataType::F32).unwrap();
let cb = ctx.command_queue.new_command_buffer().to_owned();
let enc = cb.new_compute_command_encoder();
kernel
@@ -862,6 +865,7 @@ fn run_accuracy_test_f32(
b: &b_buf,
c: None,
d: &d_buf,
+ bias: None,
batch: m as i32,
input_dim: k as i32,
output_dim: n as i32,
@@ -871,8 +875,9 @@ fn run_accuracy_test_f32(
batch_count: 1,
alpha: 1.0,
beta: 0.0,
+ transpose_a: false,
+ transpose_b: true,
},
- None,
)
.unwrap();
enc.end_encoding();
@@ -925,8 +930,7 @@ fn run_accuracy_test_bf16(
.device
.new_buffer((m * n * 2) as u64, MTLResourceOptions::StorageModeShared);
- let mut kernel =
- MatmulKernel::new(ctx, DataType::BF16, false, true).unwrap();
+ let mut kernel = MatmulKernel::new(DataType::BF16).unwrap();
let cb = ctx.command_queue.new_command_buffer().to_owned();
let enc = cb.new_compute_command_encoder();
kernel
@@ -939,6 +943,7 @@ fn run_accuracy_test_bf16(
b: &b_buf,
c: None,
d: &d_buf,
+ bias: None,
batch: m as i32,
input_dim: k as i32,
output_dim: n as i32,
@@ -948,8 +953,9 @@ fn run_accuracy_test_bf16(
batch_count: 1,
alpha: 1.0,
beta: 0.0,
+ transpose_a: false,
+ transpose_b: true,
},
- None,
)
.unwrap();
enc.end_encoding();
diff --git a/crates/uzu/Cargo.toml b/crates/uzu/Cargo.toml
index d3aa2e285..7f22f6758 100644
--- a/crates/uzu/Cargo.toml
+++ b/crates/uzu/Cargo.toml
@@ -1,58 +1,58 @@
[package]
name = "uzu"
version.workspace = true
-edition = "2024"
+edition.workspace = true
build = "build/main.rs"
[dependencies]
-xgrammar = { package = "xgrammar-rs", version = "0.1.29", features = ["hf"] }
-half = { version = "2.6.0", features = ["bytemuck", "num-traits"] }
-ndarray = "0.17.1"
-serde = { version = "1.0.219", features = ["derive"] }
-serde_json = "1.0.148"
-thiserror = "2.0.16"
-tokenizers = "0.22.2"
-mpsgraph = "0.2.0"
-objc2 = "0.6.2"
-objc2-foundation = "0.3.1"
-metal = "0.32.0"
-block = "0.1.6"
-bytemuck = "1.23.2"
-num-traits = "0.2.19"
-regex = "1.11.2"
-libc = "0.2.175"
-bitflags = "2.9.4"
-minijinja = "2.12.0"
-minijinja-contrib = { version = "2.12.0", features = ["pycompat"] }
-clap = { version = "4.5.47", features = ["derive"] }
-rand = "0.9.2"
-sysinfo = "0.37.2"
-itertools = "0.14.0"
-schemars = "1.0.5"
+xgrammar.workspace = true
+half.workspace = true
+ndarray.workspace = true
+serde.workspace = true
+serde_json.workspace = true
+thiserror.workspace = true
+tokenizers.workspace = true
+mpsgraph.workspace = true
+objc2.workspace = true
+objc2-foundation.workspace = true
+metal.workspace = true
+block.workspace = true
+bytemuck.workspace = true
+num-traits.workspace = true
+regex.workspace = true
+libc.workspace = true
+bitflags.workspace = true
+minijinja.workspace = true
+minijinja-contrib.workspace = true
+clap.workspace = true
+rand.workspace = true
+sysinfo.workspace = true
+itertools.workspace = true
+schemars.workspace = true
[dev-dependencies]
-is_close = "0.1.3"
-serde_json5 = "0.2.1"
-schemars = { version = "1.0.5", features = ["derive"] }
-mpsgraph = "0.2.0"
+is_close.workspace = true
+serde_json5.workspace = true
+schemars.workspace = true
+mpsgraph.workspace = true
[build-dependencies]
-anyhow = "1.0.100"
-bindgen = "0.72.1"
-walkdir = "2.5.0"
-depfile = "0.1.1"
-tempfile = "3.24.0"
-serde = { version = "1.0.219", features = ["derive"] }
-serde_json = "1.0.143"
-clang-ast = "0.1.35"
-futures = "0.3"
-tokio = { version = "1.48.0", features = ["full"] }
-blake3 = "1.8.2"
-quote = "1.0.42"
-proc-macro2 = "1.0.104"
-syn = "2.0.113"
-prettyplease = "0.2.37"
-itertools = "0.14.0"
+anyhow.workspace = true
+bindgen.workspace = true
+walkdir.workspace = true
+depfile.workspace = true
+tempfile.workspace = true
+serde.workspace = true
+serde_json.workspace = true
+clang-ast.workspace = true
+futures.workspace = true
+tokio.workspace = true
+blake3.workspace = true
+quote.workspace = true
+proc-macro2.workspace = true
+syn.workspace = true
+prettyplease.workspace = true
+itertools.workspace = true
[features]
build-debug = []