Skip to content

Accept the 3-slice graphics MIG profile - #126

Open
v0ropaev wants to merge 1 commit into
NVIDIA:mainfrom
v0ropaev:fix/mig-3-slice-gfx
Open

v0ropaev wants to merge 1 commit into
NVIDIA:mainfrom
v0ropaev:fix/mig-3-slice-gfx

Conversation

@v0ropaev

Copy link
Copy Markdown

Fixes #125.

Two lines in the two giProfileID switches in mig_profile.go: the 3-slice arm gains GPU_INSTANCE_PROFILE_3_SLICE_GFX, and so does the AttributeGraphics arm, so the profile stringifies as 3g.<N>gb+gfx like its 1-, 2- and 4-slice siblings instead of losing the suffix.

The test mock gains the same grouping. That matters for coverage rather than style: GetGpuInstanceProfileInfoFunc ends in default: return info, nvml.ERROR_NOT_SUPPORTED, so without it profile 17 is reported unsupported, VisitMigProfiles skips it, and the path is never exercised. Grouping it with GPU_INSTANCE_PROFILE_3_SLICE is what the mock already does for the other three graphics variants.

TestNewMigProfileAcceptsEveryGraphicsSliceWidth walks all four widths through the exported NewMigProfile. On d3f4ca8 the 3-slice case fails with invalid GPU Instance Profile ID: 17 while the other three pass; here all four pass.

The knock-on effect, measured with the extended mock, which is what a driver that exposes profile 17 looks like. Before:

GetMigProfiles() err = error visiting devices: error visiting device: error visiting device: error creating MIG profile: invalid GPU Instance Profile ID: 17
ParseMigProfile("1g.5gb") = <nil>, err = error getting list of possible MIG profiles: ... invalid GPU Instance Profile ID: 17

After:

GetMigProfiles() err = <nil>
profiles = [1g.5gb ... 3g.20gb ... 1c.3g.20gb+gfx 2c.3g.20gb+gfx 3g.20gb+gfx]
ParseMigProfile("1g.5gb") = 1g.5gb, err = <nil>

A plain 1g.5gb lookup failing because of an unrelated profile ID is the part worth noting: VisitMigProfiles returns hard on the first ID NewMigProfile does not know, so the gap is not contained to the graphics profile.

go test -mod=vendor -count=1 ./... is green on all seven packages, gofmt -l pkg/ and go vet ./... clean, go 1.27.1 darwin/arm64. No vendor or go.mod change, so make check-vendor and make check-third-party-notices are unaffected. I have no hardware with the 3-slice graphics profile, so everything above is the repo's own mock rather than a real GPU.

NewMigProfile groups every graphics variant with its plain counterpart except
at three slices, so GPU_INSTANCE_PROFILE_3_SLICE_GFX falls through to the
default arm and errors. The AttributeGraphics switch had the same hole, which
would have cost the profile its +gfx suffix.

The ID arrived with the go-nvml 0.13.2-0 bump, which also raised
GPU_INSTANCE_PROFILE_COUNT from 17 to 18. That put the unhandled ID inside
VisitMigProfiles' range, so on a driver reporting it as supported the error
takes GetMigProfiles, ParseMigProfile and MigDevice.GetProfile down with it.

The test mock groups the GFX variants with their plain counterparts, so it
gets the 3-slice one too; without that the profile is reported unsupported
and the path is never reached.

Fixes NVIDIA#125

Signed-off-by: Dmitry Voropaev <dy.voropaev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NewMigProfile rejects GPU_INSTANCE_PROFILE_3_SLICE_GFX

1 participant