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_std::testgen_quantized_view!(f32);
37 cubecl_matmul::testgen_matmul_simple!([flex32, f32]);
38 cubecl_matmul::testgen_matmul_plane_vecmat!();
39 cubecl_matmul::testgen_matmul_unit!();
40 cubecl_reduce::testgen_reduce!();
41 cubecl_random::testgen_random!();
42 cubecl_attention::testgen_attention!();
43 cubecl_reduce::testgen_shared_sum!([f32]);
44 cubecl_quant::testgen_quant!();
45}
46
47#[cfg(all(test, feature = "spirv"))]
48#[allow(unexpected_cfgs)]
49mod tests_spirv {
50 pub type TestRuntime = crate::WgpuRuntime;
51 use cubecl_core::flex32;
52 use half::f16;
53
54 cubecl_core::testgen_all!(f32: [f16, flex32, f32], i32: [i8, i16, i32, i64], u32: [u8, u16, u32, u64]);
55 cubecl_std::testgen!();
56 cubecl_std::testgen_tensor_identity!([f16, flex32, f32, u32]);
57 cubecl_std::testgen_quantized_view!(f16);
58 cubecl_convolution::testgen_conv2d_accelerated!([f16: f16]);
59 cubecl_matmul::testgen_matmul_simple!([f32]);
60 cubecl_matmul::testgen_matmul_plane_accelerated!();
61 cubecl_matmul::testgen_matmul_plane_vecmat!();
62 cubecl_matmul::testgen_matmul_unit!();
63 cubecl_reduce::testgen_reduce!();
64 cubecl_random::testgen_random!();
65 cubecl_reduce::testgen_shared_sum!([f32]);
66 cubecl_quant::testgen_quant!();
67}
68
69#[cfg(all(test, feature = "msl"))]
70#[allow(unexpected_cfgs)]
71mod tests_msl {
72 pub type TestRuntime = crate::WgpuRuntime;
73 use half::f16;
74
75 cubecl_core::testgen_all!(f32: [f16, f32], i32: [i16, i32], u32: [u16, u32]);
76 cubecl_std::testgen!();
77 cubecl_std::testgen_tensor_identity!([f16, flex32, f32, u32]);
78 cubecl_std::testgen_quantized_view!(f16);
79 cubecl_convolution::testgen_conv2d_accelerated!([f16: f16]);
80 cubecl_matmul::testgen_matmul_simple!([f16, f32]);
81 cubecl_matmul::testgen_matmul_plane_accelerated!();
82 cubecl_matmul::testgen_matmul_plane_vecmat!();
83 cubecl_matmul::testgen_matmul_unit!();
84 cubecl_attention::testgen_attention!();
85 cubecl_reduce::testgen_reduce!();
86 cubecl_random::testgen_random!();
87 cubecl_reduce::testgen_shared_sum!([f32]);
88}