cubecl_wgpu/
lib.rs

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}
38
39#[cfg(all(test, feature = "spirv"))]
40#[allow(unexpected_cfgs)]
41mod tests_spirv {
42    pub type TestRuntime = crate::WgpuRuntime;
43    use cubecl_core::flex32;
44    use half::f16;
45
46    cubecl_core::testgen_all!(f32: [f16, flex32, f32], i32: [i8, i16, i32, i64], u32: [u8, u16, u32, u64]);
47    cubecl_std::testgen!();
48    cubecl_std::testgen_tensor_identity!([f16, flex32, f32, u32]);
49    cubecl_std::testgen_quantized_view!(f16);
50}
51
52#[cfg(all(test, feature = "msl"))]
53#[allow(unexpected_cfgs)]
54mod tests_msl {
55    pub type TestRuntime = crate::WgpuRuntime;
56    use half::f16;
57
58    cubecl_core::testgen_all!(f32: [f16, f32], i32: [i16, i32], u32: [u16, u32]);
59    cubecl_std::testgen!();
60    cubecl_std::testgen_tensor_identity!([f16, flex32, f32, u32]);
61    cubecl_std::testgen_quantized_view!(f16);
62}