Skip to content

fix: handle GetMemoryInfo ERROR_NOT_SUPPORTED for unified memory GPUs - #1637

Merged
hami-robot[bot] merged 1 commit into
Project-HAMi:masterfrom
jsl9208:fix/unified-memory-gpus
Feb 4, 2026
Merged

fix: handle GetMemoryInfo ERROR_NOT_SUPPORTED for unified memory GPUs#1637
hami-robot[bot] merged 1 commit into
Project-HAMi:masterfrom
jsl9208:fix/unified-memory-gpus

Conversation

@jsl9208

@jsl9208 jsl9208 commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

NVIDIA GB10 (DGX Spark) uses a unified memory architecture where CPU and GPU share the same physical memory. On these GPUs, nvmlDeviceGetMemoryInfo() returns ERROR_NOT_SUPPORTED instead of memory information. The current code treats any non-SUCCESS return as fatal and calls panic(0), which crashes the entire device plugin daemonset and prevents the node from registering any GPU devices.

This PR handles ERROR_NOT_SUPPORTED gracefully by:

  1. Device registration (register.go): Falls back to a new defaultDeviceMemory config value (in MiB). If not configured, the device is skipped with an error log instead of panicking.
  2. Metrics collection (metrics.go): Skips memory metrics for unsupported devices instead of returning an error every scrape cycle.
  3. Config plumbing: Adds defaultDeviceMemory field to NvidiaConfig, Helm chart configmap, and values.yaml.

Which issue(s) this PR fixes:

Fixes #1511

Special notes for your reviewer:

AI assistance disclosure: This PR was developed with Claude Code assisting in code analysis and review. The fix was designed, implemented, and validated by a human on real GB10 hardware.

Tested on real hardware: NVIDIA DGX Spark (GB10, ARM64, Driver 580.95.05, CUDA 13.0, Ubuntu 24.04, K8s v1.34.1).

Scenario Result
Unpatched v2.8.0 on GB10 panic: 0 at register.go:115
Patched with defaultDeviceMemory: 131072 Device registered, pod scheduled, vGPU isolation works ✅
Patched without defaultDeviceMemory Device skipped gracefully, no crash ✅

Usage — for unified memory GPUs, set defaultDeviceMemory to the total GPU memory in MiB:

# values.yaml
devicePlugin:
  defaultDeviceMemory: 131072  # 128 GiB for GB10

Without this config, the device will be skipped (not registered) but the plugin won't crash.

Does this PR introduce a user-facing change?:

Yes. Adds a new optional Helm value devicePlugin.defaultDeviceMemory (default: 0). Only needed for GPUs with unified memory architecture (e.g., NVIDIA GB10/DGX Spark) where nvmlDeviceGetMemoryInfo() is not supported. When set, the device plugin uses this value as the total device memory fallback instead of panicking.

@hami-robot hami-robot Bot added kind/bug Something isn't working dco-signoff: no labels Jan 29, 2026
@hami-robot hami-robot Bot added the size/S label Jan 29, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jsl9208, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical bug where the device plugin would crash when encountering NVIDIA GPUs with unified memory architectures (like GB10/DGX Spark) due to nvmlDeviceGetMemoryInfo() returning ERROR_NOT_SUPPORTED. The fix introduces a robust error handling mechanism, allowing the plugin to either use a user-defined default memory value or gracefully skip the device, ensuring stability and preventing daemonset panics. It also refines metrics collection for such devices and provides a new Helm configuration option for seamless deployment.

Highlights

  • Unified Memory GPU Support: The device plugin now gracefully handles ERROR_NOT_SUPPORTED from nvmlDeviceGetMemoryInfo() on unified memory GPUs (e.g., NVIDIA GB10), preventing crashes.
  • Configurable Memory Fallback: A new defaultDeviceMemory configuration option allows users to specify the total GPU memory in MiB for devices where GetMemoryInfo is not supported.
  • Graceful Device Handling: If defaultDeviceMemory is not configured for an unsupported device, the device is now skipped with an error log instead of causing the entire daemonset to panic.
  • Metrics Collection Improvement: Memory metrics collection now skips devices that return ERROR_NOT_SUPPORTED, avoiding repeated errors during Prometheus scrapes.
  • Helm Chart Integration: The defaultDeviceMemory field has been integrated into the Helm chart's values.yaml and device-configmap.yaml for easy deployment and configuration.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses a crash in the device plugin when running on GPUs with a unified memory architecture, such as the NVIDIA GB10. The changes gracefully handle the ERROR_NOT_SUPPORTED return code by introducing a fallback to a configurable defaultDeviceMemory value, which is a solid approach. The modifications to the metrics collection and Helm charts are also correct and complete the feature. I've included one high-severity suggestion to prevent a potential integer overflow and one medium-severity suggestion to improve logging for better debuggability.

