1#[macro_use]
2extern crate derive_new;
3
4extern crate alloc;
5
6mod backend;
7mod compiler;
8mod compute;
9mod device;
10mod element;
11mod graphics;
12mod runtime;
13
14pub use compiler::base::*;
15pub use compiler::wgsl::WgslCompiler;
16pub use compute::*;
17pub use device::*;
18pub use element::*;
19pub use graphics::*;
20pub use runtime::*;
21
22#[cfg(feature = "spirv")]
23pub use backend::vulkan;
24
25#[cfg(all(feature = "msl", target_os = "macos"))]
26pub use backend::metal;
27
28#[cfg(all(test, not(feature = "spirv"), not(feature = "msl")))]
29#[allow(unexpected_cfgs)]
30mod tests {
31 pub type TestRuntime = crate::WgpuRuntime;
32
33 cubecl_core::testgen_all!();
34 cubecl_std::testgen!();
35 cubecl_std::testgen_tensor_identity!([flex32, f32, u32]);
36 cubecl_matmul::testgen_matmul_simple!([flex32, f32]);
37 cubecl_matmul::testgen_matmul_unit!();
38 cubecl_reduce::testgen_reduce!();
39 cubecl_random::testgen_random!();
40 cubecl_reduce::testgen_shared_sum!([f32]);
41}
42
43#[cfg(all(test, feature = "spirv"))]
44#[allow(unexpected_cfgs)]
45mod tests_spirv {
46 pub type TestRuntime = crate::WgpuRuntime;
47 use cubecl_core::flex32;
48 use half::f16;
49
50 cubecl_core::testgen_all!(f32: [f16, flex32, f32, f64], i32: [i8, i16, i32, i64], u32: [u8, u16, u32, u64]);
51 cubecl_std::testgen!();
52 cubecl_matmul::testgen_matmul_simple!([f32]);
53 cubecl_matmul::testgen_matmul_plane_accelerated!();
54 cubecl_matmul::testgen_matmul_unit!();
55 cubecl_reduce::testgen_reduce!();
56 cubecl_random::testgen_random!();
57 cubecl_reduce::testgen_shared_sum!([f32]);
58}
59
60#[cfg(all(test, feature = "msl"))]
61#[allow(unexpected_cfgs)]
62mod tests_msl {
63 pub type TestRuntime = crate::WgpuRuntime;
64 use half::f16;
65
66 cubecl_core::testgen_all!(f32: [f16, f32], i32: [i16, i32], u32: [u16, u32]);
67 cubecl_std::testgen!();
68 cubecl_std::testgen_tensor_identity!([f16, flex32, f32, u32]);
69 cubecl_convolution::testgen_conv2d_accelerated!([f16: f16]);
70 cubecl_matmul::testgen_matmul_simple!([f16, f32]);
71 cubecl_matmul::testgen_matmul_plane_accelerated!();
72 cubecl_matmul::testgen_matmul_unit!();
73 cubecl_reduce::testgen_reduce!();
74 cubecl_random::testgen_random!();
75 cubecl_reduce::testgen_shared_sum!([f32]);
76}