#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub struct GpuConfig {
pub max_pool_bytes: u64,
pub chunk_points: u32,
pub low_power: bool,
}
impl Default for GpuConfig {
fn default() -> Self {
Self::DEFAULT
}
}
impl GpuConfig {
pub const DEFAULT: Self = Self { max_pool_bytes: 512 << 20, chunk_points: 4 << 20, low_power: false };
#[must_use]
pub const fn low_memory() -> Self {
Self { max_pool_bytes: 128 << 20, chunk_points: 1 << 20, low_power: false }
}
#[must_use]
pub const fn minimal() -> Self {
Self { max_pool_bytes: 32 << 20, chunk_points: 256 << 10, low_power: false }
}
#[must_use]
pub const fn high_performance() -> Self {
Self { max_pool_bytes: (1 << 30) + (1 << 20), chunk_points: 16 << 20, low_power: false }
}
#[must_use]
pub const fn with_max_pool_bytes(mut self, bytes: u64) -> Self {
self.max_pool_bytes = bytes;
self
}
#[must_use]
pub const fn with_chunk_points(mut self, points: u32) -> Self {
self.chunk_points = points;
self
}
#[must_use]
pub const fn with_low_power(mut self, low_power: bool) -> Self {
self.low_power = low_power;
self
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub struct GpuInfo {
pub name: String,
pub api: String,
pub device_type: String,
pub driver: String,
pub supports_f64: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
#[non_exhaustive]
pub struct GpuPoolStats {
pub idle_sets: usize,
pub idle_bytes: u64,
pub created: u64,
pub reused: u64,
pub evicted: u64,
}