From 340d43ee8501a4f5770382e36fa5238e4ebbe309 Mon Sep 17 00:00:00 2001 From: Arjun Date: Thu, 29 Jan 2026 20:26:59 +0000 Subject: [PATCH] Ensure max number of SM are allocated by mig-parted Signed-off-by: Arjun --- pkg/nvlib/device/device.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/nvlib/device/device.go b/pkg/nvlib/device/device.go index a67ce3c..2eab4b6 100644 --- a/pkg/nvlib/device/device.go +++ b/pkg/nvlib/device/device.go @@ -373,8 +373,8 @@ func (d *device) VisitMigProfiles(visit func(MigProfile) error) error { return fmt.Errorf("error getting GPU Instance profile info: %v", ret) } - for j := 0; j < nvml.COMPUTE_INSTANCE_PROFILE_COUNT; j++ { - for k := 0; k < nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT; k++ { + for j := nvml.COMPUTE_INSTANCE_PROFILE_COUNT - 1; j >= 0; j-- { + for k := nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT - 1; k >= 0; k-- { p, err := d.lib.NewMigProfile(i, j, k, giProfileInfo.MemorySizeMB, memory.Total) if err != nil { return fmt.Errorf("error creating MIG profile: %v", err)