Skip to main content

cubecl_core/frontend/
base.rs

1#[macro_export]
2macro_rules! unexpanded {
3    () => ({
4        panic!("Unexpanded Cube functions should not be called. ");
5    });
6    ($msg:expr) => ({
7        panic!($msg);
8    });
9    ($fmt:expr, $($arg:tt)*) => ({
10        panic!($fmt, $($arg)*);
11    });
12}
13
14#[macro_export]
15macro_rules! expand_error {
16    () => ({
17        panic!("An error occurred during kernel expansion");
18    });
19    ($msg:expr) => ({
20        panic!(concat!("An error occurred during kernel expansion:\n", $msg));
21    });
22    ($fmt:expr, $($arg:tt)*) => ({
23        panic!(concat!("An error occurred during kernel expansion:\n", $fmt), $($arg)*);
24    });
25}
26
27#[macro_export]
28macro_rules! expand_assert {
29    ($cond:expr) => ({
30        assert!($cond, "An error occurred during kernel expansion");
31    });
32    ($cond:expr, $msg:expr) => ({
33        assert!($cond, concat!("An error occurred during kernel expansion:\n", $msg));
34    });
35    ($cond:expr, $fmt:expr, $($arg:tt)*) => ({
36        assert!($cond, concat!("An error occurred during kernel expansion:\n", $fmt), $($arg)*);
37    });
38}
39
40#[macro_export]
41macro_rules! size {
42    ($name: ident) => {
43        $name
44    };
45}
46
47#[macro_export]
48macro_rules! define {
49    ($name: ident) => {
50        $name
51    };
52}