forked from tracel-ai/cubecl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
67 lines (56 loc) · 1.81 KB
/
lib.rs
File metadata and controls
67 lines (56 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#[macro_use]
extern crate derive_new;
extern crate alloc;
mod backend;
mod compiler;
mod compute;
mod device;
mod element;
mod graphics;
mod runtime;
pub use compiler::base::*;
pub use compiler::wgsl::WgslCompiler;
pub use compute::*;
pub use device::*;
pub use element::*;
pub use graphics::*;
pub use runtime::*;
#[cfg(feature = "spirv")]
pub use backend::vulkan;
#[cfg(all(feature = "msl", target_os = "macos"))]
pub use backend::metal;
#[cfg(all(test, not(feature = "spirv"), not(feature = "msl")))]
#[allow(unexpected_cfgs)]
mod tests {
pub type TestRuntime = crate::WgpuRuntime;
use half::f16;
// Include 64-bit types (i64, u64) for WGSL as wgpu supports them. These don't exist on
// native WebGPU however.
//
// Also include f16, this is an extension but supported by wgpu and WebGPU.
cubecl_core::testgen_all!(f32: [f16, f32], i32: [i32, i64], u32: [u32, u64]);
cubecl_std::testgen!();
cubecl_std::testgen_tensor_identity!([flex32, f32, u32]);
cubecl_std::testgen_quantized_view!(f32);
}
#[cfg(all(test, feature = "spirv"))]
#[allow(unexpected_cfgs)]
mod tests_spirv {
pub type TestRuntime = crate::WgpuRuntime;
use cubecl_core::flex32;
use half::f16;
cubecl_core::testgen_all!(f32: [f16, flex32, f32], i32: [i8, i16, i32, i64], u32: [u8, u16, u32, u64]);
cubecl_std::testgen!();
cubecl_std::testgen_tensor_identity!([f16, flex32, f32, u32]);
cubecl_std::testgen_quantized_view!(f16);
}
#[cfg(all(test, feature = "msl"))]
#[allow(unexpected_cfgs)]
mod tests_msl {
pub type TestRuntime = crate::WgpuRuntime;
use half::{bf16, f16};
cubecl_core::testgen_all!(f32: [bf16, f16, f32], i32: [i16, i32], u32: [u16, u32]);
cubecl_std::testgen!();
cubecl_std::testgen_tensor_identity!([f16, flex32, f32, u32]);
cubecl_std::testgen_quantized_view!(f16);
}