Comment thread pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go
Comment thread pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go
@codecov

codecov Bot commented Jan 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...-plugin/nvidiadevice/nvinternal/plugin/register.go 0.00% 13 Missing ⚠️
Flag Coverage Δ
unittests 51.14% <0.00%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/device/nvidia/device.go 47.31% <ø> (ø)
...-plugin/nvidiadevice/nvinternal/plugin/register.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread charts/hami/templates/scheduler/device-configmap.yaml Outdated
@jsl9208
jsl9208 force-pushed the fix/unified-memory-gpus branch from 2f6958e to 70599e2 Compare January 30, 2026 08:22
@jsl9208
jsl9208 requested a review from archlitchi February 2, 2026 01:03
Comment thread pkg/device/nvidia/device.go Outdated
On NVIDIA GB10 (DGX Spark) and other unified memory architecture GPUs,
nvmlDeviceGetMemoryInfo() returns ERROR_NOT_SUPPORTED, causing the device
plugin to panic.

Changes:
- register.go: Handle ERROR_NOT_SUPPORTED by using PreConfiguredDeviceMemory
  config as fallback. Skip device gracefully (continue) instead of
  panic when config is not set.
- metrics.go: Skip memory metrics collection for unsupported devices.
- device.go: Add PreConfiguredDeviceMemory field to NodeDefaultConfig,
  supporting per-node configuration via nodeconfig.
- charts: Plumb preConfiguredDeviceMemory through Helm values and ConfigMap.

Fixes: Project-HAMi#1511
Signed-off-by: jsl9208 <shilong@heywhale.com>
@jsl9208
jsl9208 force-pushed the fix/unified-memory-gpus branch from 208a20f to c8507fc Compare February 4, 2026 01:37
@jsl9208
jsl9208 requested a review from Shouren February 4, 2026 01:40

@Shouren Shouren left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@hami-robot hami-robot Bot added the lgtm label Feb 4, 2026
@hami-robot

hami-robot Bot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsl9208, Shouren

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

The pull request process is described 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 added the approved label Feb 4, 2026
@hami-robot
hami-robot Bot merged commit 13009aa into Project-HAMi:master Feb 4, 2026
6 checks passed
archlitchi pushed a commit that referenced this pull request May 9, 2026
… (#1841)

On NVIDIA GB10 (DGX Spark) and other unified memory architecture GPUs,
nvmlDeviceGetMemoryInfo() returns ERROR_NOT_SUPPORTED, causing the device
plugin to panic.

Changes:
- register.go: Handle ERROR_NOT_SUPPORTED by using PreConfiguredDeviceMemory
  config as fallback. Skip device gracefully (continue) instead of
  panic when config is not set.
- metrics.go: Skip memory metrics collection for unsupported devices.
- device.go: Add PreConfiguredDeviceMemory field to NodeDefaultConfig,
  supporting per-node configuration via nodeconfig.
- charts: Plumb preConfiguredDeviceMemory through Helm values and ConfigMap.

Fixes: #1511


(cherry picked from commit 13009aa)

Signed-off-by: jsl9208 <shilong@heywhale.com>
Signed-off-by: Saiyam Pathak <saiyam911@gmail.com>
Co-authored-by: jsl9208 <shilong@heywhale.com>
mesutoezdil pushed a commit to mesutoezdil/HAMi that referenced this pull request Jun 14, 2026
…ect-HAMi#1637)

On NVIDIA GB10 (DGX Spark) and other unified memory architecture GPUs,
nvmlDeviceGetMemoryInfo() returns ERROR_NOT_SUPPORTED, causing the device
plugin to panic.

Changes:
- register.go: Handle ERROR_NOT_SUPPORTED by using PreConfiguredDeviceMemory
  config as fallback. Skip device gracefully (continue) instead of
  panic when config is not set.
- metrics.go: Skip memory metrics collection for unsupported devices.
- device.go: Add PreConfiguredDeviceMemory field to NodeDefaultConfig,
  supporting per-node configuration via nodeconfig.
- charts: Plumb preConfiguredDeviceMemory through Helm values and ConfigMap.

Fixes: Project-HAMi#1511

Signed-off-by: jsl9208 <shilong@heywhale.com>
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.

[Bug] Device plugin panics on NVIDIA GB10 (DGX Spark) - GetMemoryInfo returns "Not Supported"

3 participants