Skip to content

Commit de44464

Browse files
committed
support for new mig profiles
Signed-off-by: Varun Ramachandra Sekar <vsekar@nvidia.com>
1 parent 532907f commit de44464

2 files changed

Lines changed: 30 additions & 7 deletions

File tree

pkg/nvlib/device/mig_profile.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import (
2828

2929
const (
3030
// AttributeMediaExtensions holds the string representation for the media extension MIG profile attribute.
31-
AttributeMediaExtensions = "me"
31+
AttributeMediaExtensions = "me"
32+
AttributeMediaExtensionsAll = "me.all"
33+
AttributeGraphics = "gfx"
3234
)
3335

3436
// MigProfile represents a specific MIG profile.
@@ -59,14 +61,21 @@ func (d *devicelib) NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int,
5961
switch giProfileID {
6062
case nvml.GPU_INSTANCE_PROFILE_1_SLICE,
6163
nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV1,
62-
nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV2:
64+
nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV2,
65+
nvml.GPU_INSTANCE_PROFILE_1_SLICE_GFX,
66+
nvml.GPU_INSTANCE_PROFILE_1_SLICE_NO_ME,
67+
nvml.GPU_INSTANCE_PROFILE_1_SLICE_ALL_ME:
6368
giSlices = 1
6469
case nvml.GPU_INSTANCE_PROFILE_2_SLICE,
65-
nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1:
70+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1,
71+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_GFX,
72+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_NO_ME,
73+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_ALL_ME:
6674
giSlices = 2
6775
case nvml.GPU_INSTANCE_PROFILE_3_SLICE:
6876
giSlices = 3
69-
case nvml.GPU_INSTANCE_PROFILE_4_SLICE:
77+
case nvml.GPU_INSTANCE_PROFILE_4_SLICE,
78+
nvml.GPU_INSTANCE_PROFILE_4_SLICE_GFX:
7079
giSlices = 4
7180
case nvml.GPU_INSTANCE_PROFILE_6_SLICE:
7281
giSlices = 6
@@ -104,6 +113,13 @@ func (d *devicelib) NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int,
104113
case nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV1,
105114
nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1:
106115
attrs = append(attrs, AttributeMediaExtensions)
116+
case nvml.GPU_INSTANCE_PROFILE_1_SLICE_ALL_ME,
117+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_ALL_ME:
118+
attrs = append(attrs, AttributeMediaExtensionsAll)
119+
case nvml.GPU_INSTANCE_PROFILE_1_SLICE_GFX,
120+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_GFX,
121+
nvml.GPU_INSTANCE_PROFILE_4_SLICE_GFX:
122+
attrs = append(attrs, AttributeGraphics)
107123
}
108124

109125
p := &MigProfileInfo{

pkg/nvlib/device/mig_profile_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,23 @@ func newMockDeviceLib() Interface {
4848
info := nvml.GpuInstanceProfileInfo{}
4949
switch Profile {
5050
case nvml.GPU_INSTANCE_PROFILE_1_SLICE,
51-
nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV1:
51+
nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV1,
52+
nvml.GPU_INSTANCE_PROFILE_1_SLICE_GFX,
53+
nvml.GPU_INSTANCE_PROFILE_1_SLICE_NO_ME,
54+
nvml.GPU_INSTANCE_PROFILE_1_SLICE_ALL_ME:
5255
info.MemorySizeMB = 5 * 1024
5356
case nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV2:
5457
info.MemorySizeMB = 10 * 1024
5558
case nvml.GPU_INSTANCE_PROFILE_2_SLICE,
56-
nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1:
59+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1,
60+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_GFX,
61+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_NO_ME,
62+
nvml.GPU_INSTANCE_PROFILE_2_SLICE_ALL_ME:
5763
info.MemorySizeMB = 10 * 1024
5864
case nvml.GPU_INSTANCE_PROFILE_3_SLICE:
5965
info.MemorySizeMB = 20 * 1024
60-
case nvml.GPU_INSTANCE_PROFILE_4_SLICE:
66+
case nvml.GPU_INSTANCE_PROFILE_4_SLICE,
67+
nvml.GPU_INSTANCE_PROFILE_4_SLICE_GFX:
6168
info.MemorySizeMB = 20 * 1024
6269
case nvml.GPU_INSTANCE_PROFILE_7_SLICE:
6370
info.MemorySizeMB = 40 * 1024

0 commit comments

Comments
 (0)