Skip to content

fix(mig): support RTX PRO 6000 Blackwell dynamic MIG - #2132

Closed
shkatara wants to merge 1 commit into
Project-HAMi:masterfrom
shkatara:fallback-to-nvidia-smi
Closed

fix(mig): support RTX PRO 6000 Blackwell dynamic MIG#2132
shkatara wants to merge 1 commit into
Project-HAMi:masterfrom
shkatara:fallback-to-nvidia-smi

Conversation

@shkatara

@shkatara shkatara commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

  • Adds supported dynamic MIG geometries for the NVIDIA RTX PRO 6000 Blackwell Server Edition.
  • Verifies that nvidia-mig-parted apply actually created the requested number of MIG instances.
  • Falls back to nvidia-smi mig -cgi ... -C when nvidia-mig-parted exits successfully but creates no instances.
  • Adds unit coverage for the RTX PRO 6000 model, MIG inventory parsing, and profile argument generation.

Without this validation, nvidia-mig-parted can report success on PCI device 2bb5 while leaving the GPU without MIG instances, allowing allocation to continue with an empty MIG UUID.

Which issue(s) this PR fixes:

Fixes #2131

Special notes for your reviewer:

Tested with:

go test ./pkg/device-plugin/nvidiadevice/nvinternal/plugin

A linux/amd64 test image was built from commit 193e074 as docker.io/shkatara/master-hami:fallback-to-nvidia-smi.

Cursor AI assisted with investigation, code generation, tests, and drafting the issue and pull request. The resulting changes were reviewed and the unit tests were run locally.

Does this PR introduce a user-facing change?:

Dynamic MIG allocation now supports NVIDIA RTX PRO 6000 Blackwell Server Edition GPUs and recovers when nvidia-mig-parted silently creates no MIG instances.

Summary by CodeRabbit

  • New Features

    • Added support for NVIDIA RTX PRO 6000 Blackwell Server Edition GPUs.
    • Added supported MIG configurations: 1g.24gb, 2g.48gb, and 4g.96gb.
    • Added automatic verification and recovery when requested MIG instances are not created successfully.
  • Documentation

    • Documented the new GPU model and supported MIG geometries in the dynamic MIG configuration guide.
  • Bug Fixes

    • Improved reliability of MIG instance creation by detecting missing instances and recreating the requested configuration.

…ver Edition

The RTX PRO 6000 Blackwell Server Edition (96 GB, 188 SMs) supports up to
4 MIG instances but was not present in knownMigGeometries, so its model
string matched no entry and dynamic MIG carving was silently skipped
(zero geometries, no error).

Add its allowed geometries, mirroring the A30's 4-slice layout scaled to
96 GB:
  - 1g.24gb x4 (core 25)
  - 2g.48gb x2 (core 50)
  - 4g.96gb x1 (core 100)

Model matching is substring-based (strings.Contains), so the configured
"RTX PRO 6000 Blackwell Server Edition" matches the full NVML name
"NVIDIA RTX PRO 6000 Blackwell Server Edition".

- charts: add entry to the default device-configmap
- docs: document the new model in dynamic-mig.md
- test: cover the new model in TestGenerateMigTemplate, asserting the
  full NVML name resolves to the 1g.24gb x4 geometry

fix(mig): fall back to nvidia-smi when nvidia-mig-parted creates no instances

On some newer cards (notably the RTX PRO 6000 Blackwell Server Edition on
open-kernel driver 610), `nvidia-mig-parted apply` reports success but its
NVML-based create path is a silent no-op: zero GPU instances are created,
no error is returned, and the pod ends up with no GPU. The `nvidia-smi mig
-cgi ... -C` CLI creates the same geometry correctly on that hardware.

After `nvidia-mig-parted apply`, verify via `nvidia-smi -L` that each GPU
actually has the requested number of MIG instances. For any GPU that is
short, reset and recreate the geometry with nvidia-smi. This is a no-op on
hardware where nvidia-mig-parted already carved the instances, so it is
safe for all MIG-capable cards.

Verified on 8× RTX PRO 6000 Blackwell Server Edition.

Signed-off-by: shkatara <writeshubhamhere@gmail.com>
@hami-robot hami-robot Bot added the kind/bug Something isn't working label Jul 25, 2026
@hami-robot

