@@ -28,6 +28,14 @@ import (
2828 "k8s.io/utils/ptr"
2929)
3030
31+ const (
32+ // SharedDeviceAttributePrefix is the prefix used for shared attributes among NVIDIA devices {NIC, GPU}.
33+ SharedDeviceAttributePrefix = "resource.nvidia.com/"
34+ // DeviceAttributeNumaNodeID is a device attribute name which describe the NUMA node ID of the device.
35+ // This attribute can be used to identify devices that share the same NUMA node.
36+ SharedDeviceAttributeNumaNodeID resourceapi.QualifiedName = SharedDeviceAttributePrefix + "numaNodeID"
37+ )
38+
3139type GpuInfo struct {
3240 UUID string `json:"uuid"`
3341 minor int
@@ -42,6 +50,7 @@ type GpuInfo struct {
4250 pcieBusID string
4351 pcieRootAttr * deviceattribute.DeviceAttribute
4452 migProfiles []* MigProfileInfo
53+ numaNodeID * int
4554}
4655
4756type MigDeviceInfo struct {
@@ -55,6 +64,7 @@ type MigDeviceInfo struct {
5564 ciInfo * nvml.ComputeInstanceInfo
5665 pcieBusID string
5766 pcieRootAttr * deviceattribute.DeviceAttribute
67+ numaNodeID * int
5868}
5969
6070type MigProfileInfo struct {
@@ -119,6 +129,9 @@ func (d *GpuInfo) GetDevice() resourceapi.Device {
119129 if d .pcieRootAttr != nil {
120130 device .Attributes [d .pcieRootAttr .Name ] = d .pcieRootAttr .Value
121131 }
132+ if d .numaNodeID != nil {
133+ device .Attributes [SharedDeviceAttributeNumaNodeID ] = resourceapi.DeviceAttribute {IntValue : ptr .To (int64 (* d .numaNodeID ))}
134+ }
122135 return device
123136}
124137
@@ -181,5 +194,8 @@ func (d *MigDeviceInfo) GetDevice() resourceapi.Device {
181194 if d .pcieRootAttr != nil {
182195 device .Attributes [d .pcieRootAttr .Name ] = d .pcieRootAttr .Value
183196 }
197+ if d .numaNodeID != nil {
198+ device .Attributes [SharedDeviceAttributeNumaNodeID ] = resourceapi.DeviceAttribute {IntValue : ptr .To (int64 (* d .numaNodeID ))}
199+ }
184200 return device
185201}
0 commit comments