-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgpu.rs
48 lines (39 loc) · 744 Bytes
/
gpu.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
struct GpuModule {
pn: Option<String>,
dsc: Option<String>,
sn: Option<String>,
vbios: Option<String>,
}
enum GpuTrayLocation {
Upper(2),
Lower(1),
}
struct GpuSlot {
gpum: GpuModule,
log_id: Option<u8>,
phy_id: u8,
pcie_bdf: Option<String>,
tray_loc: GpuTrayLocation,
}
type GpuId = u8;
type NvLinkId = u8;
type NvSwitchId = u8;
type PcieBdf = u8;
enum NvLinkConDev {
Gpu{ bdf: PcieBdf, gpuid: GpuId, nvlnkid: NvLinkId, },
Nvs{ bdf: PcieBdf, nvsid: NvSwitchId, nvlnkid: NvLinkId },
Unused,
}
struct NvLink {
id: u8, // [0, 17]
p1: NvLinkConDev,
p2: NvlinkConDev,
}
struct Nvs {
id: NvSwitchId,
nvl: NvLink,
}
struct Gpu {
id: GpuId,
nvl: NvLink,
}