kopitiam_core/device.rs
1/// Where a tensor's storage lives and where kernels run on it.
2///
3/// Today there is exactly one variant. That is deliberate, not an oversight:
4/// the Kopitiam Runtime is CPU-only by design (GPU support is explicitly out
5/// of scope — see `docs/ai-decisions/` and the parent epic), and this project
6/// does not pay for abstraction it has no use for.
7///
8/// So why does the type exist at all? Because it is the one place where a
9/// future non-CPU backend would have to be admitted, and having it named
10/// makes the CPU-only promise *checkable*: every signature that takes a
11/// `Device` is a signature that would need review if that promise ever
12/// changed. A bare `()` would hide that.
13#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
14pub enum Device {
15 #[default]
16 Cpu,
17}
18
19impl std::fmt::Display for Device {
20 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21 match self {
22 Self::Cpu => f.write_str("cpu"),
23 }
24 }
25}