Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

Tests files structure refactoring (#501)

Aleksandr Golokoz7e3b3fe13ab7
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 440a0921c..36e72261d 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -122,7 +122,7 @@ jobs:
if: ${{ matrix.backend != 'cpu' && matrix.tracing && matrix.grammar || matrix.backend == 'cpu' && !matrix.tracing && !matrix.grammar && matrix.target == 'wasm32-wasip1-threads' }}
run: |
cargo +stable nextest run --profile=ci --no-default-features $FEATURE_FLAGS \
- ${{ matrix.target == 'wasm32-wasip1-threads' && '-p backend-uzu --lib --test kernel' || '' }}
+ ${{ matrix.target == 'wasm32-wasip1-threads' && '-p backend-uzu backends::common::kernel::tests --lib' || '' }}
validate-bindings:
name: validate-bindings
diff --git a/crates/backend-uzu/Cargo.toml b/crates/backend-uzu/Cargo.toml
index a1bfbd7a3..a5c49315c 100644
--- a/crates/backend-uzu/Cargo.toml
+++ b/crates/backend-uzu/Cargo.toml
@@ -112,22 +112,5 @@ tracing = []
[lints]
workspace = true
-[[test]]
-name = "integration"
-path = "tests/integration/mod.rs"
-
-[[test]]
-name = "kernel"
-path = "tests/unit/kernel/test_entry.rs"
-
-[[test]]
-name = "performance"
-path = "tests/performance/mod.rs"
-
-[[bench]]
-name = "benchmarks"
-path = "tests/performance/bench_entry.rs"
-
[[bench]]
-name = "kernel"
-path = "tests/performance/kernel/bench_entry.rs"
\ No newline at end of file
+name = "main"
diff --git a/crates/backend-uzu/tests/BENCHMARKS.md b/crates/backend-uzu/benches/BENCHMARKS.md
similarity index 60%
rename from crates/backend-uzu/tests/BENCHMARKS.md
rename to crates/backend-uzu/benches/BENCHMARKS.md
index e9f2f3990..1d14e0437 100644
--- a/crates/backend-uzu/tests/BENCHMARKS.md
+++ b/crates/backend-uzu/benches/BENCHMARKS.md
@@ -9,31 +9,39 @@ baselines side by side.
- Rust nightly: `rustup toolchain install nightly`
- For iOS runs:
- - Apple target: `rustup target add aarch64-apple-ios`
- - `cargo-dinghy` built from the [trymirai/dinghy](https://github.com/trymirai/dinghy/tree/mirai):
+ - Apple target: `rustup target add aarch64-apple-ios`
+ - `cargo-dinghy` built from the [trymirai/dinghy](https://github.com/trymirai/dinghy/tree/mirai):
- ```bash
- cargo install \
- --git https://github.com/trymirai/dinghy \
- --branch mirai \
- cargo-dinghy
- ```
+ ```bash
+ cargo install \
+ --git https://github.com/trymirai/dinghy \
+ --branch mirai \
+ cargo-dinghy
+ ```
- - A physical device connected via USB with a device ID from
- `xcrun devicectl list devices`.
+ - A physical device connected via USB with a device ID from
+ `xcrun devicectl list devices`.
## Available benchmark groups
-| Group id | Filter |
-| --------------------------------- | --------------------------------- |
-| `Metal/Kernel/Matmul/GEMM` | `Metal/Kernel/Matmul/GEMM` |
-| `Metal/Kernel/Matmul/GEMM_MXU` | `Metal/Kernel/Matmul/GEMM_MXU` |
-| `Metal/Kernel/QmmTransposed/...` | `Metal/Kernel/QmmTransposed` |
-| `Metal/Kernel/QmvFast/...` | `Metal/Kernel/QmvFast` |
-| `Metal/Kernel/RMSNorm` | `Metal/Kernel/RMSNorm` |
-| `Metal/Kernel/Sampling/Argmax` | `Metal/Kernel/Sampling/Argmax` |
+The Cargo bench target is `main`. Its source lives at
+`crates/backend-uzu/benches/main.rs`.
+
+| Group id | Filter |
+|-----------------------------------------|-------------------------------------|
+| `Metal/Kernel/Matmul/GEMM` | `Metal/Kernel/Matmul/GEMM` |
+| `Metal/Kernel/Matmul/GEMM_MXU` | `Metal/Kernel/Matmul/GEMM_MXU` |
+| `Metal/Kernel/UnifiedQuantizedGemm/...` | `Metal/Kernel/UnifiedQuantizedGemm` |
+| `Metal/Kernel/Gemv/...` | `Metal/Kernel/Gemv` |
+| `Metal/Kernel/Qwen3Layers/...` | `Metal/Kernel/Qwen3Layers` |
+| `Metal/Kernel/RMSNorm` | `Metal/Kernel/RMSNorm` |
+| `Metal/Kernel/Sampling/Argmax` | `Metal/Kernel/Sampling/Argmax` |
+| `ChatSession run` | `ChatSession run` |
+| `Forward pass` | `Forward pass` |
The prefix `Metal/Kernel/Matmul` runs both `GEMM` and `GEMM_MXU` in one pass.
+The session and language-model groups require the test model path configured by
+the test helpers.
## Output layout
@@ -49,7 +57,7 @@ resolve relative to the package dir:
```bash
CRITERION_HOME="$PWD/target/criterion/m2_max" cargo bench \
-p backend-uzu \
- --bench kernel -- "Metal/Kernel/Matmul" \
+ --bench main -- "Metal/Kernel/Matmul" \
--save-baseline matmul_baseline_m2_max
```
@@ -81,7 +89,7 @@ cargo dinghy \
-d "$DEVICE" \
-e CRITERION_HOME=target/criterion/a19 \
--copy-back "Documents/target=$(pwd)/target" \
- bench -p backend-uzu --bench kernel -- \
+ bench -p backend-uzu --bench main -- \
"Metal/Kernel/Matmul" \
--save-baseline matmul_baseline_a19
```
diff --git a/crates/backend-uzu/tests/performance/kernel/matmul/gemm_bench.rs b/crates/backend-uzu/benches/kernel/matmul/gemm_bench.rs
similarity index 95%
rename from crates/backend-uzu/tests/performance/kernel/matmul/gemm_bench.rs
rename to crates/backend-uzu/benches/kernel/matmul/gemm_bench.rs
index 23c79c7a5..6af0efa56 100644
--- a/crates/backend-uzu/tests/performance/kernel/matmul/gemm_bench.rs
+++ b/crates/backend-uzu/benches/kernel/matmul/gemm_bench.rs
@@ -15,13 +15,11 @@ use backend_uzu::{
};
use criterion::{BenchmarkId, Criterion, Throughput};
use half::bf16;
+use proc_macros::uzu_bench;
-use crate::{
- common::{
- matmul::{bench_fp_gemm_shapes, iter_encode_loop},
- type_short_name,
- },
- uzu_bench,
+use crate::common::{
+ matmul::{bench_fp_gemm_shapes, iter_encode_loop},
+ type_short_name,
};
#[uzu_bench]
diff --git a/crates/backend-uzu/tests/performance/kernel/matmul/mod.rs b/crates/backend-uzu/benches/kernel/matmul/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/performance/kernel/matmul/mod.rs
rename to crates/backend-uzu/benches/kernel/matmul/mod.rs
diff --git a/crates/backend-uzu/tests/performance/kernel/matmul/quant_gemm_bench.rs b/crates/backend-uzu/benches/kernel/matmul/quant_gemm_bench.rs
similarity index 93%
rename from crates/backend-uzu/tests/performance/kernel/matmul/quant_gemm_bench.rs
rename to crates/backend-uzu/benches/kernel/matmul/quant_gemm_bench.rs
index 0a6a1550f..7434c1dcd 100644
--- a/crates/backend-uzu/tests/performance/kernel/matmul/quant_gemm_bench.rs
+++ b/crates/backend-uzu/benches/kernel/matmul/quant_gemm_bench.rs
@@ -14,13 +14,11 @@ use backend_uzu::{
use criterion::{BenchmarkId, Criterion, Throughput};
use half::bf16;
use num_traits::Float;
+use proc_macros::uzu_bench;
-use crate::{
- common::{
- matmul::{QuantBuffers, QuantInput, bench_quant_gemm_shapes, iter_encode_loop, quant_arguments},
- type_short_name,
- },
- uzu_bench,
+use crate::common::{
+ matmul::{QuantBuffers, QuantInput, bench_quant_gemm_shapes, iter_encode_loop, quant_arguments},
+ type_short_name,
};
fn bench_unified_quant_typed<T: ArrayElement + Float>(
diff --git a/crates/backend-uzu/tests/performance/kernel/matmul/quant_gemv_bench.rs b/crates/backend-uzu/benches/kernel/matmul/quant_gemv_bench.rs
similarity index 93%
rename from crates/backend-uzu/tests/performance/kernel/matmul/quant_gemv_bench.rs
rename to crates/backend-uzu/benches/kernel/matmul/quant_gemv_bench.rs
index eb241abc8..95c21682a 100644
--- a/crates/backend-uzu/tests/performance/kernel/matmul/quant_gemv_bench.rs
+++ b/crates/backend-uzu/benches/kernel/matmul/quant_gemv_bench.rs
@@ -9,13 +9,11 @@ use backend_uzu::{
use criterion::{BenchmarkId, Criterion, Throughput};
use half::bf16;
use num_traits::Float;
+use proc_macros::uzu_bench;
-use crate::{
- common::{
- matmul::{QuantBuffers, QuantInput, bench_quant_gemv_shapes, iter_encode_loop_named, quant_arguments},
- type_short_name,
- },
- uzu_bench,
+use crate::common::{
+ matmul::{QuantBuffers, QuantInput, bench_quant_gemv_shapes, iter_encode_loop_named, quant_arguments},
+ type_short_name,
};
fn bench_gemv_typed<B: Backend, T: ArrayElement + Float>(
diff --git a/crates/backend-uzu/tests/performance/kernel/matmul/qwen3_bench.rs b/crates/backend-uzu/benches/kernel/matmul/qwen3_bench.rs
similarity index 91%
rename from crates/backend-uzu/tests/performance/kernel/matmul/qwen3_bench.rs
rename to crates/backend-uzu/benches/kernel/matmul/qwen3_bench.rs
index e80110a40..423943c7c 100644
--- a/crates/backend-uzu/tests/performance/kernel/matmul/qwen3_bench.rs
+++ b/crates/backend-uzu/benches/kernel/matmul/qwen3_bench.rs
@@ -14,13 +14,11 @@ use backend_uzu::{
use criterion::{BenchmarkId, Criterion, Throughput};
use half::bf16;
use num_traits::Float;
+use proc_macros::uzu_bench;
-use crate::{
- common::{
- matmul::{QuantBuffers, QuantInput, iter_encode_loop, quant_arguments, qwen3_layer_shapes},
- type_short_name,
- },
- uzu_bench,
+use crate::common::{
+ matmul::{QuantBuffers, QuantInput, iter_encode_loop, quant_arguments, qwen3_layer_shapes},
+ type_short_name,
};
fn bench_qwen3_layers_typed<T: ArrayElement + Float>(
diff --git a/crates/backend-uzu/tests/performance/kernel/mod.rs b/crates/backend-uzu/benches/kernel/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/performance/kernel/mod.rs
rename to crates/backend-uzu/benches/kernel/mod.rs
diff --git a/crates/backend-uzu/tests/performance/kernel/rms_norm_bench.rs b/crates/backend-uzu/benches/kernel/rms_norm_bench.rs
similarity index 98%
rename from crates/backend-uzu/tests/performance/kernel/rms_norm_bench.rs
rename to crates/backend-uzu/benches/kernel/rms_norm_bench.rs
index 127401cea..248fe8686 100644
--- a/crates/backend-uzu/tests/performance/kernel/rms_norm_bench.rs
+++ b/crates/backend-uzu/benches/kernel/rms_norm_bench.rs
@@ -4,9 +4,10 @@ use backend_uzu::{
};
use criterion::{BenchmarkId, Criterion, Throughput};
use itertools::iproduct;
+use proc_macros::uzu_bench;
use rand::{RngExt, SeedableRng, rngs::SmallRng};
-use crate::{common::type_short_name, uzu_bench};
+use crate::common::type_short_name;
fn get_rms_norm_data(
seed: u64,
diff --git a/crates/backend-uzu/tests/performance/language_model/language_model_generator_bench.rs b/crates/backend-uzu/benches/language_model/language_model_generator_bench.rs
similarity index 95%
rename from crates/backend-uzu/tests/performance/language_model/language_model_generator_bench.rs
rename to crates/backend-uzu/benches/language_model/language_model_generator_bench.rs
index e40286f59..078983b8d 100644
--- a/crates/backend-uzu/tests/performance/language_model/language_model_generator_bench.rs
+++ b/crates/backend-uzu/benches/language_model/language_model_generator_bench.rs
@@ -6,11 +6,9 @@ use backend_uzu::{
prelude::{DecodingConfig, SamplingMethod},
};
use criterion::{BenchmarkId, Criterion, Throughput};
+use proc_macros::uzu_bench;
-use crate::{
- common::{metrics::wait_gpu_cooldown, path::get_test_model_path},
- uzu_bench,
-};
+use crate::common::{metrics::wait_gpu_cooldown, path::get_test_model_path};
fn create_generator<B: Backend>() -> LanguageModelGenerator<B> {
let model_path = get_test_model_path();
diff --git a/crates/backend-uzu/tests/performance/language_model/mod.rs b/crates/backend-uzu/benches/language_model/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/performance/language_model/mod.rs
rename to crates/backend-uzu/benches/language_model/mod.rs
diff --git a/crates/backend-uzu/tests/performance/bench_entry.rs b/crates/backend-uzu/benches/main.rs
similarity index 81%
rename from crates/backend-uzu/tests/performance/bench_entry.rs
rename to crates/backend-uzu/benches/main.rs
index 56068214d..d0d17f899 100644
--- a/crates/backend-uzu/tests/performance/bench_entry.rs
+++ b/crates/backend-uzu/benches/main.rs
@@ -8,10 +8,9 @@ fn bench_runner(benches: &[&dyn Fn()]) {
criterion::runner(benches);
}
-use proc_macros::__internal_uzu_bench as uzu_bench;
-
#[macro_use]
-#[path = "../common/mod.rs"]
+#[path = "../tests/common/mod.rs"]
mod common;
+mod kernel;
mod language_model;
mod session;
diff --git a/crates/backend-uzu/tests/performance/session/chat_session_bench.rs b/crates/backend-uzu/benches/session/chat_session_bench.rs
similarity index 94%
rename from crates/backend-uzu/tests/performance/session/chat_session_bench.rs
rename to crates/backend-uzu/benches/session/chat_session_bench.rs
index aa3888301..6eaaf1ae8 100644
--- a/crates/backend-uzu/tests/performance/session/chat_session_bench.rs
+++ b/crates/backend-uzu/benches/session/chat_session_bench.rs
@@ -6,11 +6,9 @@ use backend_uzu::{
session::ChatSession,
};
use criterion::{BenchmarkId, Criterion};
+use proc_macros::uzu_bench;
-use crate::{
- common::{metrics::wait_gpu_cooldown, path::get_test_model_path},
- uzu_bench,
-};
+use crate::common::{metrics::wait_gpu_cooldown, path::get_test_model_path};
fn create_session<B: Backend>() -> ChatSession {
let model_path = get_test_model_path();
diff --git a/crates/backend-uzu/tests/performance/session/mod.rs b/crates/backend-uzu/benches/session/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/performance/session/mod.rs
rename to crates/backend-uzu/benches/session/mod.rs
diff --git a/crates/backend-uzu/src/audio/mod.rs b/crates/backend-uzu/src/audio/mod.rs
index 2f6b20e42..a4e3e3779 100644
--- a/crates/backend-uzu/src/audio/mod.rs
+++ b/crates/backend-uzu/src/audio/mod.rs
@@ -8,5 +8,7 @@ pub use codec::AudioCodecRuntime;
#[cfg(metal_backend)]
pub use context::AudioGenerationContext;
#[cfg(metal_backend)]
-pub use nanocodec::{NanoCodecFsqRuntime, NanoCodecFsqRuntimeConfig};
+pub use nanocodec::NanoCodecFsqRuntime;
+#[cfg(all(metal_backend, test))]
+pub use nanocodec::NanoCodecFsqRuntimeConfig;
pub use types::{AudioError, AudioPcmBatch, AudioResult, AudioTokenGrid};
diff --git a/crates/backend-uzu/src/audio/nanocodec/mod.rs b/crates/backend-uzu/src/audio/nanocodec/mod.rs
index 9bb7cb421..fc747aecd 100644
--- a/crates/backend-uzu/src/audio/nanocodec/mod.rs
+++ b/crates/backend-uzu/src/audio/nanocodec/mod.rs
@@ -1,5 +1,7 @@
#[cfg(metal_backend)]
pub mod runtime;
+#[cfg(all(metal_backend, test))]
+pub use runtime::NanoCodecFsqRuntimeConfig;
#[cfg(metal_backend)]
-pub use runtime::{AudioDecodeStepStats, AudioDecodeStreamState, NanoCodecFsqRuntime, NanoCodecFsqRuntimeConfig};
+pub use runtime::{AudioDecodeStepStats, AudioDecodeStreamState, NanoCodecFsqRuntime};
diff --git a/crates/backend-uzu/src/audio/nanocodec/runtime.rs b/crates/backend-uzu/src/audio/nanocodec/runtime.rs
index 059da2d5a..46e68a0c5 100644
--- a/crates/backend-uzu/src/audio/nanocodec/runtime.rs
+++ b/crates/backend-uzu/src/audio/nanocodec/runtime.rs
@@ -464,14 +464,6 @@ impl<B: Backend> NanoCodecFsqRuntime<B> {
)
}
- pub fn begin_decode_stream(
- &self,
- batch_size: usize,
- codebooks: usize,
- ) -> AudioResult<AudioDecodeStreamState> {
- self.begin_decode_stream_with_options(batch_size, codebooks, 256)
- }
-
pub fn begin_decode_stream_with_options(
&self,
batch_size: usize,
@@ -774,3 +766,7 @@ impl<B: Backend> AudioCodecRuntime for NanoCodecFsqRuntime<B> {
self.decoded_padded_to_pcm_batch(&decoded)
}
}
+
+#[cfg(test)]
+#[path = "../../../unit/audio/nanocodec/runtime.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/audio/types.rs b/crates/backend-uzu/src/audio/types.rs
index a06ef2049..880409a16 100644
--- a/crates/backend-uzu/src/audio/types.rs
+++ b/crates/backend-uzu/src/audio/types.rs
@@ -221,5 +221,5 @@ impl AudioTokenGrid {
}
#[cfg(test)]
-#[path = "../../tests/unit/audio/types_test.rs"]
+#[path = "../../unit/audio/types_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/backends/common/allocator/allocator.rs b/crates/backend-uzu/src/backends/common/allocator/allocator.rs
index f977f213a..fd8262595 100644
--- a/crates/backend-uzu/src/backends/common/allocator/allocator.rs
+++ b/crates/backend-uzu/src/backends/common/allocator/allocator.rs
@@ -256,5 +256,5 @@ impl<B: Backend> Allocator<B> {
}
#[cfg(all(test, metal_backend))]
-#[path = "../../../../tests/unit/backends/common/allocator/allocator.rs"]
+#[path = "../../../../unit/backends/common/allocator/allocator.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/backends/common/hazard_tracker.rs b/crates/backend-uzu/src/backends/common/hazard_tracker.rs
index 0ff025ec6..419ffe162 100644
--- a/crates/backend-uzu/src/backends/common/hazard_tracker.rs
+++ b/crates/backend-uzu/src/backends/common/hazard_tracker.rs
@@ -94,5 +94,5 @@ impl HazardTracker {
}
#[cfg(test)]
-#[path = "../../../tests/unit/backends/common/hazard_tracker_test.rs"]
+#[path = "../../../unit/backends/common/hazard_tracker_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/backends/common/kernel/mod.rs b/crates/backend-uzu/src/backends/common/kernel/mod.rs
index 09b7057f1..0bd082fc3 100644
--- a/crates/backend-uzu/src/backends/common/kernel/mod.rs
+++ b/crates/backend-uzu/src/backends/common/kernel/mod.rs
@@ -10,3 +10,7 @@ pub trait Kernels: Sized {
autogen_kernels!();
type MatmulKernel: matmul::MatmulKernel<Backend = Self::Backend>;
}
+
+#[cfg(test)]
+#[path = "../../../../unit/backends/common/kernel/mod.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/backends/cpu/kernel/sampling/unified_sampling.rs b/crates/backend-uzu/src/backends/cpu/kernel/sampling/unified_sampling.rs
index 7f8644913..535e1f7f6 100644
--- a/crates/backend-uzu/src/backends/cpu/kernel/sampling/unified_sampling.rs
+++ b/crates/backend-uzu/src/backends/cpu/kernel/sampling/unified_sampling.rs
@@ -4,7 +4,10 @@ use half::bf16;
use num_traits::Float;
use proc_macros::kernel;
-use crate::{array::ArrayElement, gumbel_float, revidx};
+use crate::{
+ array::ArrayElement,
+ language_model::gumbel::{gumbel_float, revidx},
+};
// NOTE: top_k + top_p combination is not exactly matching lalamo ("parallel" here, should be top-k then top-p)
#[kernel(UnifiedSampling)]
diff --git a/crates/backend-uzu/src/backends/metal/sparse/sparse_buffer.rs b/crates/backend-uzu/src/backends/metal/sparse/sparse_buffer.rs
index 28f31542a..2b220314d 100644
--- a/crates/backend-uzu/src/backends/metal/sparse/sparse_buffer.rs
+++ b/crates/backend-uzu/src/backends/metal/sparse/sparse_buffer.rs
@@ -153,5 +153,5 @@ impl SparseBuffer for MetalSparseBuffer {
}
#[cfg(test)]
-#[path = "../../../../tests/unit/backends/metal/sparse/sparse_buffer_test.rs"]
+#[path = "../../../../unit/backends/metal/sparse/sparse_buffer_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/backends/metal/sparse/sparse_heap_pool.rs b/crates/backend-uzu/src/backends/metal/sparse/sparse_heap_pool.rs
index c78cbd037..6a7ca8803 100644
--- a/crates/backend-uzu/src/backends/metal/sparse/sparse_heap_pool.rs
+++ b/crates/backend-uzu/src/backends/metal/sparse/sparse_heap_pool.rs
@@ -176,5 +176,5 @@ impl MetalSparseHeapPool {
}
#[cfg(test)]
-#[path = "../../../../tests/unit/backends/metal/sparse/sparse_heap_pool_test.rs"]
+#[path = "../../../../unit/backends/metal/sparse/sparse_heap_pool_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/classifier/classifier.rs b/crates/backend-uzu/src/classifier/classifier.rs
index 83ffc881b..c4dba7b6b 100644
--- a/crates/backend-uzu/src/classifier/classifier.rs
+++ b/crates/backend-uzu/src/classifier/classifier.rs
@@ -75,7 +75,7 @@ impl<B: Backend> Classifier<B> {
})
}
- #[cfg(feature = "tracing")]
+ #[cfg(all(test, feature = "tracing"))]
pub fn forward_pass_with_traces(
&mut self,
token_ids: &[u64],
diff --git a/crates/backend-uzu/src/classifier/classifier_context.rs b/crates/backend-uzu/src/classifier/classifier_context.rs
index 78e64f39c..84a10072a 100644
--- a/crates/backend-uzu/src/classifier/classifier_context.rs
+++ b/crates/backend-uzu/src/classifier/classifier_context.rs
@@ -19,7 +19,7 @@ pub struct ClassifierContext<B: Backend> {
pub model_config: ClassifierModelConfig,
pub rope_configs: Box<[AnyRoPEConfig]>,
- #[cfg(feature = "tracing")]
+ #[cfg(all(test, feature = "tracing"))]
pub model_shape: ModelShape,
pub embed: Embedding<B>,
@@ -229,7 +229,7 @@ impl<B: Backend> ClassifierContext<B> {
model_config: model_config.clone(),
rope_configs: rope_configs.into_iter().map(|(config, _)| config).collect(),
logits_data_type: model_shape.data_type,
- #[cfg(feature = "tracing")]
+ #[cfg(all(test, feature = "tracing"))]
model_shape,
embed,
embedding_norm,
diff --git a/crates/backend-uzu/src/encodable_block/attention/gemm.rs b/crates/backend-uzu/src/encodable_block/attention/gemm.rs
index 8fae372ad..958aa92e3 100644
--- a/crates/backend-uzu/src/encodable_block/attention/gemm.rs
+++ b/crates/backend-uzu/src/encodable_block/attention/gemm.rs
@@ -167,5 +167,5 @@ struct KernelKey {
}
#[cfg(test)]
-#[path = "../../../tests/unit/encodable_block/attention_gemm_test.rs"]
+#[path = "../../../unit/encodable_block/attention_gemm_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/encodable_block/attention/mod.rs b/crates/backend-uzu/src/encodable_block/attention/mod.rs
index d16e4ad2f..4b972139a 100644
--- a/crates/backend-uzu/src/encodable_block/attention/mod.rs
+++ b/crates/backend-uzu/src/encodable_block/attention/mod.rs
@@ -875,5 +875,5 @@ struct KernelKey {
}
#[cfg(test)]
-#[path = "../../../tests/unit/encodable_block/attention_test.rs"]
+#[path = "../../../unit/encodable_block/attention_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/encodable_block/kv_cache_update.rs b/crates/backend-uzu/src/encodable_block/kv_cache_update.rs
index ff91b6992..6bfc30439 100644
--- a/crates/backend-uzu/src/encodable_block/kv_cache_update.rs
+++ b/crates/backend-uzu/src/encodable_block/kv_cache_update.rs
@@ -112,5 +112,5 @@ pub fn create_swaps_direct(
}
#[cfg(test)]
-#[path = "../../tests/unit/encodable_block/kv_cache_update_test.rs"]
+#[path = "../../unit/encodable_block/kv_cache_update_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/encodable_block/mamba_mixer/ssd_prefill.rs b/crates/backend-uzu/src/encodable_block/mamba_mixer/ssd_prefill.rs
index 13e2373b6..c7ab33e66 100644
--- a/crates/backend-uzu/src/encodable_block/mamba_mixer/ssd_prefill.rs
+++ b/crates/backend-uzu/src/encodable_block/mamba_mixer/ssd_prefill.rs
@@ -139,5 +139,5 @@ impl<B: Backend> SSDPrefillBlock<B> {
}
#[cfg(test)]
-#[path = "../../../tests/unit/encodable_block/mamba_mixer/ssd_prefill_test.rs"]
+#[path = "../../../unit/encodable_block/mamba_mixer/ssd_prefill_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/encodable_block/mlp/moe/gather.rs b/crates/backend-uzu/src/encodable_block/mlp/moe/gather.rs
index 9e72cc33e..281c0e479 100644
--- a/crates/backend-uzu/src/encodable_block/mlp/moe/gather.rs
+++ b/crates/backend-uzu/src/encodable_block/mlp/moe/gather.rs
@@ -74,5 +74,5 @@ impl<B: Backend> MoeGather<B> {
}
#[cfg(test)]
-#[path = "../../../../tests/unit/encodable_block/moe/moe_gather_test.rs"]
+#[path = "../../../../unit/encodable_block/moe/moe_gather_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/encodable_block/mlp/moe/mod.rs b/crates/backend-uzu/src/encodable_block/mlp/moe/mod.rs
index 50a82fbc0..21890ba40 100644
--- a/crates/backend-uzu/src/encodable_block/mlp/moe/mod.rs
+++ b/crates/backend-uzu/src/encodable_block/mlp/moe/mod.rs
@@ -341,5 +341,5 @@ impl<B: Backend> Mlp<B> for MoeBlock<B> {
}
#[cfg(test)]
-#[path = "../../../../tests/unit/encodable_block/moe/mod.rs"]
+#[path = "../../../../unit/encodable_block/moe/mod.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/encodable_block/sampling.rs b/crates/backend-uzu/src/encodable_block/sampling.rs
index 15303a34f..9683cb8f2 100644
--- a/crates/backend-uzu/src/encodable_block/sampling.rs
+++ b/crates/backend-uzu/src/encodable_block/sampling.rs
@@ -168,5 +168,5 @@ impl<B: Backend> Sampling<B> {
}
#[cfg(test)]
-#[path = "../../tests/unit/encodable_block/sampling_test.rs"]
+#[path = "../../unit/encodable_block/sampling_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/forward_pass/cache_layers.rs b/crates/backend-uzu/src/forward_pass/cache_layers.rs
index f7770c98f..b6bc7011a 100644
--- a/crates/backend-uzu/src/forward_pass/cache_layers.rs
+++ b/crates/backend-uzu/src/forward_pass/cache_layers.rs
@@ -675,5 +675,5 @@ impl<B: Backend> CacheLayers<B> {
}
#[cfg(test)]
-#[path = "../../tests/unit/forward_pass/cache_layers_test.rs"]
+#[path = "../../unit/forward_pass/cache_layers_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/forward_pass/kv_cache_layer.rs b/crates/backend-uzu/src/forward_pass/kv_cache_layer.rs
index 148ca8c4e..489ebe7bc 100644
--- a/crates/backend-uzu/src/forward_pass/kv_cache_layer.rs
+++ b/crates/backend-uzu/src/forward_pass/kv_cache_layer.rs
@@ -603,5 +603,5 @@ impl<B: Backend, Buf: Buffer<Backend = B>> KVCacheLayerTrait<B> for KVCacheLayer
}
#[cfg(test)]
-#[path = "../../tests/unit/forward_pass/kv_cache_state_test.rs"]
+#[path = "../../unit/forward_pass/kv_cache_state_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/forward_pass/traces.rs b/crates/backend-uzu/src/forward_pass/traces.rs
index 4b3474955..4c106ed3b 100644
--- a/crates/backend-uzu/src/forward_pass/traces.rs
+++ b/crates/backend-uzu/src/forward_pass/traces.rs
@@ -100,3 +100,7 @@ impl<B: Backend> ActivationTrace<B> {
self.output_pooling.as_mut().expect("output_pooling is only available for classifier traces")
}
}
+
+#[cfg(all(test, feature = "tracing"))]
+#[path = "../../unit/forward_pass/traces/mod.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/inference/mod.rs b/crates/backend-uzu/src/inference/mod.rs
index d334ebf2e..1d1dbd9d1 100644
--- a/crates/backend-uzu/src/inference/mod.rs
+++ b/crates/backend-uzu/src/inference/mod.rs
@@ -24,7 +24,7 @@ use shoji::{
};
pub use text_to_speech::Instance as TextToSpeechInstance;
-use crate::TOOLCHAIN_VERSION;
+use crate::utils::TOOLCHAIN_VERSION;
pub struct Backend;
diff --git a/crates/backend-uzu/src/language_model/grammar/mod.rs b/crates/backend-uzu/src/language_model/grammar/mod.rs
index bab57a718..a58cfd19b 100644
--- a/crates/backend-uzu/src/language_model/grammar/mod.rs
+++ b/crates/backend-uzu/src/language_model/grammar/mod.rs
@@ -43,3 +43,7 @@ pub fn create_compiled_grammar(
Err(Error::GrammarNoBackendAvailable)
}
}
+
+#[cfg(test)]
+#[path = "../../../unit/language_model/grammar.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/lib.rs b/crates/backend-uzu/src/lib.rs
index 3f95364e0..a5f8d16f2 100644
--- a/crates/backend-uzu/src/lib.rs
+++ b/crates/backend-uzu/src/lib.rs
@@ -15,7 +15,7 @@ pub mod data_type;
mod encodable_block;
mod forward_pass;
mod language_model;
-pub mod parameters;
+mod parameters;
mod speculators;
mod trie;
mod utils;
@@ -25,9 +25,6 @@ pub mod inference;
pub mod prelude;
pub mod session;
-#[cfg(metal_backend)]
-pub use audio::{NanoCodecFsqRuntime, NanoCodecFsqRuntimeConfig};
-pub use language_model::gumbel::{gumbel_float, revidx};
pub use utils::{TOOLCHAIN_VERSION, VERSION};
#[doc(hidden)]
@@ -38,16 +35,3 @@ pub mod _benchmarks {
trie::{TrieCreationConfig, TrieNode},
};
}
-
-#[cfg(feature = "tracing")]
-pub mod _private {
- pub use crate::{
- classifier::Classifier,
- config::model::AnyModelConfig,
- encodable_block::{DecoderDecodeInput, Sampling},
- forward_pass::{
- cache_layers::CacheLayers, kv_cache_layer::KVCacheLayer, token_inputs::TokenInputs, traces::ActivationTrace,
- },
- language_model::language_model_generator_context::LanguageModelGeneratorContext,
- };
-}
diff --git a/crates/backend-uzu/src/parameters/loader.rs b/crates/backend-uzu/src/parameters/loader.rs
index 54c2dc605..ca6947d6e 100644
--- a/crates/backend-uzu/src/parameters/loader.rs
+++ b/crates/backend-uzu/src/parameters/loader.rs
@@ -273,3 +273,7 @@ impl<'loader, B: Backend> ParameterTree<'loader, B> {
}
}
}
+
+#[cfg(test)]
+#[path = "../../unit/parameters/loader.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/parameters/mod.rs b/crates/backend-uzu/src/parameters/mod.rs
index b2715220f..c4492bdfd 100644
--- a/crates/backend-uzu/src/parameters/mod.rs
+++ b/crates/backend-uzu/src/parameters/mod.rs
@@ -1,7 +1,7 @@
mod loader;
mod safetensors_metadata;
-// Re-export the safetensors header reader so other modules (e.g. decoder
-// runner) can estimate parameter memory before creating a Context.
pub use loader::{ParameterLeaf, ParameterLoader, ParameterLoaderError, ParameterTree};
-pub use safetensors_metadata::{HeaderLoadingError, read_metadata as read_safetensors_metadata};
+pub use safetensors_metadata::HeaderLoadingError;
+#[cfg(all(test, feature = "tracing"))]
+pub use safetensors_metadata::read_metadata;
diff --git a/crates/backend-uzu/src/parameters/safetensors_metadata.rs b/crates/backend-uzu/src/parameters/safetensors_metadata.rs
index 654bea6ce..230a12c02 100644
--- a/crates/backend-uzu/src/parameters/safetensors_metadata.rs
+++ b/crates/backend-uzu/src/parameters/safetensors_metadata.rs
@@ -125,3 +125,7 @@ pub fn read_metadata(file: &File) -> Result<(usize, HashMetadata), HeaderLoading
let metadata: HashMetadata = serde_json::from_str(string)?;
Ok((stop, metadata))
}
+
+#[cfg(test)]
+#[path = "../../unit/parameters/safetensors_metadata.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/prelude.rs b/crates/backend-uzu/src/prelude.rs
index 8a11d1739..cf3fef1af 100644
--- a/crates/backend-uzu/src/prelude.rs
+++ b/crates/backend-uzu/src/prelude.rs
@@ -14,7 +14,6 @@ pub use crate::backends::metal::MetalContext;
#[cfg(metal_backend)]
pub use crate::session::TtsSession;
pub use crate::{
- TOOLCHAIN_VERSION, VERSION,
audio::{AudioCodecRuntime, AudioError, AudioPcmBatch, AudioResult, AudioTokenGrid},
classifier::{ClassificationOutput, ClassificationStats},
parameters::{HeaderLoadingError, ParameterLeaf, ParameterLoaderError, ParameterTree},
@@ -31,4 +30,5 @@ pub use crate::{
ngram_speculator::NGramSpeculator, prompt_lookup_speculator::PromptLookupSpeculator, speculator::Speculator,
token_finder::TokenFinder,
},
+ utils::{TOOLCHAIN_VERSION, VERSION},
};
diff --git a/crates/backend-uzu/src/session/chat_session.rs b/crates/backend-uzu/src/session/chat_session.rs
index 45fb44e3a..be889e388 100644
--- a/crates/backend-uzu/src/session/chat_session.rs
+++ b/crates/backend-uzu/src/session/chat_session.rs
@@ -645,3 +645,7 @@ impl ChatSession {
self.llm.peak_memory_usage()
}
}
+
+#[cfg(test)]
+#[path = "../../unit/session/chat_session.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/session/config/grammar_config.rs b/crates/backend-uzu/src/session/config/grammar_config.rs
index 19eed4fa4..21ef25793 100644
--- a/crates/backend-uzu/src/session/config/grammar_config.rs
+++ b/crates/backend-uzu/src/session/config/grammar_config.rs
@@ -91,3 +91,7 @@ impl GrammarConfig {
})
}
}
+
+#[cfg(test)]
+#[path = "../../../unit/session/config/grammar_config.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/session/parameter/context_mode.rs b/crates/backend-uzu/src/session/parameter/context_mode.rs
index acd05add8..e2b892fb6 100644
--- a/crates/backend-uzu/src/session/parameter/context_mode.rs
+++ b/crates/backend-uzu/src/session/parameter/context_mode.rs
@@ -9,3 +9,7 @@ pub enum ContextMode {
},
Dynamic,
}
+
+#[cfg(test)]
+#[path = "../../../unit/session/parameter/context_mode.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/speculators/fixed_token_speculator.rs b/crates/backend-uzu/src/speculators/fixed_token_speculator.rs
index 5a5a21212..2125d8bf5 100644
--- a/crates/backend-uzu/src/speculators/fixed_token_speculator.rs
+++ b/crates/backend-uzu/src/speculators/fixed_token_speculator.rs
@@ -47,3 +47,7 @@ impl Speculator for FixedTokensSpeculator {
plausible_tokens.into_iter().map(|(k, v)| (k, v / sum)).collect()
}
}
+
+#[cfg(test)]
+#[path = "../../unit/speculators/fixed_token_speculator.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/speculators/prompt_lookup_speculator.rs b/crates/backend-uzu/src/speculators/prompt_lookup_speculator.rs
index 439bf3bde..bec28ab0e 100644
--- a/crates/backend-uzu/src/speculators/prompt_lookup_speculator.rs
+++ b/crates/backend-uzu/src/speculators/prompt_lookup_speculator.rs
@@ -40,3 +40,7 @@ impl Speculator for PromptLookupSpeculator {
hm
}
}
+
+#[cfg(test)]
+#[path = "../../unit/speculators/prompt_lookup_speculator.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/speculators/token_finder.rs b/crates/backend-uzu/src/speculators/token_finder.rs
index 4769354e9..a0b2dee6a 100644
--- a/crates/backend-uzu/src/speculators/token_finder.rs
+++ b/crates/backend-uzu/src/speculators/token_finder.rs
@@ -32,3 +32,7 @@ impl TokenFinder {
None
}
}
+
+#[cfg(test)]
+#[path = "../../unit/speculators/token_finder_speculator.rs"]
+mod tests;
diff --git a/crates/backend-uzu/src/trie.rs b/crates/backend-uzu/src/trie.rs
index abf14a33a..fada32870 100644
--- a/crates/backend-uzu/src/trie.rs
+++ b/crates/backend-uzu/src/trie.rs
@@ -298,5 +298,5 @@ impl<'a> FlatTrie<'a> {
}
#[cfg(test)]
-#[path = "../tests/unit/trie_test.rs"]
+#[path = "../unit/trie_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/src/utils/model_size.rs b/crates/backend-uzu/src/utils/model_size.rs
index 22f42c479..5b7120d64 100644
--- a/crates/backend-uzu/src/utils/model_size.rs
+++ b/crates/backend-uzu/src/utils/model_size.rs
@@ -26,5 +26,5 @@ impl ModelSize {
}
#[cfg(test)]
-#[path = "../../tests/unit/utils/model_size_test.rs"]
+#[path = "../../unit/utils/model_size_test.rs"]
mod tests;
diff --git a/crates/backend-uzu/tests/common/mod.rs b/crates/backend-uzu/tests/common/mod.rs
index 37e751d44..67dfe4884 100644
--- a/crates/backend-uzu/tests/common/mod.rs
+++ b/crates/backend-uzu/tests/common/mod.rs
@@ -9,6 +9,7 @@ pub mod metrics;
pub mod path;
pub mod perf;
pub mod proptest;
+pub mod repeat_speculator;
pub(crate) use proptest::for_each_context;
diff --git a/crates/backend-uzu/tests/common/path.rs b/crates/backend-uzu/tests/common/path.rs
index 6b1e65601..7d06600f2 100644
--- a/crates/backend-uzu/tests/common/path.rs
+++ b/crates/backend-uzu/tests/common/path.rs
@@ -1,11 +1,9 @@
use std::path::PathBuf;
-pub const MODEL_DIR_NAME: &str = "Llama-3.2-1B-Instruct";
-pub const MODEL_FILE_NAME: &str = "model.safetensors";
-#[cfg(all(metal_backend, feature = "tracing"))]
-pub const TRACES_FILE_NAME: &str = "traces.safetensors";
+const MODEL_DIR_NAME: &str = "Llama-3.2-1B-Instruct";
+const MODEL_FILE_NAME: &str = "model.safetensors";
-pub fn get_version() -> &'static str {
+fn get_version() -> &'static str {
env!("CARGO_PKG_VERSION")
}
@@ -28,11 +26,6 @@ pub fn get_test_weights_path() -> PathBuf {
get_test_model_path().join(MODEL_FILE_NAME)
}
-#[cfg(all(metal_backend, feature = "tracing"))]
-pub fn get_traces_path() -> PathBuf {
- get_test_model_path().join(TRACES_FILE_NAME)
-}
-
#[cfg(target_os = "ios")]
pub fn ios_set_current_dir() {
use objc2_foundation::{NSSearchPathDirectory, NSSearchPathDomainMask, NSSearchPathForDirectoriesInDomains};
diff --git a/crates/backend-uzu/tests/integration/util/speculator.rs b/crates/backend-uzu/tests/common/repeat_speculator.rs
similarity index 100%
rename from crates/backend-uzu/tests/integration/util/speculator.rs
rename to crates/backend-uzu/tests/common/repeat_speculator.rs
diff --git a/crates/backend-uzu/tests/integration/mod.rs b/crates/backend-uzu/tests/integration/mod.rs
index 0cd6dd61b..7f33ec2b7 100644
--- a/crates/backend-uzu/tests/integration/mod.rs
+++ b/crates/backend-uzu/tests/integration/mod.rs
@@ -1,8 +1 @@
-#[path = "../common/mod.rs"]
-mod common;
-mod parameters;
mod session;
-mod tracer;
-mod util;
-
-mod person_schema_metal_bitmask_test;
diff --git a/crates/backend-uzu/tests/integration/parameters/mod.rs b/crates/backend-uzu/tests/integration/parameters/mod.rs
deleted file mode 100644
index 08e062824..000000000
--- a/crates/backend-uzu/tests/integration/parameters/mod.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-mod loader_test;
-mod safetensors_metadata_test;
diff --git a/crates/backend-uzu/tests/integration/parameters/safetensors_metadata_test.rs b/crates/backend-uzu/tests/integration/parameters/safetensors_metadata_test.rs
deleted file mode 100644
index cfeee4ca6..000000000
--- a/crates/backend-uzu/tests/integration/parameters/safetensors_metadata_test.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-use std::fs::File;
-
-use backend_uzu::parameters::read_safetensors_metadata;
-
-use crate::common::path::get_test_weights_path;
-
-#[test]
-fn test_metadata_loading() {
- let path = get_test_weights_path();
- let file = File::open(&path).expect("weights not found");
- let (_offset, metadata) = read_safetensors_metadata(&file).expect("read metadata");
- assert!(!metadata.tensors.is_empty());
-}
diff --git a/crates/backend-uzu/tests/integration/session/chat_session/load_perf_test.rs b/crates/backend-uzu/tests/integration/session/chat_session/load_perf_test.rs
index 3b59c2184..f66b7cd8a 100644
--- a/crates/backend-uzu/tests/integration/session/chat_session/load_perf_test.rs
+++ b/crates/backend-uzu/tests/integration/session/chat_session/load_perf_test.rs
@@ -3,11 +3,12 @@
use std::{path::PathBuf, time::Instant};
use backend_uzu::session::{Session, config::DecodingConfig};
+use proc_macros::uzu_test;
use test_tag::tag;
#[ignore = "requires THINKING_TEST_MODEL pointing at a downloaded model"]
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn load_time() {
let path = PathBuf::from(std::env::var("THINKING_TEST_MODEL").expect("set THINKING_TEST_MODEL"));
let start = Instant::now();
diff --git a/crates/backend-uzu/tests/integration/session/chat_session/mod.rs b/crates/backend-uzu/tests/integration/session/chat_session/mod.rs
index 3cd02ab88..e201d2a25 100644
--- a/crates/backend-uzu/tests/integration/session/chat_session/mod.rs
+++ b/crates/backend-uzu/tests/integration/session/chat_session/mod.rs
@@ -1,5 +1,3 @@
-mod context_mode_test;
mod load_perf_test;
mod sampling_test;
-mod text_session_test;
mod thinking_toggle_test;
diff --git a/crates/backend-uzu/tests/integration/session/chat_session/sampling_test.rs b/crates/backend-uzu/tests/integration/session/chat_session/sampling_test.rs
index 59f537ac2..cee51ecd1 100644
--- a/crates/backend-uzu/tests/integration/session/chat_session/sampling_test.rs
+++ b/crates/backend-uzu/tests/integration/session/chat_session/sampling_test.rs
@@ -8,6 +8,7 @@ use backend_uzu::session::{
parameter::{SamplingMethod, SamplingPolicy, SamplingProcessingOrder, SamplingSeed},
types::{Input, Message, Output},
};
+use proc_macros::uzu_test;
use test_tag::tag;
fn model_path() -> Option<PathBuf> {
@@ -59,7 +60,7 @@ const PROMPT: &str = "Write one creative sentence about the ocean.";
#[ignore = "requires THINKING_TEST_MODEL pointing at a downloaded model"]
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn greedy_sampling_is_deterministic() {
let Some(path) = model_path() else {
panic!("set THINKING_TEST_MODEL to a downloaded model directory");
@@ -72,7 +73,7 @@ fn greedy_sampling_is_deterministic() {
#[ignore = "requires THINKING_TEST_MODEL pointing at a downloaded model"]
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn stochastic_sampling_varies_with_seed() {
let Some(path) = model_path() else {
panic!("set THINKING_TEST_MODEL to a downloaded model directory");
diff --git a/crates/backend-uzu/tests/integration/session/chat_session/thinking_toggle_test.rs b/crates/backend-uzu/tests/integration/session/chat_session/thinking_toggle_test.rs
index 01580b6b9..5074c39a0 100644
--- a/crates/backend-uzu/tests/integration/session/chat_session/thinking_toggle_test.rs
+++ b/crates/backend-uzu/tests/integration/session/chat_session/thinking_toggle_test.rs
@@ -8,6 +8,7 @@ use backend_uzu::session::{
parameter::SamplingSeed,
types::{Input, Message, Output},
};
+use proc_macros::uzu_test;
use test_tag::tag;
fn model_path() -> Option<PathBuf> {
@@ -44,7 +45,7 @@ fn dump(
#[ignore = "requires THINKING_TEST_MODEL pointing at a downloaded thinking model"]
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn thinking_toggle_end_to_end() {
let Some(path) = model_path() else {
panic!("set THINKING_TEST_MODEL to a downloaded thinking-model directory");
@@ -71,7 +72,7 @@ fn thinking_toggle_end_to_end() {
#[ignore = "requires THINKING_TEST_MODEL pointing at a downloaded thinking model"]
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn thinking_toggle_within_one_session() {
let Some(path) = model_path() else {
panic!("set THINKING_TEST_MODEL to a downloaded thinking-model directory");
diff --git a/crates/backend-uzu/tests/integration/session/config/mod.rs b/crates/backend-uzu/tests/integration/session/config/mod.rs
deleted file mode 100644
index c162be941..000000000
--- a/crates/backend-uzu/tests/integration/session/config/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-mod grammar_json_schema_test;
diff --git a/crates/backend-uzu/tests/integration/session/mod.rs b/crates/backend-uzu/tests/integration/session/mod.rs
index 7c73b158e..86a373c22 100644
--- a/crates/backend-uzu/tests/integration/session/mod.rs
+++ b/crates/backend-uzu/tests/integration/session/mod.rs
@@ -1,4 +1 @@
mod chat_session;
-mod config;
-mod speculator;
-mod tts_session;
diff --git a/crates/backend-uzu/tests/integration/session/speculator/mod.rs b/crates/backend-uzu/tests/integration/session/speculator/mod.rs
deleted file mode 100644
index 3464b58dd..000000000
--- a/crates/backend-uzu/tests/integration/session/speculator/mod.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-mod fixed_token;
-mod prompt_lookup;
-mod token_finder;
diff --git a/crates/backend-uzu/tests/integration/session/tts_session/audio_nanocodec_fsq_test.rs b/crates/backend-uzu/tests/integration/session/tts_session/audio_nanocodec_fsq_test.rs
deleted file mode 100644
index 9f6d1a5d7..000000000
--- a/crates/backend-uzu/tests/integration/session/tts_session/audio_nanocodec_fsq_test.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-use crate::common::audio::fsq_reference::{fsq_decode_reference, fsq_encode_reference};
-
-#[test]
-fn fsq_decode_reference_masks_values_beyond_lengths() {
- let output = fsq_decode_reference(&[0, 7, 11, 3, 5, 9], &[2], 1, 2, 3, 2, &[8, 5]).expect("decode");
-
- assert_eq!(output.len(), 12);
- let masked_t2 = [output[2], output[5], output[8], output[11]];
- assert_eq!(masked_t2, [0.0, 0.0, 0.0, 0.0]);
-}
-
-#[test]
-fn fsq_encode_reference_masks_values_beyond_lengths() {
- let tokens = fsq_encode_reference(
- &[-0.9, -0.1, 0.2, 0.7, 0.8, 0.3, -0.4, -0.7, -0.2, 0.0, 0.4, 0.9, 0.5, -0.5, 0.1, -0.1],
- &[3],
- 1,
- 2,
- 4,
- 2,
- &[8, 6],
- &[1, 8],
- 1e-3,
- )
- .expect("encode");
-
- assert_eq!(tokens.len(), 8);
- assert_eq!(tokens[3], 0);
- assert_eq!(tokens[7], 0);
-}
diff --git a/crates/backend-uzu/tests/integration/session/tts_session/mod.rs b/crates/backend-uzu/tests/integration/session/tts_session/mod.rs
deleted file mode 100644
index eb6a669b8..000000000
--- a/crates/backend-uzu/tests/integration/session/tts_session/mod.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-mod audio_nanocodec_fsq_test;
-mod audio_nanocodec_runtime_test;
diff --git a/crates/backend-uzu/tests/integration/util/mod.rs b/crates/backend-uzu/tests/integration/util/mod.rs
deleted file mode 100644
index c91484f20..000000000
--- a/crates/backend-uzu/tests/integration/util/mod.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#[cfg(metal_backend)]
-pub mod speculator;
diff --git a/crates/backend-uzu/tests/integration_entry.rs b/crates/backend-uzu/tests/integration_entry.rs
new file mode 100644
index 000000000..6d3bbe604
--- /dev/null
+++ b/crates/backend-uzu/tests/integration_entry.rs
@@ -0,0 +1 @@
+mod integration;
diff --git a/crates/backend-uzu/tests/performance/audio_kernel_perf_test.rs b/crates/backend-uzu/tests/performance/audio_kernel_perf_test.rs
index 1b069b96c..80d73a184 100644
--- a/crates/backend-uzu/tests/performance/audio_kernel_perf_test.rs
+++ b/crates/backend-uzu/tests/performance/audio_kernel_perf_test.rs
@@ -19,6 +19,7 @@ use backend_uzu::{
},
data_type::DataType,
};
+use proc_macros::uzu_test;
type Ctx = <Metal as Backend>::Context;
@@ -97,7 +98,7 @@ const DEC_STRIDES: [usize; 4] = [8, 8, 4, 2]; // decoder_rates
const SEMANTIC_FRAMES_10S: usize = 215; // ~10s at 44100 Hz with upsample_factor=2048
-#[test]
+#[uzu_test]
#[ignore] // Heavy benchmark (~240s); run explicitly with --ignored
fn audio_kernel_perf() {
let context = <Metal as Backend>::Context::new().unwrap();
diff --git a/crates/backend-uzu/tests/performance/kernel/bench_entry.rs b/crates/backend-uzu/tests/performance/kernel/bench_entry.rs
deleted file mode 100644
index 11bea57e2..000000000
--- a/crates/backend-uzu/tests/performance/kernel/bench_entry.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#![feature(custom_test_frameworks)]
-#![test_runner(crate::bench_runner)]
-
-fn bench_runner(benches: &[&dyn Fn()]) {
- #[cfg(target_os = "ios")]
- crate::common::path::ios_set_current_dir();
- crate::common::enable_benchmark_gpu_capture_if_requested();
- criterion::runner(benches);
-}
-
-use proc_macros::__internal_uzu_bench as uzu_bench;
-
-#[macro_use]
-#[path = "../../common/mod.rs"]
-mod common;
-
-#[path = "mod.rs"]
-mod kernel;
diff --git a/crates/backend-uzu/tests/performance/mod.rs b/crates/backend-uzu/tests/performance/mod.rs
index b975c0c04..52f2d4249 100644
--- a/crates/backend-uzu/tests/performance/mod.rs
+++ b/crates/backend-uzu/tests/performance/mod.rs
@@ -1,6 +1,2 @@
-#[macro_use]
-#[path = "../common/mod.rs"]
-mod common;
-
mod audio_kernel_perf_test;
mod model_loading_perf_test;
diff --git a/crates/backend-uzu/tests/performance/model_loading_perf_test.rs b/crates/backend-uzu/tests/performance/model_loading_perf_test.rs
index 39209a1fb..bee05782a 100644
--- a/crates/backend-uzu/tests/performance/model_loading_perf_test.rs
+++ b/crates/backend-uzu/tests/performance/model_loading_perf_test.rs
@@ -1,8 +1,9 @@
use backend_uzu::prelude::{ChatSession, DecodingConfig};
+use proc_macros::uzu_test;
use crate::common::{path::get_test_model_path, perf::run_perf};
-#[test]
+#[uzu_test]
#[ignore]
fn test_perf_model_loading() {
let perf_results = run_perf("Model loading", 10, || {
diff --git a/crates/backend-uzu/tests/performance_entry.rs b/crates/backend-uzu/tests/performance_entry.rs
new file mode 100644
index 000000000..f0d6f6ba7
--- /dev/null
+++ b/crates/backend-uzu/tests/performance_entry.rs
@@ -0,0 +1,2 @@
+mod common;
+mod performance;
diff --git a/crates/backend-uzu/tests/unit/kernel/test_entry.rs b/crates/backend-uzu/tests/unit/kernel/test_entry.rs
deleted file mode 100644
index f2a00ab03..000000000
--- a/crates/backend-uzu/tests/unit/kernel/test_entry.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-use proc_macros::{__internal_uzu_ignored as uzu_bench, __internal_uzu_test as uzu_test};
-
-#[macro_use]
-#[path = "../../common/mod.rs"]
-mod common;
-
-#[path = "mod.rs"]
-mod kernel;
diff --git a/crates/backend-uzu/tests/integration/session/tts_session/audio_nanocodec_runtime_test.rs b/crates/backend-uzu/unit/audio/nanocodec/runtime.rs
similarity index 85%
rename from crates/backend-uzu/tests/integration/session/tts_session/audio_nanocodec_runtime_test.rs
rename to crates/backend-uzu/unit/audio/nanocodec/runtime.rs
index 4bf72498a..e9629738a 100644
--- a/crates/backend-uzu/tests/integration/session/tts_session/audio_nanocodec_runtime_test.rs
+++ b/crates/backend-uzu/unit/audio/nanocodec/runtime.rs
@@ -1,13 +1,14 @@
#![cfg(metal_backend)]
-use backend_uzu::{
- NanoCodecFsqRuntime, NanoCodecFsqRuntimeConfig,
+use proc_macros::uzu_test;
+
+use crate::{
+ audio::{NanoCodecFsqRuntime, NanoCodecFsqRuntimeConfig},
backends::metal::Metal,
+ common::audio::fsq_reference::{fsq_decode_reference, fsq_encode_reference},
prelude::{AudioCodecRuntime, AudioError, AudioPcmBatch, AudioTokenGrid},
};
-use crate::common::audio::fsq_reference::{fsq_decode_reference, fsq_encode_reference};
-
fn create_runtime() -> NanoCodecFsqRuntime<Metal> {
let config =
NanoCodecFsqRuntimeConfig::new(24_000, 2, vec![8, 6].into_boxed_slice(), 1e-3).expect("valid runtime config");
@@ -70,7 +71,7 @@ fn unpack_reference_output(
out
}
-#[test]
+#[uzu_test]
fn nanocodec_runtime_encode_matches_fsq_reference() {
let runtime = create_runtime();
let pcm = make_pcm(runtime.config().channels(), &[3, 5]);
@@ -106,7 +107,7 @@ fn nanocodec_runtime_encode_matches_fsq_reference() {
assert_eq!(tokens.tokens(), expected.tokens());
}
-#[test]
+#[uzu_test]
fn nanocodec_runtime_decode_matches_fsq_reference() {
let runtime = create_runtime();
let pcm = make_pcm(runtime.config().channels(), &[4, 2]);
@@ -138,7 +139,7 @@ fn nanocodec_runtime_decode_matches_fsq_reference() {
}
}
-#[test]
+#[uzu_test]
fn nanocodec_runtime_decode_rejects_out_of_range_token() {
let runtime = create_runtime();
let cardinality = runtime.config().codec_cardinality();
@@ -161,7 +162,7 @@ fn nanocodec_runtime_decode_rejects_out_of_range_token() {
);
}
-#[test]
+#[uzu_test]
fn nanocodec_runtime_encode_rejects_channel_mismatch() {
let runtime = create_runtime();
let pcm = make_pcm(runtime.config().channels() - 1, &[2]);
@@ -174,3 +175,32 @@ fn nanocodec_runtime_encode_rejects_channel_mismatch() {
other => panic!("unexpected error variant: {other:?}"),
}
}
+
+#[uzu_test]
+fn fsq_decode_reference_masks_values_beyond_lengths() {
+ let output = fsq_decode_reference(&[0, 7, 11, 3, 5, 9], &[2], 1, 2, 3, 2, &[8, 5]).expect("decode");
+
+ assert_eq!(output.len(), 12);
+ let masked_t2 = [output[2], output[5], output[8], output[11]];
+ assert_eq!(masked_t2, [0.0, 0.0, 0.0, 0.0]);
+}
+
+#[uzu_test]
+fn fsq_encode_reference_masks_values_beyond_lengths() {
+ let tokens = fsq_encode_reference(
+ &[-0.9, -0.1, 0.2, 0.7, 0.8, 0.3, -0.4, -0.7, -0.2, 0.0, 0.4, 0.9, 0.5, -0.5, 0.1, -0.1],
+ &[3],
+ 1,
+ 2,
+ 4,
+ 2,
+ &[8, 6],
+ &[1, 8],
+ 1e-3,
+ )
+ .expect("encode");
+
+ assert_eq!(tokens.len(), 8);
+ assert_eq!(tokens[3], 0);
+ assert_eq!(tokens[7], 0);
+}
diff --git a/crates/backend-uzu/tests/unit/audio/types_test.rs b/crates/backend-uzu/unit/audio/types_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/audio/types_test.rs
rename to crates/backend-uzu/unit/audio/types_test.rs
diff --git a/crates/backend-uzu/tests/unit/backends/common/allocator/allocator.rs b/crates/backend-uzu/unit/backends/common/allocator/allocator.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/backends/common/allocator/allocator.rs
rename to crates/backend-uzu/unit/backends/common/allocator/allocator.rs
diff --git a/crates/backend-uzu/tests/unit/backends/common/hazard_tracker_test.rs b/crates/backend-uzu/unit/backends/common/hazard_tracker_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/backends/common/hazard_tracker_test.rs
rename to crates/backend-uzu/unit/backends/common/hazard_tracker_test.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/activation_test.rs b/crates/backend-uzu/unit/backends/common/kernel/activation_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/activation_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/activation_test.rs
index 7fd730862..d0061c69e 100644
--- a/crates/backend-uzu/tests/unit/kernel/activation_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/activation_test.rs
@@ -1,22 +1,20 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::ArrayElement,
backends::{
common::{Backend, Context, Encoder, Kernels, gpu_types::ActivationType, kernel::ActivationKernel},
cpu::Cpu,
},
- data_type::DataType,
-};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{
common::{
assert::assert_eq_float,
helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
},
- uzu_test,
+ data_type::DataType,
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/kernel/attention/attention_fallback_test.rs b/crates/backend-uzu/unit/backends/common/kernel/attention/attention_fallback_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/attention/attention_fallback_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/attention/attention_fallback_test.rs
index fcd68f371..7a1f60e14 100644
--- a/crates/backend-uzu/tests/unit/kernel/attention/attention_fallback_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/attention/attention_fallback_test.rs
@@ -1,4 +1,7 @@
-use backend_uzu::{
+use half::bf16;
+use proc_macros::uzu_test;
+
+use crate::{
backends::{
common::{
Allocation, Backend, Context, Encoder, Kernels,
@@ -10,16 +13,11 @@ use backend_uzu::{
},
cpu::Cpu,
},
- data_type::DataType,
-};
-use half::bf16;
-
-use crate::{
common::{
assert::assert_eq_float,
helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
},
- uzu_test,
+ data_type::DataType,
};
const NUM_HEADS: u32 = 4;
diff --git a/crates/backend-uzu/tests/unit/kernel/attention/attention_single_pass_test.rs b/crates/backend-uzu/unit/backends/common/kernel/attention/attention_single_pass_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/attention/attention_single_pass_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/attention/attention_single_pass_test.rs
index ddb91c55b..0e2493db6 100644
--- a/crates/backend-uzu/tests/unit/kernel/attention/attention_single_pass_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/attention/attention_single_pass_test.rs
@@ -1,22 +1,20 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::ArrayElement,
backends::{
common::{Allocation, Backend, Context, Encoder, Kernels, kernel::AttentionSinglePassKernel},
cpu::Cpu,
},
- data_type::DataType,
-};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{
common::{
assert::assert_eq_float,
helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
},
- uzu_test,
+ data_type::DataType,
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/kernel/attention/attention_two_pass_test.rs b/crates/backend-uzu/unit/backends/common/kernel/attention/attention_two_pass_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/attention/attention_two_pass_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/attention/attention_two_pass_test.rs
index e626e97bf..6e835472f 100644
--- a/crates/backend-uzu/tests/unit/kernel/attention/attention_two_pass_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/attention/attention_two_pass_test.rs
@@ -1,6 +1,10 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{
@@ -9,12 +13,9 @@ use backend_uzu::{
},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
const TOTAL_BLOCKS_COUNT: u32 = 32;
diff --git a/crates/backend-uzu/tests/unit/kernel/attention/attention_update_kv_cache_test.rs b/crates/backend-uzu/unit/backends/common/kernel/attention/attention_update_kv_cache_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/attention/attention_update_kv_cache_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/attention/attention_update_kv_cache_test.rs
index 306f0dd6e..b124a663e 100644
--- a/crates/backend-uzu/tests/unit/kernel/attention/attention_update_kv_cache_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/attention/attention_update_kv_cache_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::AttentionUpdateKVCacheKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
rotated_keys: Option<Box<[T]>>,
diff --git a/crates/backend-uzu/tests/unit/kernel/attention/mod.rs b/crates/backend-uzu/unit/backends/common/kernel/attention/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/kernel/attention/mod.rs
rename to crates/backend-uzu/unit/backends/common/kernel/attention/mod.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/attention/sigmoid_gate_test.rs b/crates/backend-uzu/unit/backends/common/kernel/attention/sigmoid_gate_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/attention/sigmoid_gate_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/attention/sigmoid_gate_test.rs
index 5d2a5853b..43c7864c2 100644
--- a/crates/backend-uzu/tests/unit/kernel/attention/sigmoid_gate_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/attention/sigmoid_gate_test.rs
@@ -1,16 +1,16 @@
use std::fmt::Debug;
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::SigmoidGateKernel},
cpu::Cpu,
},
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::uzu_test;
struct Config {
num_heads: u32,
diff --git a/crates/backend-uzu/tests/unit/kernel/audio/audio_test.rs b/crates/backend-uzu/unit/backends/common/kernel/audio/audio_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/audio/audio_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/audio/audio_test.rs
index 4d9dda729..f83d517c0 100644
--- a/crates/backend-uzu/tests/unit/kernel/audio/audio_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/audio/audio_test.rs
@@ -1,6 +1,8 @@
#![cfg(metal_backend)]
-use backend_uzu::{
+use proc_macros::uzu_test;
+
+use crate::{
array::ArrayContextExt,
backends::{
common::{
@@ -14,10 +16,6 @@ use backend_uzu::{
},
metal::Metal,
},
- data_type::DataType,
-};
-
-use crate::{
common::{
audio::{
fsq_reference::{fsq_decode_reference, fsq_encode_reference},
@@ -29,7 +27,7 @@ use crate::{
},
helpers::allocation_to_vec,
},
- uzu_test,
+ data_type::DataType,
};
macro_rules! borrow_array_buffer {
diff --git a/crates/backend-uzu/tests/unit/kernel/audio/mod.rs b/crates/backend-uzu/unit/backends/common/kernel/audio/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/kernel/audio/mod.rs
rename to crates/backend-uzu/unit/backends/common/kernel/audio/mod.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/delta_net_test.rs b/crates/backend-uzu/unit/backends/common/kernel/delta_net_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/delta_net_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/delta_net_test.rs
index 8338bcda0..da0bf5193 100644
--- a/crates/backend-uzu/tests/unit/kernel/delta_net_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/delta_net_test.rs
@@ -1,6 +1,9 @@
#![cfg(metal_backend)]
-use backend_uzu::{
+use half::bf16;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{
@@ -15,9 +18,6 @@ use backend_uzu::{
},
data_type::DataType,
};
-use half::bf16;
-
-use crate::uzu_test;
fn run_conv_update<B: Backend>(
in_proj: &[f32],
diff --git a/crates/backend-uzu/tests/unit/kernel/embedding/embedding_rows_sum_test.rs b/crates/backend-uzu/unit/backends/common/kernel/embedding/embedding_rows_sum_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/embedding/embedding_rows_sum_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/embedding/embedding_rows_sum_test.rs
index f23ed9896..a47ba4b08 100644
--- a/crates/backend-uzu/tests/unit/kernel/embedding/embedding_rows_sum_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/embedding/embedding_rows_sum_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::EmbeddingRowsSumKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
token_indices: Box<[u32]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/embedding/full_precision_embedding_test.rs b/crates/backend-uzu/unit/backends/common/kernel/embedding/full_precision_embedding_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/embedding/full_precision_embedding_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/embedding/full_precision_embedding_test.rs
index 810aace2e..2c39e10e5 100644
--- a/crates/backend-uzu/tests/unit/kernel/embedding/full_precision_embedding_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/embedding/full_precision_embedding_test.rs
@@ -1,13 +1,13 @@
use std::fmt::Debug;
-use backend_uzu::{
- array::{ArrayContextExt, ArrayElement},
- backends::common::{Backend, Context, Encoder, Kernels, kernel::FullPrecisionEmbeddingLookupKernel},
-};
use half::{bf16, f16};
use num_traits::Float;
+use proc_macros::uzu_test;
-use crate::uzu_test;
+use crate::{
+ array::{ArrayContextExt, ArrayElement},
+ backends::common::{Backend, Context, Encoder, Kernels, kernel::FullPrecisionEmbeddingLookupKernel},
+};
struct Input<T: ArrayElement + Float> {
token_ids: Box<[u64]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/embedding/mod.rs b/crates/backend-uzu/unit/backends/common/kernel/embedding/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/kernel/embedding/mod.rs
rename to crates/backend-uzu/unit/backends/common/kernel/embedding/mod.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/embedding/quant_embedding_test.rs b/crates/backend-uzu/unit/backends/common/kernel/embedding/quant_embedding_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/embedding/quant_embedding_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/embedding/quant_embedding_test.rs
index 8ec59df75..192914d55 100644
--- a/crates/backend-uzu/tests/unit/kernel/embedding/quant_embedding_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/embedding/quant_embedding_test.rs
@@ -1,6 +1,10 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{
@@ -10,12 +14,9 @@ use backend_uzu::{
},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
token_ids: Box<[u64]>,
@@ -287,7 +288,7 @@ fn test_symmetric_u8<T: ArrayElement + Float + Debug + Display>() {
#[cfg(metal_backend)]
fn test_zero_point_group16_hadamard_constructor<T: ArrayElement + Float + Debug + Display>() {
- use backend_uzu::backends::metal::Metal;
+ use crate::backends::metal::Metal;
let context = <Metal as Backend>::Context::new().expect("Metal context");
<<Metal as Backend>::Kernels as Kernels>::QuantizedEmbeddingLookupKernel::new(
diff --git a/crates/backend-uzu/tests/unit/kernel/gated_act_mul_test.rs b/crates/backend-uzu/unit/backends/common/kernel/gated_act_mul_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/gated_act_mul_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/gated_act_mul_test.rs
index b86fea0d3..a398de84e 100644
--- a/crates/backend-uzu/tests/unit/kernel/gated_act_mul_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/gated_act_mul_test.rs
@@ -1,6 +1,10 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::ArrayElement,
backends::{
common::{
@@ -8,17 +12,11 @@ use backend_uzu::{
},
cpu::Cpu,
},
- data_type::DataType,
-};
-use half::bf16;
-use num_traits::Float;
-
-use crate::{
common::{
assert::assert_eq_float,
helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
},
- uzu_test,
+ data_type::DataType,
};
struct InterleavedInput<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/kernel/hadamard_transform_test.rs b/crates/backend-uzu/unit/backends/common/kernel/hadamard_transform_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/hadamard_transform_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/hadamard_transform_test.rs
index 0a147e02d..65a2be7e2 100644
--- a/crates/backend-uzu/tests/unit/kernel/hadamard_transform_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/hadamard_transform_test.rs
@@ -1,15 +1,15 @@
use std::fmt::Debug;
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::common::{
Backend, Context, Encoder, Kernels, gpu_types::HadamardTransformOrder, kernel::HadamardTransformKernel,
},
};
-use half::bf16;
-use num_traits::Float;
-
-use crate::uzu_test;
const BLOCK_SIZE: usize = 32;
diff --git a/crates/backend-uzu/tests/unit/kernel/kv_cache_update_test.rs b/crates/backend-uzu/unit/backends/common/kernel/kv_cache_update_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/kv_cache_update_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/kv_cache_update_test.rs
index 018b7a7cc..53b691a24 100644
--- a/crates/backend-uzu/tests/unit/kernel/kv_cache_update_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/kv_cache_update_test.rs
@@ -1,16 +1,17 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, gpu_types::Swap, kernel::KVCacheUpdateKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
keys: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/layer_norm_test.rs b/crates/backend-uzu/unit/backends/common/kernel/layer_norm_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/layer_norm_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/layer_norm_test.rs
index 66cc28480..3172d9121 100644
--- a/crates/backend-uzu/tests/unit/kernel/layer_norm_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/layer_norm_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::LayerNormKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
static BOOL_ALL: &[bool] = &[true, false];
static BOOL_FALSE: &[bool] = &[false];
diff --git a/crates/backend-uzu/tests/unit/kernel/logit_soft_cap_test.rs b/crates/backend-uzu/unit/backends/common/kernel/logit_soft_cap_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/logit_soft_cap_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/logit_soft_cap_test.rs
index 9e1470751..9edbb5422 100644
--- a/crates/backend-uzu/tests/unit/kernel/logit_soft_cap_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/logit_soft_cap_test.rs
@@ -1,22 +1,20 @@
use std::fmt::Display;
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::ArrayElement,
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::LogitSoftCapKernel},
cpu::Cpu,
},
- data_type::DataType,
-};
-use half::bf16;
-use num_traits::Float;
-
-use crate::{
common::{
assert::assert_eq_float,
helpers::{alloc_allocation_with_data, allocation_to_vec},
},
- uzu_test,
+ data_type::DataType,
};
fn get_output<T: ArrayElement + Float, B: Backend>(
diff --git a/crates/backend-uzu/tests/unit/kernel/matmul/dispatch_paths_test.rs b/crates/backend-uzu/unit/backends/common/kernel/matmul/dispatch_paths_test.rs
similarity index 97%
rename from crates/backend-uzu/tests/unit/kernel/matmul/dispatch_paths_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/matmul/dispatch_paths_test.rs
index 15951e0af..09439d4dd 100644
--- a/crates/backend-uzu/tests/unit/kernel/matmul/dispatch_paths_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/matmul/dispatch_paths_test.rs
@@ -2,7 +2,11 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use rstest::rstest;
+
+use crate::{
array::ArrayElement,
backends::{
common::{
@@ -11,14 +15,10 @@ use backend_uzu::{
},
metal::{GemmDispatchPath, Metal, MetalContext},
},
-};
-use half::bf16;
-use num_traits::Float;
-use rstest::rstest;
-
-use crate::common::{
- assert::assert_eq_float,
- matmul::{Case, all_correctness_shapes, cpu_reference, deterministic_input, run_metal},
+ common::{
+ assert::assert_eq_float,
+ matmul::{Case, all_correctness_shapes, cpu_reference, deterministic_input, run_metal},
+ },
};
fn gemm_paths_for_hw(context: &MetalContext) -> Vec<GemmDispatchPath> {
diff --git a/crates/backend-uzu/tests/unit/kernel/matmul/gemv_test.rs b/crates/backend-uzu/unit/backends/common/kernel/matmul/gemv_test.rs
similarity index 96%
rename from crates/backend-uzu/tests/unit/kernel/matmul/gemv_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/matmul/gemv_test.rs
index 6164d631d..d080c73f5 100644
--- a/crates/backend-uzu/tests/unit/kernel/matmul/gemv_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/matmul/gemv_test.rs
@@ -1,6 +1,10 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use rstest::rstest;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{
@@ -12,14 +16,10 @@ use backend_uzu::{
},
cpu::Cpu,
},
-};
-use half::bf16;
-use num_traits::Float;
-use rstest::rstest;
-
-use crate::common::{
- assert::assert_eq_float,
- helpers::{alloc_allocation_with_data, allocation_to_vec},
+ common::{
+ assert::assert_eq_float,
+ helpers::{alloc_allocation_with_data, allocation_to_vec},
+ },
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/kernel/matmul/mod.rs b/crates/backend-uzu/unit/backends/common/kernel/matmul/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/kernel/matmul/mod.rs
rename to crates/backend-uzu/unit/backends/common/kernel/matmul/mod.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/matmul/quant_dispatch_test.rs b/crates/backend-uzu/unit/backends/common/kernel/matmul/quant_dispatch_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/matmul/quant_dispatch_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/matmul/quant_dispatch_test.rs
index 4f91ca4ae..fba4d7f8b 100644
--- a/crates/backend-uzu/tests/unit/kernel/matmul/quant_dispatch_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/matmul/quant_dispatch_test.rs
@@ -5,7 +5,12 @@ use std::{
fmt::{Debug, Display},
};
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use proc_macros::uzu_test;
+use rstest::rstest;
+
+use crate::{
array::ArrayElement,
backends::{
common::{
@@ -19,15 +24,10 @@ use backend_uzu::{
cpu::Cpu,
metal::{GemmDispatchPath, Metal, MetalContext},
},
-};
-use half::bf16;
-use num_traits::Float;
-use proc_macros::__internal_uzu_test as uzu_test;
-use rstest::rstest;
-
-use crate::common::{
- helpers::allocation_to_vec,
- matmul::{QuantBuffers, QuantInput, quant_arguments, run_quant_cpu, run_quant_metal},
+ common::{
+ helpers::allocation_to_vec,
+ matmul::{QuantBuffers, QuantInput, quant_arguments, run_quant_cpu, run_quant_metal},
+ },
};
fn check_tolerance(
diff --git a/crates/backend-uzu/tests/unit/kernel/mod.rs b/crates/backend-uzu/unit/backends/common/kernel/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/kernel/mod.rs
rename to crates/backend-uzu/unit/backends/common/kernel/mod.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/moe/mod.rs b/crates/backend-uzu/unit/backends/common/kernel/moe/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/kernel/moe/mod.rs
rename to crates/backend-uzu/unit/backends/common/kernel/moe/mod.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/moe/moe_counts_offsets_fused_test.rs b/crates/backend-uzu/unit/backends/common/kernel/moe/moe_counts_offsets_fused_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/moe/moe_counts_offsets_fused_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/moe/moe_counts_offsets_fused_test.rs
index 6d7da4e07..ae2268b1e 100644
--- a/crates/backend-uzu/tests/unit/kernel/moe/moe_counts_offsets_fused_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/moe/moe_counts_offsets_fused_test.rs
@@ -1,13 +1,13 @@
-use backend_uzu::{
+use proc_macros::uzu_test;
+use rand::{RngExt, SeedableRng, rngs::StdRng};
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::MoeCountsOffsetsFusedKernel},
cpu::Cpu,
},
};
-use rand::{RngExt, SeedableRng, rngs::StdRng};
-
-use crate::uzu_test;
fn gen_random_topk_ids(
t: usize,
diff --git a/crates/backend-uzu/tests/unit/kernel/moe/moe_finalize_test.rs b/crates/backend-uzu/unit/backends/common/kernel/moe/moe_finalize_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/moe/moe_finalize_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/moe/moe_finalize_test.rs
index c1c506bd1..6ec7d2073 100644
--- a/crates/backend-uzu/tests/unit/kernel/moe/moe_finalize_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/moe/moe_finalize_test.rs
@@ -1,18 +1,16 @@
-use backend_uzu::{
- array::{ArrayContextExt, ArrayElement},
- backends::{
- common::{Backend, Encoder, Kernels, kernel::MoeFinalizeKernel},
- cpu::Cpu,
- },
- data_type::DataType,
-};
use half::bf16;
use num_traits::Float;
+use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
use crate::{
+ array::{ArrayContextExt, ArrayElement},
+ backends::{
+ common::{Backend, Encoder, Kernels, kernel::MoeFinalizeKernel},
+ cpu::Cpu,
+ },
common::{assert::assert_eq_float, helpers::create_context},
- uzu_test,
+ data_type::DataType,
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/kernel/moe/moe_router_topk_test.rs b/crates/backend-uzu/unit/backends/common/kernel/moe/moe_router_topk_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/moe/moe_router_topk_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/moe/moe_router_topk_test.rs
index 861b2fed2..033f8aa6a 100644
--- a/crates/backend-uzu/tests/unit/kernel/moe/moe_router_topk_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/moe/moe_router_topk_test.rs
@@ -1,18 +1,19 @@
use std::fmt::Debug;
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use proc_macros::uzu_test;
+use rand::{RngExt, SeedableRng, rngs::StdRng};
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Encoder, Kernels, kernel::MoeRouterTopKKernel},
cpu::Cpu,
},
+ common::helpers::create_context,
data_type::DataType,
};
-use half::bf16;
-use num_traits::Float;
-use rand::{RngExt, SeedableRng, rngs::StdRng};
-
-use crate::{common::helpers::create_context, uzu_test};
fn get_output<B: Backend, T: ArrayElement + Float>(
input: &[T],
diff --git a/crates/backend-uzu/tests/unit/kernel/moe/moe_scatter_test.rs b/crates/backend-uzu/unit/backends/common/kernel/moe/moe_scatter_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/moe/moe_scatter_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/moe/moe_scatter_test.rs
index 35ab07e5c..e504f4871 100644
--- a/crates/backend-uzu/tests/unit/kernel/moe/moe_scatter_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/moe/moe_scatter_test.rs
@@ -1,4 +1,9 @@
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use proc_macros::uzu_test;
+use rand::{RngExt, SeedableRng, rngs::StdRng};
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{
@@ -10,13 +15,9 @@ use backend_uzu::{
},
cpu::Cpu,
},
+ common::helpers::create_context,
data_type::DataType,
};
-use half::bf16;
-use num_traits::Float;
-use rand::{RngExt, SeedableRng, rngs::StdRng};
-
-use crate::{common::helpers::create_context, uzu_test};
fn cpu_expert_buckets<T: ArrayElement + Float>(
topk_ids: &[i32],
diff --git a/crates/backend-uzu/tests/unit/kernel/pooling/mod.rs b/crates/backend-uzu/unit/backends/common/kernel/pooling/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/kernel/pooling/mod.rs
rename to crates/backend-uzu/unit/backends/common/kernel/pooling/mod.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/pooling/pooling_cls_test.rs b/crates/backend-uzu/unit/backends/common/kernel/pooling/pooling_cls_test.rs
similarity index 97%
rename from crates/backend-uzu/tests/unit/kernel/pooling/pooling_cls_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/pooling/pooling_cls_test.rs
index ad82d3c14..94efe494e 100644
--- a/crates/backend-uzu/tests/unit/kernel/pooling/pooling_cls_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/pooling/pooling_cls_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::PoolingClsKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
input: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/pooling/pooling_mean_test.rs b/crates/backend-uzu/unit/backends/common/kernel/pooling/pooling_mean_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/pooling/pooling_mean_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/pooling/pooling_mean_test.rs
index 0087dede7..1f50d9bd1 100644
--- a/crates/backend-uzu/tests/unit/kernel/pooling/pooling_mean_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/pooling/pooling_mean_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::PoolingMeanKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
input: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/qk_unpack_test.rs b/crates/backend-uzu/unit/backends/common/kernel/qk_unpack_test.rs
similarity index 97%
rename from crates/backend-uzu/tests/unit/kernel/qk_unpack_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/qk_unpack_test.rs
index 0e6a5d71c..ff80602cd 100644
--- a/crates/backend-uzu/tests/unit/kernel/qk_unpack_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/qk_unpack_test.rs
@@ -1,16 +1,17 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::QkUnpackKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
};
-use half::bf16;
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
fn run<T: ArrayElement + Float + Debug + Display, B: Backend>(
num_heads: u32,
diff --git a/crates/backend-uzu/tests/unit/kernel/qkv_norm_test.rs b/crates/backend-uzu/unit/backends/common/kernel/qkv_norm_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/qkv_norm_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/qkv_norm_test.rs
index 232a7dad6..6576df437 100644
--- a/crates/backend-uzu/tests/unit/kernel/qkv_norm_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/qkv_norm_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
- common::{Backend, Context, Encoder, Kernels, kernel::QKVNormKernel},
+ common::{Allocation, Backend, Context, Encoder, Kernels, kernel::QKVNormKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<InputT: ArrayElement + Float, ScaleT: ArrayElement + Float, OutputT: ArrayElement + Float> {
qkv: Box<[OutputT]>,
@@ -139,7 +140,7 @@ fn get_output<
let mut encoder = Encoder::new(context.as_ref()).expect("Failed to create encoder");
kernel.encode(
- None::<&backend_uzu::backends::common::Allocation<B>>,
+ None::<&Allocation<B>>,
scales,
&mut qkv,
input.batch_size,
diff --git a/crates/backend-uzu/tests/unit/kernel/rms_norm_test.rs b/crates/backend-uzu/unit/backends/common/kernel/rms_norm_test.rs
similarity index 78%
rename from crates/backend-uzu/tests/unit/kernel/rms_norm_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/rms_norm_test.rs
index b5d7150ed..550bd408f 100644
--- a/crates/backend-uzu/tests/unit/kernel/rms_norm_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/rms_norm_test.rs
@@ -3,24 +3,20 @@ use std::{
time::{Duration, Instant},
};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+use rand::{RngExt, SeedableRng, rngs::SmallRng};
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Allocation, Backend, Context, Encoder, Kernels, kernel::RMSNormKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use criterion::{BenchmarkId, Criterion, Throughput};
-use half::{bf16, f16};
-use itertools::iproduct;
-use num_traits::Float;
-use rand::{RngExt, SeedableRng, rngs::SmallRng};
-
-use crate::{
- common::{assert::assert_eq_float, type_short_name},
- uzu_bench, uzu_test,
-};
static BOOL_ALL: &[bool] = &[true, false];
static BOOL_FALSE: &[bool] = &[false];
@@ -241,24 +237,6 @@ fn test_edge<
}
}
-fn get_rms_norm_data(
- seed: u64,
- batch_size: usize,
- model_dim: usize,
-) -> (Box<[f32]>, Box<[f32]>) {
- let mut rng = SmallRng::seed_from_u64(seed);
- let input_size = batch_size * model_dim;
- let mut input_data = vec![0.0f32; input_size];
- for x in input_data.iter_mut() {
- *x = rng.random_range(-2.0f32..2.0f32);
- }
- let mut scale_data = vec![0.0f32; model_dim];
- for x in scale_data.iter_mut() {
- *x = rng.random_range(0.1f32..3.0f32);
- }
- (input_data.into_boxed_slice(), scale_data.into_boxed_slice())
-}
-
// AccumT f32
#[uzu_test]
fn test_f32_f32_f32_f32() {
@@ -455,79 +433,3 @@ fn test_post_layer_scalar_metal_matches_cpu() {
});
}
}
-
-// benchmarks
-#[uzu_bench]
-fn bench_rms_norm(c: &mut Criterion) {
- type T = f32;
- let epsilon = 1e-6f32;
- let scale_offset = 0.0f32;
-
- for_each_backend!(|B| {
- let context = <B as Backend>::Context::new().unwrap();
-
- let kernel = <<B as Backend>::Kernels as Kernels>::RMSNormKernel::new(
- &context,
- T::data_type(),
- T::data_type(),
- T::data_type(),
- T::data_type(),
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- )
- .unwrap();
-
- let mut group = c.benchmark_group(format!("{}/Kernel/RMSNorm", type_short_name::<B>()));
-
- for (batch_size, model_dim) in iproduct!(
- [1, 4, 32, 128, 1024], // Batch sizes
- [
- 1024, // LFM2-350M
- 1152, // Gemma-3-1b
- 2048, // Llama-3.2-1B
- 2560, // Qwen3-4B
- 3072, // Llama-3.2-3B
- 4096, // Qwen3-8B
- 5120, // Qwen2.5-32B
- ]
- ) {
- let (input_data, scale_data) = get_rms_norm_data(1337, batch_size, model_dim);
- let input_size = batch_size * model_dim;
-
- let input_buffer = context.create_array_from(&[input_size], input_data.as_ref()).into_allocation();
- let scales_buffer = context.create_array_from(&[model_dim], scale_data.as_ref()).into_allocation();
- let mut output_buffer = context.create_array_uninitialized(&[input_size], T::data_type()).into_allocation();
-
- group.throughput(Throughput::Elements((batch_size * model_dim) as u64));
-
- group.bench_function(BenchmarkId::from_parameter(format!("Batch[{batch_size}]Dim[{model_dim}]")), |b| {
- b.iter_custom(|n_iters| {
- let mut encoder = Encoder::<B>::new(&context).unwrap();
-
- for _ in 0..n_iters {
- kernel.encode(
- Some(&input_buffer),
- &scales_buffer,
- &mut output_buffer,
- None::<&mut Allocation<B>>,
- None::<&Allocation<B>>,
- batch_size as u32,
- model_dim as u32,
- epsilon,
- scale_offset,
- 1.0,
- &mut encoder,
- );
- }
-
- encoder.end_encoding().submit().wait_until_completed().unwrap().gpu_execution_time()
- })
- });
- }
- });
-}
diff --git a/crates/backend-uzu/tests/unit/kernel/rope_test.rs b/crates/backend-uzu/unit/backends/common/kernel/rope_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/rope_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/rope_test.rs
index 6da80abdf..186718a03 100644
--- a/crates/backend-uzu/tests/unit/kernel/rope_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/rope_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::RopeKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
qkv: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/short_conv/mod.rs b/crates/backend-uzu/unit/backends/common/kernel/short_conv/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/kernel/short_conv/mod.rs
rename to crates/backend-uzu/unit/backends/common/kernel/short_conv/mod.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_decode_test.rs b/crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_decode_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_decode_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_decode_test.rs
index 11240d29a..97198c13d 100644
--- a/crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_decode_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_decode_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::ShortConvDecodeKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
in_proj: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_pack_test.rs b/crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_pack_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_pack_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_pack_test.rs
index e1653a0f5..e6dee8383 100644
--- a/crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_pack_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_pack_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::ShortConvPackKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
state_in: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_prefill_test.rs b/crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_prefill_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_prefill_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_prefill_test.rs
index 0cd00ad97..26822a6c0 100644
--- a/crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_prefill_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_prefill_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::ShortConvPrefillKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
padded: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_trie_test.rs b/crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_trie_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_trie_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_trie_test.rs
index ab3f600f4..478bd1292 100644
--- a/crates/backend-uzu/tests/unit/kernel/short_conv/short_conv_trie_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/short_conv/short_conv_trie_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::ShortConvTrieKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
in_proj: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/ssm/mod.rs b/crates/backend-uzu/unit/backends/common/kernel/ssm/mod.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/kernel/ssm/mod.rs
rename to crates/backend-uzu/unit/backends/common/kernel/ssm/mod.rs
diff --git a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_conv1d_decode_test.rs b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_conv1d_decode_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/ssm/ssm_conv1d_decode_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_conv1d_decode_test.rs
index fc21a1c59..3c82b1c5a 100644
--- a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_conv1d_decode_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_conv1d_decode_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, gpu_types::ActivationType, kernel::Conv1dDecodeKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
x: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_conv1d_pack_test.rs b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_conv1d_pack_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/ssm/ssm_conv1d_pack_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_conv1d_pack_test.rs
index 183732e73..6aec4651f 100644
--- a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_conv1d_pack_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_conv1d_pack_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::bf16;
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::Conv1dPackKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::bf16;
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
state_in: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_conv1d_scan_test.rs b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_conv1d_scan_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/ssm/ssm_conv1d_scan_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_conv1d_scan_test.rs
index b569f4c62..7ed07d878 100644
--- a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_conv1d_scan_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_conv1d_scan_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, gpu_types::ActivationType, kernel::Conv1dScanKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
padded: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_prefill_test.rs b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_prefill_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/ssm/ssm_prefill_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_prefill_test.rs
index 645484063..7fc146a0d 100644
--- a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_prefill_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_prefill_test.rs
@@ -1,6 +1,10 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{
@@ -9,12 +13,9 @@ use backend_uzu::{
},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
x: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_split_inproj_test.rs b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_split_inproj_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/ssm/ssm_split_inproj_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_split_inproj_test.rs
index 4ecda53dc..583d27934 100644
--- a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_split_inproj_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_split_inproj_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::SplitInProjKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
input: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_update_test.rs b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_update_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/ssm/ssm_update_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_update_test.rs
index 69de7daf0..6e88d8291 100644
--- a/crates/backend-uzu/tests/unit/kernel/ssm/ssm_update_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/ssm/ssm_update_test.rs
@@ -1,17 +1,18 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::{ArrayContextExt, ArrayElement},
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::SSDUpdateKernel},
cpu::Cpu,
},
+ common::assert::assert_eq_float,
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{common::assert::assert_eq_float, uzu_test};
struct Input<T: ArrayElement + Float> {
x: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/kernel/tensor_add_bias_test.rs b/crates/backend-uzu/unit/backends/common/kernel/tensor_add_bias_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/tensor_add_bias_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/tensor_add_bias_test.rs
index 7808ac0cd..1196acb21 100644
--- a/crates/backend-uzu/tests/unit/kernel/tensor_add_bias_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/tensor_add_bias_test.rs
@@ -1,15 +1,13 @@
use std::fmt::Debug;
-use backend_uzu::{
- array::ArrayElement,
- backends::common::{Backend, Context, Encoder, Kernels, kernel::TensorAddBiasKernel},
-};
use half::{bf16, f16};
use num_traits::Float;
+use proc_macros::uzu_test;
use crate::{
+ array::ArrayElement,
+ backends::common::{Backend, Context, Encoder, Kernels, kernel::TensorAddBiasKernel},
common::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
- uzu_test,
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/kernel/tensor_add_scale_test.rs b/crates/backend-uzu/unit/backends/common/kernel/tensor_add_scale_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/kernel/tensor_add_scale_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/tensor_add_scale_test.rs
index a302876cc..634636063 100644
--- a/crates/backend-uzu/tests/unit/kernel/tensor_add_scale_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/tensor_add_scale_test.rs
@@ -1,22 +1,20 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+use proc_macros::uzu_test;
+
+use crate::{
array::ArrayElement,
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::TensorAddScaleKernel},
cpu::Cpu,
},
- data_type::DataType,
-};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use crate::{
common::{
assert::assert_eq_float,
helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
},
- uzu_test,
+ data_type::DataType,
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/kernel/tensor_add_swap_test.rs b/crates/backend-uzu/unit/backends/common/kernel/tensor_add_swap_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/tensor_add_swap_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/tensor_add_swap_test.rs
index bbf985d2d..d642d05e5 100644
--- a/crates/backend-uzu/tests/unit/kernel/tensor_add_swap_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/tensor_add_swap_test.rs
@@ -1,15 +1,13 @@
use std::fmt::Debug;
-use backend_uzu::{
- array::ArrayElement,
- backends::common::{Backend, Context, Encoder, Kernels, kernel::TensorAddSwapKernel},
-};
use half::{bf16, f16};
use num_traits::Float;
+use proc_macros::uzu_test;
use crate::{
+ array::ArrayElement,
+ backends::common::{Backend, Context, Encoder, Kernels, kernel::TensorAddSwapKernel},
common::helpers::{alloc_allocation_with_data, allocation_to_vec},
- uzu_test,
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/kernel/tensor_copy_test.rs b/crates/backend-uzu/unit/backends/common/kernel/tensor_copy_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/kernel/tensor_copy_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/tensor_copy_test.rs
index 5b329cf8d..5d545401d 100644
--- a/crates/backend-uzu/tests/unit/kernel/tensor_copy_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/tensor_copy_test.rs
@@ -1,15 +1,13 @@
use std::fmt::Debug;
-use backend_uzu::{
- array::ArrayElement,
- backends::common::{Backend, Context, Encoder, Kernels, kernel::TensorCopyKernel},
-};
use half::{bf16, f16};
use num_traits::Float;
+use proc_macros::uzu_test;
use crate::{
+ array::ArrayElement,
+ backends::common::{Backend, Context, Encoder, Kernels, kernel::TensorCopyKernel},
common::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
- uzu_test,
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/kernel/token_copy_test.rs b/crates/backend-uzu/unit/backends/common/kernel/token_copy_test.rs
similarity index 92%
rename from crates/backend-uzu/tests/unit/kernel/token_copy_test.rs
rename to crates/backend-uzu/unit/backends/common/kernel/token_copy_test.rs
index 45fba0c1a..5b9c22236 100644
--- a/crates/backend-uzu/tests/unit/kernel/token_copy_test.rs
+++ b/crates/backend-uzu/unit/backends/common/kernel/token_copy_test.rs
@@ -1,11 +1,11 @@
-use backend_uzu::backends::common::{
- Allocation, Backend, Context, Encoder, Kernels,
- kernel::{TokenCopySampledKernel, TokenCopyToResultsKernel},
-};
+use proc_macros::uzu_test;
use crate::{
+ backends::common::{
+ Allocation, Backend, Context, Encoder, Kernels,
+ kernel::{TokenCopySampledKernel, TokenCopyToResultsKernel},
+ },
common::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
- uzu_test,
};
fn test_token_copy_sampled_impl<B: Backend>(src_value: u32) {
diff --git a/crates/backend-uzu/tests/unit/backends/metal/sparse/sparse_buffer_test.rs b/crates/backend-uzu/unit/backends/metal/sparse/sparse_buffer_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/backends/metal/sparse/sparse_buffer_test.rs
rename to crates/backend-uzu/unit/backends/metal/sparse/sparse_buffer_test.rs
index c11581e2a..e35cb489d 100644
--- a/crates/backend-uzu/tests/unit/backends/metal/sparse/sparse_buffer_test.rs
+++ b/crates/backend-uzu/unit/backends/metal/sparse/sparse_buffer_test.rs
@@ -1,12 +1,13 @@
use std::ops::Range;
-use backend_uzu::backends::{
- common::{Backend, SparseBuffer},
- metal::Metal,
+use crate::{
+ backends::{
+ common::{Backend, SparseBuffer},
+ metal::Metal,
+ },
+ common::helpers::{create_context, sparse_buffer_create},
};
-use crate::common::helpers::{create_context, sparse_buffer_create};
-
/// Capacity sized to fit `heap_count` worth of heaps.
fn buffer_capacity(
ctx: &<Metal as Backend>::Context,
diff --git a/crates/backend-uzu/tests/unit/backends/metal/sparse/sparse_heap_pool_test.rs b/crates/backend-uzu/unit/backends/metal/sparse/sparse_heap_pool_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/backends/metal/sparse/sparse_heap_pool_test.rs
rename to crates/backend-uzu/unit/backends/metal/sparse/sparse_heap_pool_test.rs
diff --git a/crates/backend-uzu/tests/unit/encodable_block/attention_gemm_test.rs b/crates/backend-uzu/unit/encodable_block/attention_gemm_test.rs
similarity index 97%
rename from crates/backend-uzu/tests/unit/encodable_block/attention_gemm_test.rs
rename to crates/backend-uzu/unit/encodable_block/attention_gemm_test.rs
index 6e547fe54..dd97c47ee 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/attention_gemm_test.rs
+++ b/crates/backend-uzu/unit/encodable_block/attention_gemm_test.rs
@@ -1,21 +1,21 @@
use std::fmt::{Debug, Display};
-use backend_uzu::{
+use half::{bf16, f16};
+use num_traits::Float;
+
+use super::{AttentionGemmArguments, AttentionGemmBlock};
+use crate::{
array::ArrayElement,
backends::{
common::{Allocation, Backend, Context, Encoder},
cpu::Cpu,
},
+ common::{
+ assert::assert_eq_float,
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ },
data_type::DataType,
};
-use half::{bf16, f16};
-use num_traits::Float;
-
-use super::{AttentionGemmArguments, AttentionGemmBlock};
-use crate::common::{
- assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
-};
struct Input<T: ArrayElement + Float> {
queries: Box<[T]>,
diff --git a/crates/backend-uzu/tests/unit/encodable_block/attention_test.rs b/crates/backend-uzu/unit/encodable_block/attention_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/encodable_block/attention_test.rs
rename to crates/backend-uzu/unit/encodable_block/attention_test.rs
diff --git a/crates/backend-uzu/tests/unit/encodable_block/kv_cache_update_test.rs b/crates/backend-uzu/unit/encodable_block/kv_cache_update_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/encodable_block/kv_cache_update_test.rs
rename to crates/backend-uzu/unit/encodable_block/kv_cache_update_test.rs
diff --git a/crates/backend-uzu/tests/unit/encodable_block/mamba_mixer/ssd_prefill_test.rs b/crates/backend-uzu/unit/encodable_block/mamba_mixer/ssd_prefill_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/encodable_block/mamba_mixer/ssd_prefill_test.rs
rename to crates/backend-uzu/unit/encodable_block/mamba_mixer/ssd_prefill_test.rs
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/mod.rs b/crates/backend-uzu/unit/encodable_block/moe/mod.rs
similarity index 91%
rename from crates/backend-uzu/tests/unit/encodable_block/moe/mod.rs
rename to crates/backend-uzu/unit/encodable_block/moe/mod.rs
index 75ba76114..690d3459e 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/mod.rs
+++ b/crates/backend-uzu/unit/encodable_block/moe/mod.rs
@@ -5,10 +5,10 @@ use super::{
};
mod moe_block_e2e_test;
-#[path = "../../../performance/encodable_block/moe/moe_experts_perf_test.rs"]
+#[path = "../../../unit/encodable_block/moe/moe_experts_perf_test.rs"]
mod moe_experts_perf_test;
mod moe_experts_test;
-#[path = "../../../performance/encodable_block/moe/moe_perf_test.rs"]
+#[path = "../../../unit/encodable_block/moe/moe_perf_test.rs"]
mod moe_perf_test;
mod moe_tiles_test;
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_block_e2e_test.rs b/crates/backend-uzu/unit/encodable_block/moe/moe_block_e2e_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/encodable_block/moe/moe_block_e2e_test.rs
rename to crates/backend-uzu/unit/encodable_block/moe/moe_block_e2e_test.rs
index 310ed0184..4fc9c9797 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_block_e2e_test.rs
+++ b/crates/backend-uzu/unit/encodable_block/moe/moe_block_e2e_test.rs
@@ -1,4 +1,8 @@
-use backend_uzu::{
+use half::bf16;
+use rand::{RngExt, SeedableRng, rngs::StdRng};
+
+use super::{MoeExpertsTwoPassArguments, MoeExpertsTwoPassPrefillBlock, MoeGather};
+use crate::{
backends::common::{
Backend, Encoder, Kernels,
gpu_types::{ActivationType, activation_silu_alpha},
@@ -7,15 +11,11 @@ use backend_uzu::{
MoeScatterBucketsMapKernel,
},
},
+ common::helpers::{
+ alloc_allocation, alloc_allocation_with_data, allocation_prefix_to_vec, allocation_to_vec, create_context,
+ },
data_type::DataType,
};
-use half::bf16;
-use rand::{RngExt, SeedableRng, rngs::StdRng};
-
-use super::{MoeExpertsTwoPassArguments, MoeExpertsTwoPassPrefillBlock, MoeGather};
-use crate::common::helpers::{
- alloc_allocation, alloc_allocation_with_data, allocation_prefix_to_vec, allocation_to_vec, create_context,
-};
fn moe_cpu_reference(
x: &[bf16],
diff --git a/crates/backend-uzu/tests/performance/encodable_block/moe/moe_experts_perf_test.rs b/crates/backend-uzu/unit/encodable_block/moe/moe_experts_perf_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/performance/encodable_block/moe/moe_experts_perf_test.rs
rename to crates/backend-uzu/unit/encodable_block/moe/moe_experts_perf_test.rs
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_test.rs b/crates/backend-uzu/unit/encodable_block/moe/moe_experts_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_test.rs
rename to crates/backend-uzu/unit/encodable_block/moe/moe_experts_test.rs
index e1ed6fb1c..ceb05586b 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_test.rs
+++ b/crates/backend-uzu/unit/encodable_block/moe/moe_experts_test.rs
@@ -6,13 +6,6 @@
//! - Intermediate buffer correctness (row maps, tiles, dispatch args)
//! - Numerical correctness against CPU reference
-use backend_uzu::{
- backends::common::{
- Encoder,
- gpu_types::{ActivationType, activation_silu_alpha},
- },
- data_type::DataType,
-};
use half::bf16;
use rand::{RngExt, SeedableRng, rngs::StdRng};
@@ -20,9 +13,16 @@ use super::{
MoeExpertsTwoPassArguments, MoeExpertsTwoPassDecodeBlock, MoeExpertsTwoPassPrefillBlock, cpu_tile_counts,
cpu_tile_scan,
};
-use crate::common::{
- assert::assert_eq_float,
- helpers::{alloc_allocation_with_data, allocation_prefix_to_vec, create_context},
+use crate::{
+ backends::common::{
+ Encoder,
+ gpu_types::{ActivationType, activation_silu_alpha},
+ },
+ common::{
+ assert::assert_eq_float,
+ helpers::{alloc_allocation_with_data, allocation_prefix_to_vec, create_context},
+ },
+ data_type::DataType,
};
/// Test data for MoE experts
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_gather_test.rs b/crates/backend-uzu/unit/encodable_block/moe/moe_gather_test.rs
similarity index 94%
rename from crates/backend-uzu/tests/unit/encodable_block/moe/moe_gather_test.rs
rename to crates/backend-uzu/unit/encodable_block/moe/moe_gather_test.rs
index acf131ead..c3cff890e 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_gather_test.rs
+++ b/crates/backend-uzu/unit/encodable_block/moe/moe_gather_test.rs
@@ -1,18 +1,18 @@
-use backend_uzu::{
- array::ArrayElement,
- backends::{
- common::{Backend, Encoder},
- cpu::Cpu,
- },
-};
use half::bf16;
use num_traits::Float;
use rand::{RngExt, SeedableRng, rngs::StdRng};
use super::MoeGather;
-use crate::common::{
- assert::assert_eq_float,
- helpers::{alloc_allocation_with_data, allocation_to_vec, create_context},
+use crate::{
+ array::ArrayElement,
+ backends::{
+ common::{Backend, Encoder},
+ cpu::Cpu,
+ },
+ common::{
+ assert::assert_eq_float,
+ helpers::{alloc_allocation_with_data, allocation_to_vec, create_context},
+ },
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/performance/encodable_block/moe/moe_perf_test.rs b/crates/backend-uzu/unit/encodable_block/moe/moe_perf_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/performance/encodable_block/moe/moe_perf_test.rs
rename to crates/backend-uzu/unit/encodable_block/moe/moe_perf_test.rs
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_tiles_test.rs b/crates/backend-uzu/unit/encodable_block/moe/moe_tiles_test.rs
similarity index 98%
rename from crates/backend-uzu/tests/unit/encodable_block/moe/moe_tiles_test.rs
rename to crates/backend-uzu/unit/encodable_block/moe/moe_tiles_test.rs
index 6ac329ca6..9ec58b682 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_tiles_test.rs
+++ b/crates/backend-uzu/unit/encodable_block/moe/moe_tiles_test.rs
@@ -1,10 +1,10 @@
-use backend_uzu::backends::common::{
- Backend, Encoder, Kernels,
- kernel::{MoeTileCountsKernel, MoeTileScanKernel},
-};
use rand::{RngExt, SeedableRng, rngs::StdRng};
use crate::{
+ backends::common::{
+ Backend, Encoder, Kernels,
+ kernel::{MoeTileCountsKernel, MoeTileScanKernel},
+ },
common::helpers::{
alloc_allocation, alloc_allocation_with_data, allocation_prefix_to_vec, allocation_to_vec, create_context,
},
diff --git a/crates/backend-uzu/tests/unit/encodable_block/sampling_test.rs b/crates/backend-uzu/unit/encodable_block/sampling_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/encodable_block/sampling_test.rs
rename to crates/backend-uzu/unit/encodable_block/sampling_test.rs
diff --git a/crates/backend-uzu/tests/unit/forward_pass/cache_layers_test.rs b/crates/backend-uzu/unit/forward_pass/cache_layers_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/forward_pass/cache_layers_test.rs
rename to crates/backend-uzu/unit/forward_pass/cache_layers_test.rs
diff --git a/crates/backend-uzu/tests/unit/forward_pass/kv_cache_state_test.rs b/crates/backend-uzu/unit/forward_pass/kv_cache_state_test.rs
similarity index 99%
rename from crates/backend-uzu/tests/unit/forward_pass/kv_cache_state_test.rs
rename to crates/backend-uzu/unit/forward_pass/kv_cache_state_test.rs
index f4c3436f8..5f6da027c 100644
--- a/crates/backend-uzu/tests/unit/forward_pass/kv_cache_state_test.rs
+++ b/crates/backend-uzu/unit/forward_pass/kv_cache_state_test.rs
@@ -1,7 +1,5 @@
#![cfg(metal_backend)]
-use backend_uzu::forward_pass::kv_cache_layer::KVCacheLayerTrait;
-
use crate::{
backends::{
common::{Backend, Context, Encoder},
@@ -10,7 +8,7 @@ use crate::{
common::helpers::{sparse_buffer_create_with, sparse_buffer_read_vec, sparse_buffer_write},
data_type::DataType,
encodable_block::KVCacheUpdate,
- forward_pass::kv_cache_layer::{KVCacheLayer, KVCacheLayerState},
+ forward_pass::kv_cache_layer::{KVCacheLayer, KVCacheLayerState, KVCacheLayerTrait},
};
#[derive(Debug)]
diff --git a/crates/backend-uzu/tests/integration/tracer/mod.rs b/crates/backend-uzu/unit/forward_pass/traces/mod.rs
similarity index 61%
rename from crates/backend-uzu/tests/integration/tracer/mod.rs
rename to crates/backend-uzu/unit/forward_pass/traces/mod.rs
index 4db832b5d..c5772edf6 100644
--- a/crates/backend-uzu/tests/integration/tracer/mod.rs
+++ b/crates/backend-uzu/unit/forward_pass/traces/mod.rs
@@ -1,4 +1,2 @@
-#![cfg(feature = "tracing")]
-
mod trace_validator;
mod trace_validator_test;
diff --git a/crates/backend-uzu/tests/integration/tracer/trace_validator.rs b/crates/backend-uzu/unit/forward_pass/traces/trace_validator.rs
similarity index 98%
rename from crates/backend-uzu/tests/integration/tracer/trace_validator.rs
rename to crates/backend-uzu/unit/forward_pass/traces/trace_validator.rs
index 5a0b2c215..27353fa1b 100644
--- a/crates/backend-uzu/tests/integration/tracer/trace_validator.rs
+++ b/crates/backend-uzu/unit/forward_pass/traces/trace_validator.rs
@@ -13,26 +13,27 @@ use std::{
rc::Rc,
};
-use backend_uzu::{
- _private::{
- ActivationTrace, AnyModelConfig, CacheLayers, Classifier, DecoderDecodeInput, KVCacheLayer,
- LanguageModelGeneratorContext, TokenInputs,
- },
+use half::{bf16, f16};
+use ndarray::{ArrayView, IxDyn, s};
+use num_traits::NumCast;
+
+use crate::{
array::{Array, ArrayElement},
backends::common::{Allocation, AllocationType, Backend, Context, Encoder},
+ classifier::{ActivationTrace, Classifier},
+ common,
+ config::model::AnyModelConfig,
data_type::DataType,
- parameters::{ParameterLoader, ParameterLoaderError, ParameterTree, read_safetensors_metadata},
+ encodable_block::DecoderDecodeInput,
+ forward_pass::{cache_layers::CacheLayers, kv_cache_layer::KVCacheLayer, token_inputs::TokenInputs},
+ language_model::language_model_generator_context::LanguageModelGeneratorContext,
+ parameters::{ParameterLoader, ParameterLoaderError, ParameterTree, read_metadata},
session::{
config::{DecodingConfig, SpeculatorConfig},
parameter::{AsyncBatchSize, ConfigResolvableValue, ContextLength, ContextMode, PrefillStepSize, SamplingSeed},
types::Error,
},
};
-use half::{bf16, f16};
-use ndarray::{ArrayView, IxDyn, s};
-use num_traits::NumCast;
-
-use crate::common;
fn argmax<T: ArrayElement>(input: &[T]) -> usize {
input
@@ -296,7 +297,7 @@ impl<B: Backend> TraceValidator<B> {
) -> Result<TracerValidationResults, Error> {
let traces_file = File::open(traces_path).map_err(|error| Error::UnableToLoadWeights(Box::new(error)))?;
let (_header_len, traces_metadata) =
- read_safetensors_metadata(&traces_file).map_err(|error| Error::UnableToLoadWeights(Box::new(error)))?;
+ read_metadata(&traces_file).map_err(|error| Error::UnableToLoadWeights(Box::new(error)))?;
let trace_shapes: HashMap<String, Vec<usize>> =
traces_metadata.tensors.iter().map(|(name, tensor)| (name.clone(), tensor.shape.clone())).collect();
let token_shape = Self::trace_shape(&trace_shapes, "activation_trace.token_ids");
@@ -336,7 +337,6 @@ impl<B: Backend> TraceValidator<B> {
suffix_length,
/*sampling_start=*/ 0,
/*sampling_length=*/ suffix_length,
- #[cfg(feature = "tracing")]
Some(&mut traces),
);
ctx.executables
@@ -539,7 +539,7 @@ impl<B: Backend> TraceValidator<B> {
) -> Result<TracerValidationResults, Error> {
let traces_file = File::open(traces_path).map_err(|error| Error::UnableToLoadWeights(Box::new(error)))?;
let (_header_len, traces_metadata) =
- read_safetensors_metadata(&traces_file).map_err(|error| Error::UnableToLoadWeights(Box::new(error)))?;
+ read_metadata(&traces_file).map_err(|error| Error::UnableToLoadWeights(Box::new(error)))?;
let trace_shapes: HashMap<String, Vec<usize>> =
traces_metadata.tensors.iter().map(|(name, tensor)| (name.clone(), tensor.shape.clone())).collect();
let context = classifier.context.context.clone();
@@ -998,7 +998,7 @@ impl<B: Backend> TraceValidator<B> {
let traces_path = model_path.join("traces.safetensors");
let file = File::open(&traces_path).map_err(|error| Error::UnableToLoadWeights(Box::new(error)))?;
let (_header_len, metadata) =
- read_safetensors_metadata(&file).map_err(|error| Error::UnableToLoadWeights(Box::new(error)))?;
+ read_metadata(&file).map_err(|error| Error::UnableToLoadWeights(Box::new(error)))?;
let token_shape =
metadata.tensors.get("activation_trace.token_ids").map(|tensor| tensor.shape.as_slice()).ok_or_else(
|| Error::InvalidModelConfig("missing required trace tensor activation_trace.token_ids".to_string()),
diff --git a/crates/backend-uzu/tests/integration/tracer/trace_validator_test.rs b/crates/backend-uzu/unit/forward_pass/traces/trace_validator_test.rs
similarity index 77%
rename from crates/backend-uzu/tests/integration/tracer/trace_validator_test.rs
rename to crates/backend-uzu/unit/forward_pass/traces/trace_validator_test.rs
index 5871f9327..973ba74cb 100644
--- a/crates/backend-uzu/tests/integration/tracer/trace_validator_test.rs
+++ b/crates/backend-uzu/unit/forward_pass/traces/trace_validator_test.rs
@@ -1,13 +1,18 @@
-use backend_uzu::backends::common::Backend;
+use std::path::PathBuf;
+
+use proc_macros::uzu_test;
use crate::{
- common::{
- for_each_non_cpu_backend,
- path::{get_test_model_path, get_traces_path},
- },
- tracer::trace_validator::TraceValidator,
+ backends::common::Backend, common::path::get_test_model_path,
+ forward_pass::traces::tests::trace_validator::TraceValidator,
};
+const TRACES_FILE_NAME: &str = "traces.safetensors";
+
+fn get_traces_path() -> PathBuf {
+ get_test_model_path().join(TRACES_FILE_NAME)
+}
+
fn test_tracer_internal<B: Backend>() {
let model_path = get_test_model_path();
let mut tracer = TraceValidator::<B>::new(&model_path).expect("Failed to create TraceValidator");
@@ -27,7 +32,7 @@ fn test_tracer_internal<B: Backend>() {
);
}
-#[test]
+#[uzu_test]
#[ignore = "Lalamo 0.10.0 doesn't support exporting traces"] // TODO: this is horrible, should be resolved asap
fn test_tracer() {
let traces_path = get_traces_path();
diff --git a/crates/backend-uzu/tests/integration/person_schema_metal_bitmask_test.rs b/crates/backend-uzu/unit/language_model/grammar.rs
similarity index 87%
rename from crates/backend-uzu/tests/integration/person_schema_metal_bitmask_test.rs
rename to crates/backend-uzu/unit/language_model/grammar.rs
index 7120dd725..ccd9ced04 100644
--- a/crates/backend-uzu/tests/integration/person_schema_metal_bitmask_test.rs
+++ b/crates/backend-uzu/unit/language_model/grammar.rs
@@ -1,20 +1,21 @@
#![cfg(all(metal_backend, grammar_xgrammar))]
-use std::path::PathBuf;
+use metal::MTLDevice;
+use proc_macros::uzu_test;
+use schemars::JsonSchema;
+use serde::{Deserialize, Serialize};
+use tokenizers::Tokenizer;
+use xgrammar::{DLDevice, DLDeviceType, DLTensor, Grammar, GrammarCompiler, GrammarMatcher, TokenizerInfo};
-use backend_uzu::{
+use crate::{
array::Array,
backends::{
common::{AllocationType, Backend, Context},
metal::Metal,
},
+ common::path::get_test_model_path,
data_type::DataType,
};
-use metal::MTLDevice;
-use schemars::JsonSchema;
-use serde::{Deserialize, Serialize};
-use tokenizers::Tokenizer;
-use xgrammar::{DLDevice, DLDeviceType, DLTensor, Grammar, GrammarCompiler, GrammarMatcher, TokenizerInfo};
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
struct Person {
@@ -22,13 +23,9 @@ struct Person {
age: u32,
}
-#[test]
+#[uzu_test]
fn person_schema_metal_bitmask() {
- // Locate the tokenizer.json under {repo}/models/{version}/Llama-3.2-1B-Instruct
- let crate_version = env!("CARGO_PKG_VERSION");
- let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
- let repo_root = manifest_dir.parent().unwrap().parent().unwrap();
- let model_dir = repo_root.join("../../../../models").join(crate_version).join("Llama-3.2-1B-Instruct");
+ let model_dir = get_test_model_path();
let tokenizer_path = model_dir.join("tokenizer.json");
if !tokenizer_path.exists() {
diff --git a/crates/backend-uzu/tests/integration/parameters/loader_test.rs b/crates/backend-uzu/unit/parameters/loader.rs
similarity index 58%
rename from crates/backend-uzu/tests/integration/parameters/loader_test.rs
rename to crates/backend-uzu/unit/parameters/loader.rs
index 3bcbe206d..5c4267774 100644
--- a/crates/backend-uzu/tests/integration/parameters/loader_test.rs
+++ b/crates/backend-uzu/unit/parameters/loader.rs
@@ -1,33 +1,27 @@
-#![cfg(metal_backend)]
+use std::fs::File;
-// New integration test for ParameterLoader
-use backend_uzu::{
- backends::{
- common::{Backend, Context},
- metal::Metal,
- },
- data_type::DataType,
- parameters::{ParameterLoader, read_safetensors_metadata},
-};
use half::bf16;
+use proc_macros::uzu_test;
use test_tag::tag;
-use crate::common::path::get_test_weights_path;
+use crate::{
+ backends::common::{Backend, Context},
+ common::path::get_test_weights_path,
+ data_type::DataType,
+ parameters::{ParameterLoader, safetensors_metadata::read_metadata},
+};
const EMBEDDING_PATH: &str = "decoder.embedding.embedding.weights";
const EMBEDDING_TREE_PATH: &str = "decoder.embedding.embedding";
-#[tag(heavy)]
-#[test]
-fn test_parameter_loader_basic() {
+fn check_tree_api<B: Backend>(context: &B::Context) {
let weights_path = get_test_weights_path();
- let context = <Metal as Backend>::Context::new().expect("Failed to create MetalContext");
- let file = std::fs::File::open(&weights_path).expect("Weights file not found; run download script");
- let (_header_len, metadata) = read_safetensors_metadata(&file).expect("read weights metadata");
+ let file = File::open(&weights_path).expect("Weights file not found; run download script");
+ let (_header_len, metadata) = read_metadata(&file).expect("read weights metadata");
let embedding_shape = metadata.tensors.get(EMBEDDING_PATH).expect("weights embeddings metadata").shape.clone();
assert_eq!(embedding_shape.len(), 2);
- let loader = ParameterLoader::<Metal>::new(&file, context.as_ref()).expect("create loader");
+ let loader = ParameterLoader::<B>::new(&file, context).expect("create loader");
let tree = loader.tree();
let embeddings_leaf =
tree.leaf(EMBEDDING_PATH).expect("weights embeddings").validate(&embedding_shape, DataType::BF16).unwrap();
@@ -40,3 +34,12 @@ fn test_parameter_loader_basic() {
let same = weights_leaf.read_array().unwrap();
assert_eq!(view, same.as_view::<bf16>());
}
+
+#[tag(heavy)]
+#[uzu_test]
+fn test_parameter_loader_basic() {
+ for_each_backend!(|B| {
+ let context = <B as Backend>::Context::new().expect("Failed to create context");
+ check_tree_api::<B>(&context);
+ })
+}
diff --git a/crates/backend-uzu/unit/parameters/safetensors_metadata.rs b/crates/backend-uzu/unit/parameters/safetensors_metadata.rs
new file mode 100644
index 000000000..7e07e6592
--- /dev/null
+++ b/crates/backend-uzu/unit/parameters/safetensors_metadata.rs
@@ -0,0 +1,13 @@
+use std::fs::File;
+
+use proc_macros::uzu_test;
+
+use crate::{common::path::get_test_weights_path, parameters::safetensors_metadata::read_metadata};
+
+#[uzu_test]
+fn test_metadata_loading() {
+ let path = get_test_weights_path();
+ let file = File::open(&path).expect("weights not found");
+ let (_offset, metadata) = read_metadata(&file).expect("read metadata");
+ assert!(!metadata.tensors.is_empty());
+}
diff --git a/crates/backend-uzu/tests/integration/session/chat_session/text_session_test.rs b/crates/backend-uzu/unit/session/chat_session.rs
similarity index 97%
rename from crates/backend-uzu/tests/integration/session/chat_session/text_session_test.rs
rename to crates/backend-uzu/unit/session/chat_session.rs
index bd461e1b2..22ceb9874 100644
--- a/crates/backend-uzu/tests/integration/session/chat_session/text_session_test.rs
+++ b/crates/backend-uzu/unit/session/chat_session.rs
@@ -1,8 +1,12 @@
-#![cfg(metal_backend)]
-
use std::sync::Arc;
-use backend_uzu::{
+use proc_macros::uzu_test;
+use shoji::types::basic::Feature;
+use test_tag::tag;
+use tokenizers::Tokenizer;
+
+use crate::{
+ common::path::get_test_model_path,
prelude::{FixedTokensSpeculator, PromptLookupSpeculator, SpeculatorConfig},
session::{
Session,
@@ -11,11 +15,6 @@ use backend_uzu::{
types::{Input, Message, Output},
},
};
-use shoji::types::basic::Feature;
-use test_tag::tag;
-use tokenizers::Tokenizer;
-
-use crate::common::path::get_test_model_path;
fn build_decoding_config() -> DecodingConfig {
DecodingConfig::default().with_sampling_seed(SamplingSeed::Custom(42))
@@ -26,19 +25,19 @@ fn build_default_text() -> String {
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_text_session_base() {
run(build_default_text(), build_decoding_config(), 128);
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_text_session_base_async_batch_1() {
run(build_default_text(), build_decoding_config().with_async_batch_size(AsyncBatchSize::Custom(1)), 128);
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_text_session_with_prompt_lookup_speculator() {
let number_of_speculated_tokens = 16 - 1;
let speculator = PromptLookupSpeculator::new_with_params(3);
@@ -55,7 +54,7 @@ fn test_text_session_with_prompt_lookup_speculator() {
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_text_session_with_fixed_speculator() {
let tokenizer = Tokenizer::from_file(get_test_model_path().join("tokenizer.json")).unwrap();
@@ -93,13 +92,13 @@ fn test_text_session_with_fixed_speculator() {
#[ignore]
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_text_session_ngram_speculator_chat() {
todo!("Implement test_text_session_ngram_speculator_chat")
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_text_session_scenario() {
let system_prompt = String::from("You are a helpful assistant.");
let user_prompts = vec![String::from("Tell about London"), String::from("Compare with New York")];
@@ -107,7 +106,7 @@ fn test_text_session_scenario() {
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_text_session_stability() {
let mut session = Session::new(get_test_model_path(), build_decoding_config()).unwrap();
println!("Index | TTFT, s | Prompt t/s | Generate t/s");
diff --git a/crates/backend-uzu/tests/integration/session/config/grammar_json_schema_test.rs b/crates/backend-uzu/unit/session/config/grammar_config.rs
similarity index 91%
rename from crates/backend-uzu/tests/integration/session/config/grammar_json_schema_test.rs
rename to crates/backend-uzu/unit/session/config/grammar_config.rs
index 91b7196f4..d1075f2a6 100644
--- a/crates/backend-uzu/tests/integration/session/config/grammar_json_schema_test.rs
+++ b/crates/backend-uzu/unit/session/config/grammar_config.rs
@@ -2,17 +2,20 @@
use std::sync::Arc;
-use backend_uzu::session::{
- Session,
- config::{DecodingConfig, GrammarConfig, RunConfig, SpeculatorConfig},
- parameter::SamplingPolicy,
- types::Input,
-};
+use proc_macros::uzu_test;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use test_tag::tag;
-use crate::{common::path::get_test_model_path, util::speculator::RepeatSpeculator};
+use crate::{
+ common::{path::get_test_model_path, repeat_speculator::RepeatSpeculator},
+ session::{
+ Session,
+ config::{DecodingConfig, GrammarConfig, RunConfig, SpeculatorConfig},
+ parameter::SamplingPolicy,
+ types::Input,
+ },
+};
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
struct Address {
@@ -92,13 +95,13 @@ fn test_grammar(speculator_config: SpeculatorConfig) {
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_grammar_json_schema() {
test_grammar(SpeculatorConfig::default());
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_grammar_json_schema_with_speculator() {
test_grammar(SpeculatorConfig {
number_of_speculated_tokens: 16,
diff --git a/crates/backend-uzu/tests/integration/session/chat_session/context_mode_test.rs b/crates/backend-uzu/unit/session/parameter/context_mode.rs
similarity index 87%
rename from crates/backend-uzu/tests/integration/session/chat_session/context_mode_test.rs
rename to crates/backend-uzu/unit/session/parameter/context_mode.rs
index 1cbbd7302..416bec912 100644
--- a/crates/backend-uzu/tests/integration/session/chat_session/context_mode_test.rs
+++ b/crates/backend-uzu/unit/session/parameter/context_mode.rs
@@ -1,22 +1,17 @@
-#![cfg(metal_backend)]
-
-use std::path::PathBuf;
+use proc_macros::uzu_test;
+use test_tag::tag;
-use backend_uzu::session::{
- Session,
- config::{DecodingConfig, RunConfig, SpeculatorConfig},
- parameter::{
- AsyncBatchSize, ContextLength, ContextMode, PrefillStepSize, SamplingMethod, SamplingPolicy, SamplingSeed,
+use crate::{
+ common::path::get_test_model_path,
+ session::{
+ Session,
+ config::{DecodingConfig, RunConfig, SpeculatorConfig},
+ parameter::{
+ AsyncBatchSize, ContextLength, ContextMode, PrefillStepSize, SamplingMethod, SamplingPolicy, SamplingSeed,
+ },
+ types::{Input, Message, Output},
},
- types::{Input, Message, Output},
};
-use test_tag::tag;
-
-use crate::common::path::get_test_model_path;
-
-fn build_model_path() -> PathBuf {
- get_test_model_path()
-}
fn build_decoding_config() -> DecodingConfig {
DecodingConfig::new(
@@ -74,10 +69,10 @@ fn is_unknown_answer(response: &str) -> bool {
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_context_mode_none() {
let decoding_config = build_decoding_config().with_context_mode(ContextMode::None);
- let mut session = Session::new(build_model_path(), decoding_config).unwrap();
+ let mut session = Session::new(get_test_model_path(), decoding_config).unwrap();
let tokens_limit = 48;
let input_text = "What is Alice's occupation?".to_string();
@@ -92,7 +87,7 @@ fn test_context_mode_none() {
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_context_mode_static() {
let parameter_name = "Alice".to_string();
let parameter_age = "30".to_string();
@@ -111,7 +106,7 @@ fn test_context_mode_static() {
),
]),
});
- let mut session = Session::new(build_model_path(), decoding_config).unwrap();
+ let mut session = Session::new(get_test_model_path(), decoding_config).unwrap();
let tokens_limit = 48;
let response_occupation = request(&mut session, format!("What is {}'s occupation?", parameter_name), tokens_limit);
@@ -128,11 +123,11 @@ fn test_context_mode_static() {
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
#[ignore = "Flaky test - depends on LLM output which varies even with fixed seed"]
fn test_context_mode_dynamic() {
let decoding_config = build_decoding_config().with_context_mode(ContextMode::Dynamic);
- let mut session = Session::new(build_model_path(), decoding_config).unwrap();
+ let mut session = Session::new(get_test_model_path(), decoding_config).unwrap();
let update = |session: &mut Session, input_text: String| request(session, input_text, 0);
let ask = |session: &mut Session, input_text: String| request(session, input_text, 48);
@@ -171,10 +166,10 @@ fn test_context_mode_dynamic() {
}
#[tag(heavy)]
-#[test]
+#[uzu_test]
fn test_context_mode_dynamic_scenario() {
let decoding_config = build_decoding_config().with_context_mode(ContextMode::Dynamic);
- let mut session = Session::new(build_model_path(), decoding_config).unwrap();
+ let mut session = Session::new(get_test_model_path(), decoding_config).unwrap();
let user_prompts = vec![String::from("Tell about London"), String::from("Compare with New York")];
diff --git a/crates/backend-uzu/tests/integration/session/speculator/fixed_token.rs b/crates/backend-uzu/unit/speculators/fixed_token_speculator.rs
similarity index 92%
rename from crates/backend-uzu/tests/integration/session/speculator/fixed_token.rs
rename to crates/backend-uzu/unit/speculators/fixed_token_speculator.rs
index 0aee1ab61..64974ff1f 100644
--- a/crates/backend-uzu/tests/integration/session/speculator/fixed_token.rs
+++ b/crates/backend-uzu/unit/speculators/fixed_token_speculator.rs
@@ -1,8 +1,10 @@
use std::collections::HashMap;
-use backend_uzu::prelude::{FixedTokensSpeculator, Speculator};
+use proc_macros::uzu_test;
-#[test]
+use crate::prelude::{FixedTokensSpeculator, Speculator};
+
+#[uzu_test]
fn test_fixed_token_speculator_single() {
let speculator = FixedTokensSpeculator::new(vec![vec![0, 1, 2, 3, 4]]);
@@ -17,7 +19,7 @@ fn test_fixed_token_speculator_single() {
assert_eq!(speculator.speculate(&[4]), HashMap::from([(0, 1.0)]));
}
-#[test]
+#[uzu_test]
fn test_fixed_token_speculator_multi() {
let speculator =
FixedTokensSpeculator::new(vec![vec![0, 1, 2, 3, 4], vec![0, 1, 2, 4, 8], vec![0, 10, 20, 30, 40]]);
diff --git a/crates/backend-uzu/tests/integration/session/speculator/prompt_lookup.rs b/crates/backend-uzu/unit/speculators/prompt_lookup_speculator.rs
similarity index 89%
rename from crates/backend-uzu/tests/integration/session/speculator/prompt_lookup.rs
rename to crates/backend-uzu/unit/speculators/prompt_lookup_speculator.rs
index 5028ec5e2..e1ff1f322 100644
--- a/crates/backend-uzu/tests/integration/session/speculator/prompt_lookup.rs
+++ b/crates/backend-uzu/unit/speculators/prompt_lookup_speculator.rs
@@ -1,9 +1,12 @@
use std::collections::HashMap;
-use backend_uzu::prelude::{PromptLookupSpeculator, Speculator};
+use proc_macros::uzu_test;
use tokenizers::Tokenizer;
-use crate::common::path::get_test_model_path;
+use crate::{
+ common::path::get_test_model_path,
+ prelude::{PromptLookupSpeculator, Speculator},
+};
fn load_tokenizer() -> Tokenizer {
let tokenizer_path = get_test_model_path().join("tokenizer.json");
@@ -23,7 +26,7 @@ fn tokenize_text(
encoding.get_ids().iter().map(|&id| id as u64).collect()
}
-#[test]
+#[uzu_test]
fn test_empty_input() {
let speculator = PromptLookupSpeculator::new();
let prefix: Vec<u64> = vec![];
@@ -33,7 +36,7 @@ fn test_empty_input() {
assert_eq!(proposals.len(), 0);
}
-#[test]
+#[uzu_test]
fn test_no_pattern_found() {
let speculator = PromptLookupSpeculator::new();
let prefix = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];
@@ -43,7 +46,7 @@ fn test_no_pattern_found() {
assert_eq!(proposals.len(), 0);
}
-#[test]
+#[uzu_test]
fn test_with_real_text() {
let tokenizer = load_tokenizer();
let speculator = PromptLookupSpeculator::new_with_params(3);
diff --git a/crates/backend-uzu/tests/integration/session/speculator/token_finder.rs b/crates/backend-uzu/unit/speculators/token_finder_speculator.rs
similarity index 94%
rename from crates/backend-uzu/tests/integration/session/speculator/token_finder.rs
rename to crates/backend-uzu/unit/speculators/token_finder_speculator.rs
index f4880a5f9..64247febb 100644
--- a/crates/backend-uzu/tests/integration/session/speculator/token_finder.rs
+++ b/crates/backend-uzu/unit/speculators/token_finder_speculator.rs
@@ -1,6 +1,8 @@
-use backend_uzu::prelude::TokenFinder;
+use proc_macros::uzu_test;
-#[test]
+use crate::prelude::TokenFinder;
+
+#[uzu_test]
fn test_find_candidate_pred_token_empty_sequence() {
let sequence: Vec<u64> = vec![];
@@ -9,7 +11,7 @@ fn test_find_candidate_pred_token_empty_sequence() {
assert!(result.is_none());
}
-#[test]
+#[uzu_test]
fn test_find_candidate_pred_token_sequence_too_short() {
let sequence: Vec<u64> = vec![1, 2];
@@ -18,7 +20,7 @@ fn test_find_candidate_pred_token_sequence_too_short() {
assert!(result.is_none());
}
-#[test]
+#[uzu_test]
fn test_find_candidate_pred_token_exact_pattern_match() {
let sequence = vec![1, 2, 3, 4, 5, 1, 2, 3];
@@ -27,7 +29,7 @@ fn test_find_candidate_pred_token_exact_pattern_match() {
assert_eq!(result, Some(4));
}
-#[test]
+#[uzu_test]
fn test_find_candidate_pred_token_valid_match() {
let mut sequence = vec![1, 2, 3, 4, 5, 1, 2, 3];
@@ -42,7 +44,7 @@ fn test_find_candidate_pred_token_valid_match() {
assert_eq!(result2, Some(5));
}
-#[test]
+#[uzu_test]
fn test_find_candidate_pred_token_multiple_matches() {
let mut sequence = vec![1, 2, 3, 4, 5, 1, 2, 3, 6, 7, 1, 2, 3];
@@ -59,7 +61,7 @@ fn test_find_candidate_pred_token_multiple_matches() {
assert_ne!(result2, Some(7));
}
-#[test]
+#[uzu_test]
fn test_find_candidate_pred_token_different_ngram_sizes() {
let mut sequence = vec![1, 2, 3, 4, 5, 1, 2, 3, 8, 9, 1, 2, 3, 4, 5];
@@ -82,7 +84,7 @@ fn test_find_candidate_pred_token_different_ngram_sizes() {
assert_eq!(result2_1, Some(2));
}
-#[test]
+#[uzu_test]
fn test_find_candidate_pred_token_no_match() {
let sequence = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];
@@ -91,7 +93,7 @@ fn test_find_candidate_pred_token_no_match() {
assert!(result.is_none());
}
-#[test]
+#[uzu_test]
fn test_find_candidate_pred_token_max_ngram_higher_than_input() {
let sequence = vec![1, 2, 3, 4, 5];
diff --git a/crates/backend-uzu/tests/unit/trie_test.rs b/crates/backend-uzu/unit/trie_test.rs
similarity index 100%
rename from crates/backend-uzu/tests/unit/trie_test.rs
rename to crates/backend-uzu/unit/trie_test.rs
diff --git a/crates/backend-uzu/tests/unit/utils/model_size_test.rs b/crates/backend-uzu/unit/utils/model_size_test.rs
similarity index 96%
rename from crates/backend-uzu/tests/unit/utils/model_size_test.rs
rename to crates/backend-uzu/unit/utils/model_size_test.rs
index 207eadad2..dd730e752 100644
--- a/crates/backend-uzu/tests/unit/utils/model_size_test.rs
+++ b/crates/backend-uzu/unit/utils/model_size_test.rs
@@ -1,7 +1,7 @@
use std::path::PathBuf;
use super::*;
-use crate::VERSION;
+use crate::utils::VERSION;
pub const MODEL_DIR_NAME: &str = "Llama-3.2-1B-Instruct";
pub fn get_test_model_path() -> PathBuf {
diff --git a/crates/proc-macros/src/lib.rs b/crates/proc-macros/src/lib.rs
index b1d3a0be2..cc6f96cf0 100644
--- a/crates/proc-macros/src/lib.rs
+++ b/crates/proc-macros/src/lib.rs
@@ -29,7 +29,7 @@ pub fn uzu_config(
}
#[proc_macro_attribute]
-pub fn __internal_uzu_test(
+pub fn uzu_test(
args: TokenStream,
input: TokenStream,
) -> TokenStream {
@@ -37,7 +37,7 @@ pub fn __internal_uzu_test(
}
#[proc_macro_attribute]
-pub fn __internal_uzu_bench(
+pub fn uzu_bench(
args: TokenStream,
input: TokenStream,
) -> TokenStream {
@@ -45,7 +45,7 @@ pub fn __internal_uzu_bench(
}
#[proc_macro_attribute]
-pub fn __internal_uzu_ignored(
+pub fn uzu_ignore(
args: TokenStream,
input: TokenStream,
) -> TokenStream {