ai_hwaccel/hardware/
neuron.rs1use std::fmt;
4
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
9pub enum NeuronChipType {
10 Inferentia,
12 Trainium,
14}
15
16impl NeuronChipType {
17 pub fn hbm_per_core_bytes(&self) -> u64 {
19 match self {
20 Self::Inferentia => 16 * 1024 * 1024 * 1024,
22 Self::Trainium => 32 * 1024 * 1024 * 1024,
24 }
25 }
26}
27
28impl fmt::Display for NeuronChipType {
29 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30 match self {
31 Self::Inferentia => write!(f, "Inferentia"),
32 Self::Trainium => write!(f, "Trainium"),
33 }
34 }
35}