fuel_ir/device.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2//! Identifies a physical device location (CPU or a specific GPU).
3
4#[cfg(feature = "serde")]
5use serde::{Deserialize, Serialize};
6
7/// Identifies a physical device location (CPU or a specific GPU).
8///
9/// # Example
10///
11/// ```rust
12/// use fuel_ir::DeviceLocation;
13/// let loc = DeviceLocation::Cpu;
14/// assert_eq!(loc, DeviceLocation::Cpu);
15/// ```
16#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
17#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
18pub enum DeviceLocation {
19 /// The CPU.
20 Cpu,
21 /// A CUDA GPU with the given ordinal.
22 Cuda { gpu_id: usize },
23 /// A Metal GPU with the given ordinal.
24 Metal { gpu_id: usize },
25 /// A Vulkan GPU with the given ordinal.
26 Vulkan { gpu_id: usize },
27}