hami-robot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shkatara
Once this PR has been reviewed and has the lgtm label, please assign shouren for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hami-robot
hami-robot Bot requested review from FouoF and lengrongfu July 25, 2026 17:46
@hami-robot

hami-robot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Welcome @shkatara! It looks like this is your first PR to Project-HAMi/HAMi 🎉

@hami-robot hami-robot Bot added the size/L label Jul 25, 2026
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds RTX PRO 6000 Blackwell Server Edition MIG geometries, verifies instances after nvidia-mig-parted applies a template, and recreates missing geometry through nvidia-smi. Tests cover model matching, instance parsing, profile ordering, and slice extraction.

Changes

Dynamic MIG fallback

Layer / File(s) Summary
RTX PRO 6000 geometry configuration
charts/hami/templates/scheduler/device-configmap.yaml, docs/develop/dynamic-mig.md, pkg/device-plugin/nvidiadevice/nvinternal/plugin/util_test.go
Adds 1g.24gb, 2g.48gb, and 4g.96gb geometries for the RTX PRO 6000 Blackwell Server Edition and tests template generation and model substring matching.
Post-apply MIG verification and recreation
pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go
Checks actual MIG instance counts after template application and uses nvidia-smi to recreate missing GPU-instance geometry.
Fallback helper tests
pkg/device-plugin/nvidiadevice/nvinternal/plugin/util_test.go
Tests SMI output parsing, -cgi argument construction, profile ordering, zero-count handling, and slice extraction.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ApplyMigTemplate
  participant nvidia-mig-parted
  participant ensureMigInstancesViaSmi
  participant nvidia-smi
  ApplyMigTemplate->>nvidia-mig-parted: Apply MIG template
  nvidia-mig-parted-->>ApplyMigTemplate: Return success
  ApplyMigTemplate->>ensureMigInstancesViaSmi: Verify requested instances
  ensureMigInstancesViaSmi->>nvidia-smi: Query MIG instances
  nvidia-smi-->>ensureMigInstancesViaSmi: Return per-GPU counts
  ensureMigInstancesViaSmi->>nvidia-smi: Recreate missing geometry
  nvidia-smi-->>ensureMigInstancesViaSmi: Return creation result
Loading

Suggested labels: enhancement

Suggested reviewers: archlitchi

Poem

