Skip to content

Commit

Permalink
scheduler: allocate tolerate numa-meaning-less device (#2226)
Browse files Browse the repository at this point in the history
Signed-off-by: wangjianyu.wjy <[email protected]>
Co-authored-by: wangjianyu.wjy <[email protected]>
  • Loading branch information
ZiMengSheng and wangjianyu.wjy authored Oct 16, 2024
1 parent 360c5d3 commit 214f41c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/scheduler/plugins/deviceshare/device_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (a *AutopilotAllocator) filterNodeDevice(
for _, deviceInfo := range deviceInfos {
// TODO if a.numaNodes == nil && selector == nil return all device of this deviceType
if a.numaNodes != nil {
if deviceInfo.Topology == nil || !a.numaNodes.IsSet(int(deviceInfo.Topology.NodeID)) {
if deviceInfo.Topology == nil || (deviceInfo.Topology.NodeID != -1 && !a.numaNodes.IsSet(int(deviceInfo.Topology.NodeID))) {
continue
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/plugins/deviceshare/numa_topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func newNUMATopology(deviceObj *schedulingv1alpha1.Device) *NUMATopology {
devicesInPCIe := map[PCIeIndex]map[schedulingv1alpha1.DeviceType][]int{}
for i := range deviceObj.Spec.Devices {
deviceInfo := &deviceObj.Spec.Devices[i]
if deviceInfo.Topology == nil {
if deviceInfo.Topology == nil || deviceInfo.Topology.NodeID == -1 {
//
// NOTE: By default, it must be assigned according to the topology,
// and the Required/Preferred strategy should be provided later.
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/plugins/deviceshare/topology_hint.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (p *Plugin) generateTopologyHints(cycleState *framework.CycleState, state *
maskNodes := mask.GetBits()
totalDevices := calcTotalDevicesByNUMA(nodeDevice, maskNodes)
for deviceType, wanted := range allocator.desiredCountPerDeviceType {
if totalDevices[deviceType] < wanted {
if totalCount, exists := totalDevices[deviceType]; exists && totalCount < wanted {
return
}
}
Expand Down

0 comments on commit 214f41c

Please sign in to comment.