A high-performance inference engine for AI models
start unmetaling (#84)
uuuvn648fbf099e6e
diff --git a/crates/uzu/Cargo.toml b/crates/uzu/Cargo.tomlindex e68a2ee77..30294356c 100644--- a/crates/uzu/Cargo.toml+++ b/crates/uzu/Cargo.toml@@ -13,10 +13,6 @@ serde_json.workspace = truethiserror.workspace = truetokenizers.workspace = truempsgraph.workspace = true-objc2.workspace = true-objc2-foundation.workspace = true-metal.workspace = true-block.workspace = truebytemuck.workspace = truenum-traits.workspace = trueregex.workspace = true@@ -30,6 +26,17 @@ sysinfo.workspace = trueitertools.workspace = trueschemars.workspace = true+# metal feature requires objc2, block (for callbacks) and metal+objc2 = { workspace = true, optional = true}+objc2-foundation = { workspace = true, optional = true}+block = { workspace = true, optional = true }+metal = { workspace = true, optional = true }++# macos requires objc2 even on non-metal (but shouldn't)+[target.'cfg(target_os = "macos")'.dependencies]+objc2.workspace = true+objc2-foundation.workspace = true+[dev-dependencies]is_close.workspace = trueserde_json5.workspace = true@@ -45,7 +52,6 @@ depfile.workspace = truetempfile.workspace = trueserde.workspace = trueserde_json.workspace = true-clang-ast.workspace = truefutures.workspace = truetokio.workspace = trueblake3.workspace = true@@ -55,10 +61,13 @@ syn.workspace = trueprettyplease.workspace = trueitertools.workspace = true+# metal feature requires clang-ast+clang-ast = { workspace = true, optional = true }+[features]default = ["metal"]-metal = []+metal = ["dep:clang-ast", "dep:objc2", "dep:objc2-foundation", "dep:block", "dep:metal"]metal-nax = []tracing = []diff --git a/crates/uzu/build/main.rs b/crates/uzu/build/main.rsindex 918d1228e..ffd77191c 100644--- a/crates/uzu/build/main.rs+++ b/crates/uzu/build/main.rs@@ -3,9 +3,11 @@ use std::{env, fs, path::PathBuf};use anyhow::Context;mod common;-mod metal;mod shared_types;+#[cfg(feature = "metal")]+mod metal;+use common::compiler::Compiler;use common::envs;use futures::future::try_join_all;@@ -38,10 +40,10 @@ async fn main() -> anyhow::Result<()> {let mut compilers: Vec<Box<dyn Compiler>> = Vec::new();- if cfg!(feature = "metal") {- compilers.push(Box::new(metal::MetalCompiler::new()?));- compilers.push(Box::new(shared_types::SharedTypesCompiler::new()?));- }+ compilers.push(Box::new(shared_types::SharedTypesCompiler::new()?));++ #[cfg(feature = "metal")]+ compilers.push(Box::new(metal::MetalCompiler::new()?));try_join_all(compilers.iter().map(|c| c.build())).await?;