mod gpu_pool;
pub mod interconnect;
mod multi_device_pool;
pub mod pipeline_dispatch;
mod strategy;
mod topology;
mod types;
#[cfg(test)]
mod tests;
pub use topology::{DeviceClass, GpuInfo, WorkloadType};
pub use interconnect::{BandwidthTier, InterconnectTopology, Link};
pub use pipeline_dispatch::{
FallbackPolicy, PipelineStage, ResolvedPipeline, ResolvedStage, StageResolution, StageWorkload,
SubstratePipeline, TransferStrategy,
};
pub use types::{DeviceInfo, DeviceRequirements, WorkloadConfig};
pub use strategy::{DeviceLease, GpuPool, MultiDevicePool};
const BYTES_PER_GIB: u64 = 1024 * 1024 * 1024;
pub(crate) fn estimate_gflops(device_class: DeviceClass, device_type: wgpu::DeviceType) -> f64 {
match (device_class, device_type) {
(DeviceClass::Software, _) => 10.0,
(DeviceClass::DiscreteGpu, _) | (_, wgpu::DeviceType::DiscreteGpu) => 3_000.0,
(DeviceClass::IntegratedGpu, _) | (_, wgpu::DeviceType::IntegratedGpu) => 200.0,
(_, wgpu::DeviceType::Cpu) => 50.0,
_ => 100.0,
}
}
pub(crate) fn estimate_vram_bytes(device_class: DeviceClass, device_type: wgpu::DeviceType) -> u64 {
match (device_class, device_type) {
(DeviceClass::Software, _) | (_, wgpu::DeviceType::Cpu) => 0,
(DeviceClass::DiscreteGpu, _) | (_, wgpu::DeviceType::DiscreteGpu) => 8 * BYTES_PER_GIB,
(DeviceClass::IntegratedGpu, _) | (_, wgpu::DeviceType::IntegratedGpu) => 2 * BYTES_PER_GIB,
_ => 4 * BYTES_PER_GIB,
}
}