I’m a rabbit with MIG in my hat,
Three geometries—imagine that!
If instances hide from the view,
nvidia-smi makes them anew.
Stable slices hop into line,
And Blackwell GPUs now shine.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: dynamic MIG support for RTX PRO 6000 Blackwell GPUs.
Linked Issues check ✅ Passed The code adds post-apply MIG verification, RTX PRO 6000 Blackwell geometries, and an nvidia-smi fallback as requested.
Out of Scope Changes check ✅ Passed The changes stay focused on the MIG fix, with only matching chart, docs, code, and tests updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from archlitchi July 25, 2026 17:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go`:
- Around line 363-399: Update ensureMigInstancesViaSmi to return an error
instead of logging and continuing when nvidia-smi -L or createMigDevicesViaSmi
fails, and propagate that error through ApplyMigTemplate. After recreating MIG
devices, rerun the nvidia-smi listing and verify the expected instance counts
before returning success; report any failed verification as an error.
- Around line 374-397: Compare exact per-GPU MIG profile counts instead of only
total counts in the validation logic around migInstanceCountsFromSmi and
createMigDevicesViaSmi; trigger recreation when any requested profile count in
migSpec.MigDevices differs from the discovered inventory. In
pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go lines 374-397, retain
per-profile counts and validate every requested geometry. In
pkg/device-plugin/nvidiadevice/nvinternal/plugin/util_test.go lines 190-210, add
a fixture with the same total instance count but different profiles and assert
it is treated as a mismatch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4227e104-d1a5-416e-9088-359c21c82bfe

📥 Commits

Reviewing files that changed from the base of the PR and between 96cc5fa and 193e074.

📒 Files selected for processing (4)
  • charts/hami/templates/scheduler/device-configmap.yaml
  • docs/develop/dynamic-mig.md
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/util_test.go

Comment on lines +363 to +399
func (nv *NvidiaDevicePlugin) ensureMigInstancesViaSmi() {
current, ok := nv.migCurrent.MigConfigs["current"]
if !ok {
return
}

out, err := exec.Command("nvidia-smi", "-L").CombinedOutput()
if err != nil {
klog.Errorf("failed to list GPUs with nvidia-smi -L, skipping MIG fallback: %v, output: %s", err, string(out))
return
}
counts := migInstanceCountsFromSmi(string(out))

for _, migSpec := range current {
if !migSpec.MigEnabled {
continue
}
expected := 0
for _, c := range migSpec.MigDevices {
expected += int(c)
}
if expected == 0 {
continue
}
for _, dev := range migSpec.Devices {
gpuIndex := int(dev)
if counts[gpuIndex] >= expected {
continue
}
klog.Warningf("GPU %d has %d MIG instance(s) but %d were requested; nvidia-mig-parted did not create them, falling back to nvidia-smi", gpuIndex, counts[gpuIndex], expected)
if err := createMigDevicesViaSmi(gpuIndex, migSpec.MigDevices); err != nil {
klog.Errorf("nvidia-smi MIG fallback failed for GPU %d: %v", gpuIndex, err)
continue
}
klog.Infof("nvidia-smi MIG fallback created geometry on GPU %d: %v", gpuIndex, migSpec.MigDevices)
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Propagate fallback failures instead of continuing startup.

A failed nvidia-smi -L query or creation command is only logged, so ApplyMigTemplate still returns successfully without a usable MIG geometry. Return and propagate an error, and perform a final verification after recreation before allowing the startup path to succeed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go` around lines 363 -
399, Update ensureMigInstancesViaSmi to return an error instead of logging and
continuing when nvidia-smi -L or createMigDevicesViaSmi fails, and propagate
that error through ApplyMigTemplate. After recreating MIG devices, rerun the
nvidia-smi listing and verify the expected instance counts before returning
success; report any failed verification as an error.

Comment on lines +374 to +397
counts := migInstanceCountsFromSmi(string(out))

for _, migSpec := range current {
if !migSpec.MigEnabled {
continue
}
expected := 0
for _, c := range migSpec.MigDevices {
expected += int(c)
}
if expected == 0 {
continue
}
for _, dev := range migSpec.Devices {
gpuIndex := int(dev)
if counts[gpuIndex] >= expected {
continue
}
klog.Warningf("GPU %d has %d MIG instance(s) but %d were requested; nvidia-mig-parted did not create them, falling back to nvidia-smi", gpuIndex, counts[gpuIndex], expected)
if err := createMigDevicesViaSmi(gpuIndex, migSpec.MigDevices); err != nil {
klog.Errorf("nvidia-smi MIG fallback failed for GPU %d: %v", gpuIndex, err)
continue
}
klog.Infof("nvidia-smi MIG fallback created geometry on GPU %d: %v", gpuIndex, migSpec.MigDevices)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Verify exact MIG geometry rather than total instance count. The runtime and test both reduce inventory to a per-GPU total, which accepts an incorrect profile mix with the requested number of instances.

  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go#L374-L397: retain and compare each MIG <profile> count per GPU against migSpec.MigDevices; recreate on any mismatch.
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/util_test.go#L190-L210: add a same-total/different-profile fixture and assert that it is treated as a mismatch.
📍 Affects 2 files
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go#L374-L397 (this comment)
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/util_test.go#L190-L210
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go` around lines 374 -
397, Compare exact per-GPU MIG profile counts instead of only total counts in
the validation logic around migInstanceCountsFromSmi and createMigDevicesViaSmi;
trigger recreation when any requested profile count in migSpec.MigDevices
differs from the discovered inventory. In
pkg/device-plugin/nvidiadevice/nvinternal/plugin/util.go lines 374-397, retain
per-profile counts and validate every requested geometry. In
pkg/device-plugin/nvidiadevice/nvinternal/plugin/util_test.go lines 190-210, add
a fixture with the same total instance count but different profiles and assert
it is treated as a mismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundled nvidia-mig-parted does not support RTX PRO 6000 Blackwell Server Edition

1 participant