Skip to content

Commit cf54888

Browse files
authored
Merge pull request #1255 from uniemimu/labelingfix
fix gpu nfdhook numa labeling
2 parents 92b1371 + 59cd72a commit cf54888

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

cmd/gpu_nfdhook/labeler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ func createNumaNodeMappingLabel(mapping map[int][]string) string {
463463

464464
sort.Ints(numas)
465465

466-
for numaNode := range numas {
466+
for _, numaNode := range numas {
467467
gpus := mapping[numaNode]
468468
numaString := strconv.FormatInt(int64(numaNode), 10)
469469
gpusString := strings.Join(gpus, ".")

cmd/gpu_nfdhook/labeler_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,42 @@ func getTestCases() []testcase {
537537
"gpu.intel.com/numa-gpu-map": "0-0_1-1",
538538
},
539539
},
540+
{
541+
sysfsdirs: []string{
542+
"card0/device/drm/card0",
543+
"card1/device/drm/card1",
544+
"card1/gt/gt0",
545+
},
546+
sysfsfiles: map[string][]byte{
547+
"card0/device/vendor": []byte("0xfefe"),
548+
"card0/device/numa_node": []byte("0"),
549+
"card1/device/vendor": []byte("0x8086"),
550+
"card1/lmem_total_bytes": []byte("8000"),
551+
"card1/device/numa_node": []byte("1"),
552+
},
553+
name: "successful labeling with one 0x8086 card and numa node info",
554+
memoryOverride: 16000000000,
555+
capabilityFile: map[string][]byte{
556+
"1/i915_capabilities": []byte(
557+
"platform: newnew\n" +
558+
"gen: 9"),
559+
},
560+
expectedRetval: nil,
561+
expectedLabels: labelMap{
562+
"gpu.intel.com/graphics_version": "9",
563+
"gpu.intel.com/media_version": "9",
564+
"gpu.intel.com/millicores": "1000",
565+
"gpu.intel.com/memory.max": "8000",
566+
"gpu.intel.com/platform_newnew.count": "1",
567+
"gpu.intel.com/platform_newnew.present": "true",
568+
"gpu.intel.com/platform_newnew.tiles": "1",
569+
"gpu.intel.com/platform_gen": "9",
570+
"gpu.intel.com/gpu-numbers": "1",
571+
"gpu.intel.com/cards": "card1",
572+
"gpu.intel.com/tiles": "1",
573+
"gpu.intel.com/numa-gpu-map": "1-1",
574+
},
575+
},
540576
{
541577
sysfsdirs: []string{
542578
"card0/device/drm/card0",

0 commit comments

Comments
 (0)