A high-performance inference engine for AI models
Remove wasi (now we have browser wasm) (#1037)
uuuvn49d28d5d9c34
diff --git a/.cargo/config.toml b/.cargo/config.tomlindex 099825d3e..71dd91492 100644--- a/.cargo/config.toml+++ b/.cargo/config.toml@@ -3,11 +3,3 @@ tools = "run --quiet -p cli-tools --"[env]RUST_TEST_THREADS = "1"--[target.wasm32-wasip1-threads]-# threads=y — wasmtime need this flag to use threads-# --dir /::/ — allow wasmtime to read current directory-runner = ["wasmtime", "-W", "threads=y", "-S", "threads=y", "--dir", "/::/", "--"]--# --max-memory — default max memory = 1Gb-rustflags = ["-C", "link-arg=--max-memory=4294967296"]diff --git a/.config/platforms.toml b/.config/platforms.tomlindex fd545dbfc..c37eccd02 100644--- a/.config/platforms.toml+++ b/.config/platforms.toml@@ -76,12 +76,6 @@ aliases = ["wasm"]capabilities_supported = []capabilities_default = []-[targets."wasm32-wasip1-threads"]-backend = "cpu"-aliases = ["wasi"]-capabilities_supported = []-capabilities_default = []-[languages.rust]targets = ["aarch64-apple-darwin",@@ -89,7 +83,6 @@ targets = ["aarch64-apple-ios","aarch64-apple-ios-sim","aarch64-apple-ios-macabi",- "wasm32-wasip1-threads",]tools = []bindings = []diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 570c11a54..f69841370 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -82,14 +82,11 @@ jobs:features: ['uzu-engine/webgpu', 'uzu-engine/cpu', 'uzu-engine/grammar']- host: 'linux'crates: ['cli']- - host: 'linux'- target: 'wasm32-wasip1-threads'- nightly: true- crates: ['uzu']- tests: 'kernels'- host: 'linux'target: 'wasm32-unknown-unknown'- crates: ['kiban']+ crates: ['uzu']+ no-default-features: true+ features: ['uzu/backend-webgpu']env:CARGO_ENCODED_RUSTFLAGS: "-Dwarnings"@@ -105,7 +102,7 @@ jobs:- name: Build cratesrun: |- cargo +${{ matrix.nightly && 'nightly' || 'stable' }} build \+ cargo +stable build \${{ matrix.target && format('--target {0}', matrix.target) || '' }} \${{ matrix.no-default-features && '--no-default-features' || '' }} \${{ matrix.features && format('--features {0}', join(matrix.features, ',')) || '' }} \@@ -127,8 +124,7 @@ jobs:${{ matrix.target && format('--target {0}', matrix.target) || '' }} \${{ matrix.no-default-features && '--no-default-features' || '' }} \${{ matrix.features && format('--features {0}', join(matrix.features, ',')) || '' }} \- ${{ matrix.tests != 'kernels' && matrix.crates && format('-p {0}', join(matrix.crates, ' -p ')) || '' }} \- ${{ matrix.tests == 'kernels' && '-p uzu-engine backends::common::kernel::tests --lib' || '' }}+ ${{ matrix.crates && format('-p {0}', join(matrix.crates, ' -p ')) || '' }}validate-bindings:name: validate-bindingsdiff --git a/Cargo.lock b/Cargo.lockindex 4a45bade8..2e9f6ab89 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1418,6 +1418,7 @@ version = "8.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b96a46ad395a5e00676eddaca4a45ed78b29c08be5a878d35e4b071c625637dd"dependencies = [+ "crossterm","unicode-segmentation","unicode-width 0.2.2",]diff --git a/Cargo.toml b/Cargo.tomlindex fcabe7ab3..2b1de7446 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -130,12 +130,12 @@ rhai = "1.26.1"indicatif = "0.18.6"rocket = { version = "0.5.1", features = ["json"] }uuid = { version = "1.28.0", features = ["serde", "v4", "v5"] }-comfy-table = { version = "8.0.1", default-features = false }+comfy-table = "8.0.1"test-tag = "0.1.6"rstest = "0.27.0"wiremock = "0.6.5"-proptest = { version = "1.12.0", default-features = false, features = ["std"] }-criterion = { version = "0.8.2", default-features = false }+proptest = "1.12.0"+criterion = "0.8.2"libtest-mimic = "0.8.2"indexmap = { version = "2.14.2", features = ["serde"] }tracing = "0.1.44"diff --git a/README.md b/README.mdindex ae3710609..3b619ae7f 100644--- a/README.md+++ b/README.md@@ -1430,7 +1430,6 @@ It supports:- `aarch64-pc-windows-msvc` _(in progress)_- `aarch64-unknown-linux-gnu` _(in progress)_- `wasm32-unknown-unknown` _(in progress)_- - `wasm32-wasip1-threads` _(in progress)_- `x86_64-apple-darwin`- `x86_64-pc-windows-msvc` _(in progress)_- `x86_64-unknown-linux-gnu` _(in progress)_diff --git a/crates/legacy/kiban/Cargo.toml b/crates/legacy/kiban/Cargo.tomlindex c569ca74f..dda169bed 100644--- a/crates/legacy/kiban/Cargo.toml+++ b/crates/legacy/kiban/Cargo.toml@@ -14,7 +14,7 @@ async-trait.workspace = truefutures-util.workspace = true[target.'cfg(target_family = "wasm")'.dependencies]-tokio = { workspace = true, features = ["sync", "time"] }+tokio = { workspace = true, features = ["sync"] }wasm-bindgen.workspace = truewasm-bindgen-futures.workspace = trueweb-sys = { workspace = true, features = [diff --git a/crates/legacy/kiban/src/rt/send_future.rs b/crates/legacy/kiban/src/rt/send_future.rsindex 3331d4245..a3256db9a 100644--- a/crates/legacy/kiban/src/rt/send_future.rs+++ b/crates/legacy/kiban/src/rt/send_future.rs@@ -23,5 +23,5 @@ impl<F: Future> Future for MakeSendFuture<F> {}}-#[cfg(all(target_arch = "wasm32", target_os = "unknown", not(target_feature = "atomics")))]+#[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))]unsafe impl<F> Send for MakeSendFuture<F> {}diff --git a/crates/legacy/kiban/src/time/instant.rs b/crates/legacy/kiban/src/time/instant.rsindex 31703a5c2..1513c9c73 100644--- a/crates/legacy/kiban/src/time/instant.rs+++ b/crates/legacy/kiban/src/time/instant.rs@@ -1,5 +1,5 @@-#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]+#[cfg(not(target_family = "wasm"))]pub type Instant = std::time::Instant;-#[cfg(all(target_family = "wasm", target_os = "unknown"))]+#[cfg(target_family = "wasm")]pub type Instant = web_time::Instant;diff --git a/crates/legacy/kiban/src/time/sleep.rs b/crates/legacy/kiban/src/time/sleep.rsindex 20e7149ed..df284101a 100644--- a/crates/legacy/kiban/src/time/sleep.rs+++ b/crates/legacy/kiban/src/time/sleep.rs@@ -1,11 +1,11 @@use std::time::Duration;-#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]+#[cfg(not(target_family = "wasm"))]pub async fn sleep(duration: Duration) {tokio::time::sleep(duration).await}-#[cfg(all(target_family = "wasm", target_os = "unknown"))]+#[cfg(target_family = "wasm")]pub async fn sleep(duration: Duration) {crate::time::sleep_wasm::sleep(duration).await}diff --git a/crates/legacy/kiban/src/time/system_time.rs b/crates/legacy/kiban/src/time/system_time.rsindex e49e787fe..061aee14f 100644--- a/crates/legacy/kiban/src/time/system_time.rs+++ b/crates/legacy/kiban/src/time/system_time.rs@@ -1,5 +1,5 @@-#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]+#[cfg(not(target_family = "wasm"))]pub type SystemTime = std::time::SystemTime;-#[cfg(all(target_family = "wasm", target_os = "unknown"))]+#[cfg(target_family = "wasm")]pub type SystemTime = web_time::SystemTime;diff --git a/crates/legacy/nagare/src/chat/mod.rs b/crates/legacy/nagare/src/chat/mod.rsindex d841b86f4..13eba202f 100644--- a/crates/legacy/nagare/src/chat/mod.rs+++ b/crates/legacy/nagare/src/chat/mod.rs@@ -2,7 +2,7 @@mod bindings_napi;#[cfg(feature = "bindings-pyo3")]mod bindings_pyo3;-#[cfg(all(feature = "bindings-wasm", target_arch = "wasm32", target_os = "unknown"))]+#[cfg(all(feature = "bindings-wasm", target_arch = "wasm32"))]mod bindings_wasm;mod chat_instance;mod error;diff --git a/crates/legacy/uzu/Cargo.toml b/crates/legacy/uzu/Cargo.tomlindex 23fe8dfc5..712060656 100644--- a/crates/legacy/uzu/Cargo.toml+++ b/crates/legacy/uzu/Cargo.toml@@ -82,8 +82,6 @@ wasm-bindgen = { workspace = true, optional = true }serde-wasm-bindgen = { workspace = true, optional = true }wasm-bindgen-futures = { workspace = true, optional = true }tsify = { workspace = true, optional = true }--[target.'cfg(not(target_os = "wasi"))'.dependencies]nagare.workspace = truehanashi.workspace = truebon.workspace = true@@ -104,7 +102,7 @@ tokenizers.workspace = truerand.workspace = truetracing.workspace = true-[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]+[target.'cfg(target_family = "wasm")'.dependencies]getrandom = { workspace = true, features = ["wasm_js"] }uuid = { workspace = true, features = ["js"] }wasm-bindgen.workspace = truediff --git a/crates/legacy/uzu/src/lib.rs b/crates/legacy/uzu/src/lib.rsindex 244d6f222..b5599982c 100644--- a/crates/legacy/uzu/src/lib.rs+++ b/crates/legacy/uzu/src/lib.rs@@ -41,21 +41,14 @@ inventory::submit! {}}-#[cfg(not(target_os = "wasi"))]pub mod device;-#[cfg(not(target_os = "wasi"))]pub mod engine;-#[cfg(not(target_os = "wasi"))]pub mod helpers;#[cfg(not(target_family = "wasm"))]pub mod logs;#[cfg(not(target_family = "wasm"))]pub mod player;-#[cfg(not(target_os = "wasi"))]pub mod registry;-#[cfg(not(target_os = "wasi"))]pub mod storage;-#[cfg(not(target_os = "wasi"))]pub use nagare as session;-#[cfg(not(target_os = "wasi"))]pub use shoji::*;diff --git a/crates/uzu-engine/Cargo.toml b/crates/uzu-engine/Cargo.tomlindex 5aa9ecd3c..82d69df85 100644--- a/crates/uzu-engine/Cargo.toml+++ b/crates/uzu-engine/Cargo.toml@@ -99,8 +99,6 @@ metal = { workspace = true, optional = true }[target.'cfg(target_arch = "wasm32")'.dependencies]tokenizers = { workspace = true, features = ["unstable_wasm"] }wgpu = { workspace = true, optional = true, features = ["fragile-send-sync-non-atomic-wasm"] }--[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]wasm-bindgen.workspace = truewasm-bindgen-futures.workspace = trueweb-sys = { workspace = true, features = [@@ -117,11 +115,9 @@ web-sys = { workspace = true, features = [[target.'cfg(not(target_arch = "wasm32"))'.dependencies]xgrammar = { workspace = true, optional = true }schemars = { workspace = true, optional = true }--[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dependencies]async-fs.workspace = true-[dev-dependencies]+[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]test-tag.workspace = trueproptest.workspace = truecriterion.workspace = true@@ -131,6 +127,8 @@ rand_distr.workspace = trueis_close.workspace = truendarray.workspace = truerstest.workspace = true+tokio = { workspace = true, features = ["full"] }+uzu.workspace = true[target.'cfg(target_os = "ios")'.dev-dependencies]objc2.workspace = true@@ -141,9 +139,3 @@ objc2-foundation.workspace = true# concern, so on-device (iOS) builds skip it (see metrics.rs stub).[target.'cfg(target_os = "macos")'.dev-dependencies]keisoku.workspace = true--[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]-tokio = { workspace = true, features = ["full"] }-uzu.workspace = true-criterion = { workspace = true, default-features = true }-proptest = { workspace = true, default-features = true }diff --git a/crates/uzu-engine/src/backends/common/kernel/activation_transform.rs b/crates/uzu-engine/src/backends/common/kernel/activation_transform.rsindex d5ff4cc24..268e1b450 100644--- a/crates/uzu-engine/src/backends/common/kernel/activation_transform.rs+++ b/crates/uzu-engine/src/backends/common/kernel/activation_transform.rs@@ -111,6 +111,7 @@ impl<B: Backend> ActivationTransform<B> {Self::new(context, data_type, None, ActivationTransformOp::InputRht, in_place, ActivationFormat::Bf16)}+ #[cfg(any(backend = "cpu", backend = "metal"))]pub fn output_rht(context: &B::Context,data_type: DataType,diff --git a/crates/uzu-engine/src/utils/mod.rs b/crates/uzu-engine/src/utils/mod.rsindex 1c94393d8..1b57f05fc 100644--- a/crates/uzu-engine/src/utils/mod.rs+++ b/crates/uzu-engine/src/utils/mod.rs@@ -1,6 +1,6 @@pub mod dispatch_dtype;pub mod downcast;-#[cfg_attr(all(target_arch = "wasm32", target_os = "unknown"), path = "wasm_file.rs")]+#[cfg_attr(target_arch = "wasm32", path = "wasm_file.rs")]pub mod file;pub mod maybe_mut;#[cfg(any(backend = "cpu", backend = "webgpu"))]@@ -9,5 +9,5 @@ pub mod size_for_shape;pub mod strict_serde;pub mod timestamps;pub mod version;-#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]+#[cfg(target_arch = "wasm32")]pub mod wasm_future;diff --git a/crates/uzu-engine/unit/common/mod.rs b/crates/uzu-engine/unit/common/mod.rsindex 2448a1500..1e690cbdd 100644--- a/crates/uzu-engine/unit/common/mod.rs+++ b/crates/uzu-engine/unit/common/mod.rs@@ -7,6 +7,7 @@ pub mod harness;pub mod helpers;pub mod matmul;pub mod metrics;+#[cfg(not(target_arch = "wasm32"))]pub mod path;pub mod perf;pub mod proptest;@@ -14,5 +15,6 @@ pub mod util;#[path = "../bench_cold_pool_test.rs"]mod bench_cold_pool_test;+#[cfg(not(target_arch = "wasm32"))]#[path = "../session/model_loading_bench.rs"]mod model_loading_bench;diff --git a/crates/uzu-engine/unit/common/path.rs b/crates/uzu-engine/unit/common/path.rsindex b59a3fcbf..70335c292 100644--- a/crates/uzu-engine/unit/common/path.rs+++ b/crates/uzu-engine/unit/common/path.rs@@ -1,17 +1,10 @@use std::{path::PathBuf, sync::OnceLock};-const MODEL_FILE_NAME: &str = "model.safetensors";-pub fn get_test_model_path() -> PathBuf {static PATH: OnceLock<PathBuf> = OnceLock::new();PATH.get_or_init(resolve_test_model_path).clone()}-pub fn get_test_weights_path() -> PathBuf {- get_test_model_path().join(MODEL_FILE_NAME)-}--#[cfg(not(target_arch = "wasm32"))]fn resolve_test_model_path() -> PathBuf {use uzu::{engine::{Engine, EngineConfig},@@ -44,8 +37,3 @@ fn resolve_test_model_path() -> PathBuf {PathBuf::from(path)})}--#[cfg(target_arch = "wasm32")]-fn resolve_test_model_path() -> PathBuf {- panic!("test model download is not supported on wasm")-}diff --git a/flake.nix b/flake.nixindex e7ab0df12..e37158624 100644--- a/flake.nix+++ b/flake.nix@@ -107,7 +107,6 @@nodejs_26pnpm_12wasm-bindgen-cli_0_2_129 # Keep in sync with Cargo.toml.- wasmtime_36evcxrcargo-denycargo-nextestdiff --git a/rust-toolchain.toml b/rust-toolchain.tomlindex a25ceeb9d..ead18a1e6 100644--- a/rust-toolchain.toml+++ b/rust-toolchain.toml@@ -10,7 +10,6 @@ targets = ["aarch64-pc-windows-msvc","aarch64-unknown-linux-gnu","wasm32-unknown-unknown",- "wasm32-wasip1-threads","x86_64-apple-darwin","x86_64-pc-windows-msvc","x86_64-unknown-linux-gnu",