Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

Saner backend dispatch in tests (#652)

uuuvnd46b0e084e0e
diff --git a/crates/backend-uzu/benches/BENCHMARKS.md b/crates/backend-uzu/BENCHMARKS.md
similarity index 94%
rename from crates/backend-uzu/benches/BENCHMARKS.md
rename to crates/backend-uzu/BENCHMARKS.md
index df09f65d1..087c12bac 100644
--- a/crates/backend-uzu/benches/BENCHMARKS.md
+++ b/crates/backend-uzu/BENCHMARKS.md
@@ -24,8 +24,9 @@ baselines side by side.
## Available benchmark groups
-The Cargo bench target is `main`. Its source lives at
-`crates/backend-uzu/benches/main.rs`.
+Benchmarks live inside the `backend-uzu` library test target (registered
+with `#[uzu_bench]` under `crates/backend-uzu/tests/unit/`), so the Cargo
+target is `--lib`.
| Group id | Filter |
|-----------------------------------------|-------------------------------------|
@@ -57,7 +58,7 @@ resolve relative to the package dir:
```bash
CRITERION_HOME="$PWD/target/criterion/m2_max" cargo bench \
-p backend-uzu \
- --bench main -- "Metal/Kernel/Matmul" \
+ --lib -- "Metal/Kernel/Matmul" \
--save-baseline matmul_baseline_m2_max
```
@@ -89,7 +90,7 @@ cargo dinghy \
-d "$DEVICE" \
-e CRITERION_HOME=target/criterion/a19 \
--copy-back "Documents/target=$(pwd)/target" \
- bench -p backend-uzu --bench main -- \
+ bench -p backend-uzu --lib -- \
"Metal/Kernel/Matmul" \
--save-baseline matmul_baseline_a19
```
diff --git a/crates/backend-uzu/benches/main.rs b/crates/backend-uzu/benches/main.rs
deleted file mode 100644
index b8e31f514..000000000
--- a/crates/backend-uzu/benches/main.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-#![feature(custom_test_frameworks)]
-#![test_runner(test_runner::uzu_harness)]
-
-mod session;
diff --git a/crates/backend-uzu/benches/session/mod.rs b/crates/backend-uzu/benches/session/mod.rs
deleted file mode 100644
index cc67c18c7..000000000
--- a/crates/backend-uzu/benches/session/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-mod model_loading_bench;
diff --git a/crates/backend-uzu/src/tests/helpers.rs b/crates/backend-uzu/src/tests/helpers.rs
index 6c446a31c..2725f6cdc 100644
--- a/crates/backend-uzu/src/tests/helpers.rs
+++ b/crates/backend-uzu/src/tests/helpers.rs
@@ -8,6 +8,39 @@ use crate::{
},
};
+/// Invokes `$body` once per available backend, with `$B` bound to each backend type.
+macro_rules! for_each_backend {
+ (|$B:ident| $body:expr) => {{
+ {
+ type $B = crate::backends::cpu::Cpu;
+ $body
+ }
+ #[cfg(backend = "metal")]
+ {
+ type $B = crate::backends::metal::Metal;
+ $body
+ }
+ }};
+}
+pub(crate) use for_each_backend;
+
+macro_rules! for_each_non_cpu_backend {
+ (|$B:ident| $body:expr) => {{
+ #[cfg(backend = "metal")]
+ {
+ type $B = crate::backends::metal::Metal;
+ $body
+ }
+ {
+ if false {
+ type $B = crate::backends::cpu::Cpu;
+ $body
+ }
+ }
+ }};
+}
+pub(crate) use for_each_non_cpu_backend;
+
pub fn allocation_size_bytes<T>(elements_count: usize) -> usize {
elements_count * size_of::<T>()
}
diff --git a/crates/backend-uzu/src/tests/mod.rs b/crates/backend-uzu/src/tests/mod.rs
index 4721d1dd5..dace964cd 100644
--- a/crates/backend-uzu/src/tests/mod.rs
+++ b/crates/backend-uzu/src/tests/mod.rs
@@ -12,3 +12,6 @@ pub mod util;
#[path = "../../tests/unit/bench_cold_pool_test.rs"]
mod bench_cold_pool_test;
+
+#[path = "../../tests/unit/session/model_loading_bench.rs"]
+mod model_loading_bench;
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/activation_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/activation_test.rs
index af709dd60..e5d13ee77 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/activation_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/activation_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_fallback_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_fallback_test.rs
index 78efa57a7..f0ce12e04 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_fallback_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_fallback_test.rs
@@ -1,6 +1,5 @@
use half::bf16;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
backends::{
@@ -17,7 +16,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_single_pass_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_single_pass_test.rs
index dc56dc2df..2a92348f6 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_single_pass_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_single_pass_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_two_pass_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_two_pass_test.rs
index b01cfa1f0..5d8c2bf92 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_two_pass_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/attention/attention_two_pass_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -17,7 +16,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/attention/sigmoid_gate_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/attention/sigmoid_gate_test.rs
index a39260d63..6d656f35f 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/attention/sigmoid_gate_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/attention/sigmoid_gate_test.rs
@@ -3,7 +3,6 @@ use std::fmt::Debug;
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -11,7 +10,7 @@ use crate::{
common::{Backend, Context, Encoder, Kernels, kernel::SigmoidGateKernel},
cpu::Cpu,
},
- tests::helpers::{alloc_allocation_with_data, allocation_to_vec},
+ tests::helpers::{alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
};
struct Config {
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/embedding/full_precision_embedding_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/embedding/full_precision_embedding_test.rs
index 4070bef07..111d6a9b6 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/embedding/full_precision_embedding_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/embedding/full_precision_embedding_test.rs
@@ -3,12 +3,11 @@ use std::fmt::Debug;
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_backend;
use crate::{
array::ArrayElement,
backends::common::{Backend, Context, Encoder, Kernels, kernel::FullPrecisionEmbeddingLookupKernel},
- tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_backend},
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/embedding/quant_embedding_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/embedding/quant_embedding_test.rs
index 424beed3d..b6260341f 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/embedding/quant_embedding_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/embedding/quant_embedding_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -18,7 +17,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/gated_act_mul_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/gated_act_mul_test.rs
index 8bf84d27b..71f7de56b 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/gated_act_mul_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/gated_act_mul_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::{for_each_backend, for_each_non_cpu_backend};
use crate::{
array::ArrayElement,
@@ -16,7 +15,9 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{
+ alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_backend, for_each_non_cpu_backend,
+ },
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/conv_scan_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/conv_scan_test.rs
index 43e193ebc..9cfaaa6c4 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/conv_scan_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/conv_scan_test.rs
@@ -8,7 +8,6 @@ use half::bf16;
#[cfg(backend = "metal")]
use proc_macros::uzu_bench;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
#[cfg(backend = "metal")]
use crate::{
@@ -23,7 +22,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/benches/gram.md b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/gram.md
similarity index 100%
rename from crates/backend-uzu/benches/gram.md
rename to crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/gram.md
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/out_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/out_test.rs
index 016d08d92..e6e6bc7ca 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/out_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/out_test.rs
@@ -3,7 +3,6 @@
use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
},
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/prefix_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/prefix_test.rs
index 08a358df1..b5f13d584 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/prefix_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/prefix_test.rs
@@ -1,7 +1,6 @@
#![cfg(backend = "metal")]
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
backends::{
@@ -10,7 +9,7 @@ use crate::{
},
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/state_advance_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/state_advance_test.rs
index d7b428089..4d7b44533 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/state_advance_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/state_advance_test.rs
@@ -8,7 +8,6 @@ use num_traits::Float;
#[cfg(backend = "metal")]
use proc_macros::uzu_bench;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -18,7 +17,7 @@ use crate::{
},
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
#[cfg(backend = "metal")]
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/tree_gram_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/tree_gram_test.rs
index b007fd068..949e4f33f 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/tree_gram_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/tree_gram_test.rs
@@ -3,7 +3,6 @@
use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -15,7 +14,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/tree_update_solve_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/tree_update_solve_test.rs
index 84894056f..a2db58c90 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/tree_update_solve_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/gdn/tree_verify/tree_update_solve_test.rs
@@ -2,7 +2,6 @@
use half::bf16;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -13,7 +12,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/hadamard_transform_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/hadamard_transform_test.rs
index 101ed729e..3dbb9c268 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/hadamard_transform_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/hadamard_transform_test.rs
@@ -3,14 +3,13 @@ use std::fmt::Debug;
use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
backends::common::{
Backend, Context, Encoder, Kernels, gpu_types::HadamardTransformOrder, kernel::HadamardTransformKernel,
},
- tests::helpers::{alloc_allocation_with_data, allocation_to_vec},
+ tests::helpers::{alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
};
const BLOCK_SIZE: usize = 32;
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/kv_cache_update_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/kv_cache_update_test.rs
index e36c2e60a..69e8d955b 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/kv_cache_update_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/kv_cache_update_test.rs
@@ -5,7 +5,6 @@ use half::{bf16, f16};
use ndarray::{Array, Array3};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -15,7 +14,7 @@ use crate::{
},
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
#[cfg(backend = "metal")]
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/logit_soft_cap_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/logit_soft_cap_test.rs
index 66cf4d3b4..4e30a93fc 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/logit_soft_cap_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/logit_soft_cap_test.rs
@@ -3,7 +3,6 @@ use std::fmt::Display;
use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/matmul/gemv_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/matmul/gemv_test.rs
index 8ee40cccf..acdc15813 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/matmul/gemv_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/matmul/gemv_test.rs
@@ -4,7 +4,6 @@ use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
use rstest::rstest;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -21,7 +20,7 @@ use crate::{
},
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
matmul::{QuantBuffers, QuantInput},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/matmul/quant_gemv_bench.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/matmul/quant_gemv_bench.rs
index e4969e24a..24f459fb1 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/matmul/quant_gemv_bench.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/matmul/quant_gemv_bench.rs
@@ -2,7 +2,6 @@ use criterion::{BenchmarkId, Criterion, Throughput};
use half::bf16;
use num_traits::Float;
use proc_macros::uzu_bench;
-use test_runner::for_each_backend;
use crate::{
array::ArrayElement,
@@ -13,6 +12,7 @@ use crate::{
},
tests::{
cold_pool::ColdPool,
+ helpers::for_each_backend,
matmul::{QuantBuffers, QuantInput, bench_quant_gemv_shapes, iter_encode_loop_named, quant_arguments},
util::type_short_name,
},
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_counts_offsets_fused_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_counts_offsets_fused_test.rs
index e97eebf8b..e8b597dea 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_counts_offsets_fused_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_counts_offsets_fused_test.rs
@@ -1,13 +1,15 @@
use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
-use test_runner::{for_each_backend, for_each_non_cpu_backend};
use crate::{
backends::{
common::{Backend, Context, Encoder, Kernels, kernel::MoeCountsOffsetsFusedKernel},
cpu::Cpu,
},
- tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_prefix_to_vec, allocation_to_vec},
+ tests::helpers::{
+ alloc_allocation, alloc_allocation_with_data, allocation_prefix_to_vec, allocation_to_vec, for_each_backend,
+ for_each_non_cpu_backend,
+ },
};
fn gen_random_topk_ids(
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_finalize_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_finalize_test.rs
index d4c676a4a..3cbad97b5 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_finalize_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_finalize_test.rs
@@ -2,7 +2,6 @@ use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -13,7 +12,9 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, create_context},
+ helpers::{
+ alloc_allocation, alloc_allocation_with_data, allocation_to_vec, create_context, for_each_non_cpu_backend,
+ },
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_router_topk_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_router_topk_test.rs
index 40e6c1cba..e685e45a7 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_router_topk_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/moe/moe_router_topk_test.rs
@@ -4,7 +4,6 @@ use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -12,7 +11,9 @@ use crate::{
common::{Backend, Encoder, Kernels, kernel::MoeRouterTopKKernel},
cpu::Cpu,
},
- tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, create_context},
+ tests::helpers::{
+ alloc_allocation, alloc_allocation_with_data, allocation_to_vec, create_context, for_each_non_cpu_backend,
+ },
};
#[derive(Copy, Clone, Debug)]
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/pooling/pooling_mean_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/pooling/pooling_mean_test.rs
index ec06a1e54..1e5e7f031 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/pooling/pooling_mean_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/pooling/pooling_mean_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/qkv_norm_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/qkv_norm_test.rs
index 6cdfb49a9..f95ca75ef 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/qkv_norm_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/qkv_norm_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/radix_top_k_small_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/radix_top_k_small_test.rs
index a7f823b27..35b493803 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/radix_top_k_small_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/radix_top_k_small_test.rs
@@ -2,7 +2,6 @@
use std::time::Instant;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
#[cfg(backend = "metal")]
use crate::backends::metal::Metal;
@@ -11,7 +10,9 @@ use crate::{
common::{Backend, Encoder, Kernels, kernel::radix_top_k_small::RadixTopKSmall},
cpu::Cpu,
},
- tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, create_context},
+ tests::helpers::{
+ alloc_allocation, alloc_allocation_with_data, allocation_to_vec, create_context, for_each_non_cpu_backend,
+ },
};
const TARGET_COLUMNS: usize = 248_320;
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_decode_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_decode_test.rs
index b2799be35..95c6b045c 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_decode_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_decode_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_pack_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_pack_test.rs
index a591d58ac..c6b5dfe16 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_pack_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_pack_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_prefill_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_prefill_test.rs
index 1c9a3f845..05de2517b 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_prefill_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_prefill_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_trie_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_trie_test.rs
index e99a83442..5ba45f981 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_trie_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/short_conv/short_conv_trie_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_decode_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_decode_test.rs
index a8e894bb3..33e9c347d 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_decode_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_decode_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -16,7 +15,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_pack_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_pack_test.rs
index 76c143920..26adfb3aa 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_pack_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_pack_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_scan_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_scan_test.rs
index b4258d4e2..4b2b45f6c 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_scan_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_conv1d_scan_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_prefill_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_prefill_test.rs
index 9ac944410..1215fd222 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_prefill_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_prefill_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -11,7 +10,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_split_inproj_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_split_inproj_test.rs
index 6d6f662de..323dcc049 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_split_inproj_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_split_inproj_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_update_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_update_test.rs
index e89ed54d5..dc774a28d 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_update_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/ssm/ssm_update_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_bias_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_bias_test.rs
index 0646ea5fc..42e29b22e 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_bias_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_bias_test.rs
@@ -3,12 +3,11 @@ use std::fmt::Debug;
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_backend;
use crate::{
array::ArrayElement,
backends::common::{Allocation, Backend, Context, Encoder, Kernels, kernel::TensorAddBiasKernel},
- tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_backend},
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_scale_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_scale_test.rs
index 91567d7c4..970af5449 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_scale_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_scale_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -14,7 +13,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_swap_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_swap_test.rs
index e3f44ba7b..0c627b4aa 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_swap_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_add_swap_test.rs
@@ -3,12 +3,11 @@ use std::fmt::Debug;
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_backend;
use crate::{
array::ArrayElement,
backends::common::{Backend, Context, Encoder, Kernels, kernel::TensorAddSwapKernel},
- tests::helpers::{alloc_allocation_with_data, allocation_to_vec},
+ tests::helpers::{alloc_allocation_with_data, allocation_to_vec, for_each_backend},
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_copy_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_copy_test.rs
index bded046f3..204507b48 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_copy_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/tensor_copy_test.rs
@@ -3,12 +3,11 @@ use std::fmt::Debug;
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_backend;
use crate::{
array::ArrayElement,
backends::common::{Backend, Context, Encoder, Kernels, kernel::TensorCopyKernel},
- tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_backend},
};
struct Input<T: ArrayElement + Float> {
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/weaver/weaver_frontier_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/weaver/weaver_frontier_test.rs
index 5f27d522b..949292fd5 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/weaver/weaver_frontier_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/weaver/weaver_frontier_test.rs
@@ -1,5 +1,4 @@
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
backends::{
@@ -10,7 +9,7 @@ use crate::{
},
cpu::Cpu,
},
- tests::helpers::{alloc_allocation_with_data, allocation_to_vec, create_context},
+ tests::helpers::{alloc_allocation_with_data, allocation_to_vec, create_context, for_each_non_cpu_backend},
};
fn select<B: Backend>() -> Vec<u32> {
diff --git a/crates/backend-uzu/tests/unit/backends/common/kernel/weaver/weaver_top_children_test.rs b/crates/backend-uzu/tests/unit/backends/common/kernel/weaver/weaver_top_children_test.rs
index 9cc098256..c4321fece 100644
--- a/crates/backend-uzu/tests/unit/backends/common/kernel/weaver/weaver_top_children_test.rs
+++ b/crates/backend-uzu/tests/unit/backends/common/kernel/weaver/weaver_top_children_test.rs
@@ -1,13 +1,14 @@
use half::bf16;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
backends::{
common::{Backend, Encoder, Kernels, gpu_types::weaver::MetadataIdx, kernel::WeaverTopChildrenKernel},
cpu::Cpu,
},
- tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, create_context},
+ tests::helpers::{
+ alloc_allocation, alloc_allocation_with_data, allocation_to_vec, create_context, for_each_non_cpu_backend,
+ },
};
const CANDIDATES: usize = 512;
diff --git a/crates/backend-uzu/tests/unit/encodable_block/attention_gemm_test.rs b/crates/backend-uzu/tests/unit/encodable_block/attention_gemm_test.rs
index 0457e3f95..e08fdd295 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/attention_gemm_test.rs
+++ b/crates/backend-uzu/tests/unit/encodable_block/attention_gemm_test.rs
@@ -3,7 +3,6 @@ use std::fmt::{Debug, Display};
use half::{bf16, f16};
use num_traits::Float;
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
array::ArrayElement,
@@ -18,7 +17,7 @@ use crate::{
},
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/encodable_block/mamba_mixer/ssd_prefill_test.rs b/crates/backend-uzu/tests/unit/encodable_block/mamba_mixer/ssd_prefill_test.rs
index 55c90e314..beb8b4bbc 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/mamba_mixer/ssd_prefill_test.rs
+++ b/crates/backend-uzu/tests/unit/encodable_block/mamba_mixer/ssd_prefill_test.rs
@@ -1,5 +1,4 @@
use proc_macros::uzu_test;
-use test_runner::for_each_non_cpu_backend;
use crate::{
backends::common::{
@@ -8,7 +7,7 @@ use crate::{
kernel::{Conv1dScanKernel, SSDPrefill64Kernel, SSDPrefillKernel},
},
data_type::DataType,
- tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec},
+ tests::helpers::{alloc_allocation, alloc_allocation_with_data, allocation_to_vec, for_each_non_cpu_backend},
};
#[derive(Debug, Clone, Copy)]
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_block_e2e_test.rs b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_block_e2e_test.rs
index ef5c4cca4..b4c8e67dd 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_block_e2e_test.rs
+++ b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_block_e2e_test.rs
@@ -1,7 +1,6 @@
use half::bf16;
use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
-use test_runner::for_each_non_cpu_backend;
use super::{MoeExpertsTwoPassArguments, MoeExpertsTwoPassPrefillBlock, MoeGather};
use crate::{
@@ -16,6 +15,7 @@ use crate::{
data_type::DataType,
tests::helpers::{
alloc_allocation, alloc_allocation_with_data, allocation_prefix_to_vec, allocation_to_vec, create_context,
+ for_each_non_cpu_backend,
},
};
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_perf_test.rs b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_perf_test.rs
index eb9cee9d0..e92ee7dc8 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_perf_test.rs
+++ b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_perf_test.rs
@@ -3,13 +3,12 @@ use std::time::Instant;
use half::bf16;
use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
-use test_runner::for_each_non_cpu_backend;
use super::{MoeExpertsTwoPassArguments, MoeExpertsTwoPassDecodeBlock, MoeExpertsTwoPassPrefillBlock};
use crate::{
backends::common::{Backend, Encoder},
data_type::DataType,
- tests::helpers::{alloc_allocation_with_data, create_context},
+ tests::helpers::{alloc_allocation_with_data, create_context, for_each_non_cpu_backend},
};
fn build_offsets(
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_test.rs b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_test.rs
index 87afbfb09..84adc358b 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_test.rs
+++ b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_experts_test.rs
@@ -9,7 +9,6 @@
use half::bf16;
use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
-use test_runner::for_each_non_cpu_backend;
use super::{
MoeExpertsTwoPassArguments, MoeExpertsTwoPassDecodeBlock, MoeExpertsTwoPassPrefillBlock, cpu_tile_counts,
@@ -23,7 +22,7 @@ use crate::{
data_type::DataType,
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation_with_data, allocation_prefix_to_vec, create_context},
+ helpers::{alloc_allocation_with_data, allocation_prefix_to_vec, create_context, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_gather_test.rs b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_gather_test.rs
index 3abf5ea9c..4782573a7 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_gather_test.rs
+++ b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_gather_test.rs
@@ -2,7 +2,6 @@ use half::bf16;
use num_traits::Float;
use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
-use test_runner::for_each_non_cpu_backend;
use super::MoeGather;
use crate::{
@@ -13,7 +12,7 @@ use crate::{
},
tests::{
assert::assert_eq_float,
- helpers::{alloc_allocation_with_data, allocation_to_vec, create_context},
+ helpers::{alloc_allocation_with_data, allocation_to_vec, create_context, for_each_non_cpu_backend},
},
};
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_perf_test.rs b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_perf_test.rs
index 3a36f0b94..4f84945c7 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_perf_test.rs
+++ b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_perf_test.rs
@@ -1,7 +1,7 @@
use half::bf16;
use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
-use test_runner::{for_each_non_cpu_backend, perf::run_perf_with_warmup};
+use test_runner::perf::run_perf_with_warmup;
use super::{MoeExpertsTwoPassArguments, MoeExpertsTwoPassDecodeBlock, MoeGather};
use crate::{
@@ -13,7 +13,7 @@ use crate::{
},
},
data_type::DataType,
- tests::helpers::{alloc_allocation, alloc_allocation_with_data, create_context},
+ tests::helpers::{alloc_allocation, alloc_allocation_with_data, create_context, for_each_non_cpu_backend},
};
// Test E2E MoE performance with timing breakdown (decode mode, T=1)
diff --git a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_tiles_test.rs b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_tiles_test.rs
index 5ea60b9b0..35eb7fcde 100644
--- a/crates/backend-uzu/tests/unit/encodable_block/moe/moe_tiles_test.rs
+++ b/crates/backend-uzu/tests/unit/encodable_block/moe/moe_tiles_test.rs
@@ -1,6 +1,5 @@
use proc_macros::uzu_test;
use rand::{RngExt, SeedableRng, rngs::StdRng};
-use test_runner::for_each_non_cpu_backend;
use crate::{
backends::common::{
@@ -10,6 +9,7 @@ use crate::{
encodable_block::mlp::moe::tests::{cpu_tile_counts, cpu_tile_scan},
tests::helpers::{
alloc_allocation, alloc_allocation_with_data, allocation_prefix_to_vec, allocation_to_vec, create_context,
+ for_each_non_cpu_backend,
},
};
diff --git a/crates/backend-uzu/benches/session/model_loading_bench.rs b/crates/backend-uzu/tests/unit/session/model_loading_bench.rs
similarity index 87%
rename from crates/backend-uzu/benches/session/model_loading_bench.rs
rename to crates/backend-uzu/tests/unit/session/model_loading_bench.rs
index ac3adf5b6..b15b0ffdf 100644
--- a/crates/backend-uzu/benches/session/model_loading_bench.rs
+++ b/crates/backend-uzu/tests/unit/session/model_loading_bench.rs
@@ -1,9 +1,10 @@
use std::time::Duration;
-use backend_uzu::engine::Engine;
use criterion::{BenchmarkId, Criterion};
use proc_macros::uzu_bench;
-use test_runner::{for_each_non_cpu_backend, path::get_test_model_path};
+use test_runner::path::get_test_model_path;
+
+use crate::{engine::Engine, tests::helpers::for_each_non_cpu_backend};
#[uzu_bench]
fn bench_model_loading(c: &mut Criterion) {
diff --git a/crates/test-runner/src/lib.rs b/crates/test-runner/src/lib.rs
index f68a2f0ba..d5c7efba2 100644
--- a/crates/test-runner/src/lib.rs
+++ b/crates/test-runner/src/lib.rs
@@ -14,36 +14,3 @@ mod harness;
#[cfg(feature = "nightly-harness")]
pub use harness::{UzuTest, uzu_harness};
-
-/// Invokes `$body` once per available backend, with `$B` bound to each backend type.
-#[macro_export]
-macro_rules! for_each_backend {
- (|$B:ident| $body:expr) => {{
- {
- type $B = crate::backends::cpu::Cpu;
- $body
- }
- #[cfg(backend = "metal")]
- {
- type $B = crate::backends::metal::Metal;
- $body
- }
- }};
-}
-
-#[macro_export]
-macro_rules! for_each_non_cpu_backend {
- (|$B:ident| $body:expr) => {{
- #[cfg(backend = "metal")]
- {
- type $B = crate::backends::metal::Metal;
- $body
- }
- {
- if false {
- type $B = crate::backends::cpu::Cpu;
- $body
- }
- }
- }};
-}