fix: handle GetMemoryInfo ERROR_NOT_SUPPORTED for unified memory GPUs - #1637
Conversation
Summary of ChangesHello @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 Highlights
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
f186ab2 to
2f6958e
Compare
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
2f6958e to
70599e2
Compare
70599e2 to
208a20f
Compare
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>
208a20f to
c8507fc
Compare
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
… (#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>
…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>
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()returnsERROR_NOT_SUPPORTEDinstead of memory information. The current code treats any non-SUCCESS return as fatal and callspanic(0), which crashes the entire device plugin daemonset and prevents the node from registering any GPU devices.This PR handles
ERROR_NOT_SUPPORTEDgracefully by:register.go): Falls back to a newdefaultDeviceMemoryconfig value (in MiB). If not configured, the device is skipped with an error log instead of panicking.metrics.go): Skips memory metrics for unsupported devices instead of returning an error every scrape cycle.defaultDeviceMemoryfield toNvidiaConfig, Helm chart configmap, andvalues.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).
panic: 0atregister.go:115❌defaultDeviceMemory: 131072defaultDeviceMemoryUsage — for unified memory GPUs, set
defaultDeviceMemoryto the total GPU memory in MiB: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) wherenvmlDeviceGetMemoryInfo()is not supported. When set, the device plugin uses this value as the total device memory fallback instead of panicking.