Skip to content

feat(device-plugin): support CDI-only NVIDIA accelerators (GB10) - #2087

Closed
tittuvarghese wants to merge 3 commits into
Project-HAMi:masterfrom
tittuvarghese:feat/nvidia-gb10-device-plugin
Closed

feat(device-plugin): support CDI-only NVIDIA accelerators (GB10)#2087
tittuvarghese wants to merge 3 commits into
Project-HAMi:masterfrom
tittuvarghese:feat/nvidia-gb10-device-plugin

Conversation

@tittuvarghese

@tittuvarghese tittuvarghese commented Jul 17, 2026

Copy link
Copy Markdown

Problem

The NVIDIA GB10 (Grace-Blackwell iGPU, as in the DGX Spark) is exposed to the node only via CDI — the NVIDIA Container Toolkit / GPU Operator generates /var/run/cdi/k8s.device-plugin.nvidia.com-gpu.json, and the device is not enumerable via NVML inside the device-plugin container.

HAMi's NVIDIA device plugin discovers devices only through NVML (or tegra). On a GB10 node info.ResolvePlatform() returns unknown, getResourceManagers() hits its default branch, and the plugin crashes at start-up:

factory.go] Incompatible strategy detected auto
main.go] error starting plugins: ... failed to construct resource managers:
         invalid device discovery strategy

The node therefore never registers the GPU with HAMi.

This is distinct from #1637 (handling GetMemoryInfoNOT_SUPPORTED for unified-memory GPUs): that fix runs in register.go after NVML discovery has already succeeded, so it is never reached on a CDI-only node — the crash happens earlier, in discovery.

Change

Add a cdi device-discovery strategy that discovers GPUs from the node's externally-managed CDI specs, without NVML:

  • rm: NewCDIResourceManagers / buildCDIDeviceMap enumerate GPU devices from the CDI specs (vendor k8s.device-plugin.nvidia.com, class gpu; the all meta-device is excluded), keying each device by its CDI device name so the existing cdi-annotations / cdi-cri allocation path builds a matching qualified device name for injection.
  • factory: add the cdi case, and auto-fall back to it from auto when no NVML/tegra platform is detected but a CDI device-list strategy is active and CDI specs are present.
  • cdi: when NVML is absent but a CDI device-list strategy is requested, return a lightweight external handler instead of the null handler, so QualifiedName() still works for injection.
  • register/server: in CDI mode, build the node-registration DeviceInfo from configuration (preConfiguredDeviceMemory / new preConfiguredDeviceType) and skip NVML-based enumeration, device counting and MIG handling.
  • main: accept --device-discovery-strategy=cdi and allow CDI device-list strategies without NVML when using CDI discovery.
  • chart: expose devicePlugin.deviceDiscoveryStrategy and devicePlugin.preConfiguredDeviceType.
  • docs: docs/nvidia-gb10-support.md.

Recommended GB10 configuration

devicePlugin:
  deviceDiscoveryStrategy: "cdi"
  deviceListStrategy: "cdi-annotations,cdi-cri"
  preConfiguredDeviceMemory: 122566   # policy value in MiB; see note below
  preConfiguredDeviceType: "NVIDIA-GB10"

preConfiguredDeviceMemory is a scheduling policy value (MiB), not a hardware readout — on a unified-memory GPU the memory is shared with the OS/CPU. The 122566 example is this DGX Spark's total system memory reported by Kubernetes (.status.capacity.memory = 125506464Ki, i.e. 125506464 / 1024 ≈ 122566 MiB ≈ 119.7 GiB), not a direct GiB conversion (120 GiB would be 122880 MiB). Set it at or below the node's total unified memory, leaving OS headroom.

The node also needs the gpu=on label (device-plugin DaemonSet selector), and — unrelated to this change but required for the plugin to start on busy nodes — a sufficiently high fs.inotify.max_user_instances (the default 128 can be exhausted, causing couldn't initialize inotify: too many open files). See the doc for details.

Testing

  • go build ./..., go vet, and golangci-lint (v2.12.2) — clean (0 issues) on all changed packages.
  • Unit tests added for CDI discovery (buildCDIDeviceMap, listCDIGPUDevices, HasCDISpecs, NewCDIResourceManagers) and the external CDI handler; full pkg/device-plugin/... and pkg/device/nvidia/... suites pass with --race.
  • helm lint / helm template verified (default render is unchanged / backward-compatible).
  • Reproduced and validated on real GB10 hardware (DGX Spark, aarch64):
    • Confirmed the pre-fix crash (invalid device discovery strategy) on the node.
    • Confirmed the on-node CDI spec is cdiVersion 0.7.0, kind k8s.device-plugin.nvidia.com/gpu, with a GPU-UUID device entry — matching the discovery vendor/class and the QualifiedName used for injection.
    • Confirmed GFD reports nvidia.com/gpu.product=NVIDIA-GB10 (the default preConfiguredDeviceType) and ~120 GiB unified memory.

AI assistance disclosure

Per CONTRIBUTING.md: this contribution (code and docs) was developed with AI assistance under human supervision. I reviewed the generated code, and diagnosed the failure mode and validated the fix end-to-end against a real GB10 (DGX Spark) node as described in Testing.

Summary by CodeRabbit

  • New Features
    • Added CDI-only discovery/allocation support for NVIDIA accelerators when NVML is unavailable.
    • Introduced deviceDiscoveryStrategy and preConfiguredDeviceType configuration, with CDI-mode defaults to NVIDIA-GB10 (when unset), including scheduler/device-plugin integration.
  • Bug Fixes
    • Ensured externally provided CDI specs are used correctly in CDI-only scenarios.
  • Documentation
    • Added guidance for enabling HAMi support for NVIDIA GB10 in CDI-only mode, including known limitations.
  • Tests
    • Added unit tests covering CDI spec discovery, device mapping, and external CDI handler behavior.

@hami-robot
hami-robot Bot requested a review from lengrongfu July 17, 2026 10:12
@hami-robot
hami-robot Bot requested a review from mesutoezdil July 17, 2026 10:12
@hami-robot

hami-robot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tittuvarghese
Once this PR has been reviewed and has the lgtm label, please assign wawa0210 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

@github-actions github-actions Bot added the kind/feature new function label Jul 17, 2026
@hami-robot

hami-robot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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

@hami-robot hami-robot Bot added the size/XL label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds CDI-only NVIDIA device discovery for accelerators unavailable through NVML, including CDI resource managers, plugin registration, Helm configuration, CLI validation, external CDI handling, tests, and GB10 documentation.

Changes

CDI discovery support

Layer / File(s) Summary
Configuration and external CDI handler
charts/hami/..., cmd/device-plugin/nvidia/..., pkg/device-plugin/nvidiadevice/nvinternal/cdi/..., pkg/device/nvidia/device.go
Adds CDI strategy and preconfigured device-type settings, validates the strategy, and supports externally managed CDI specifications.
CDI device and resource management
pkg/device-plugin/nvidiadevice/nvinternal/rm/...
Scans CDI specs, maps GPU entries to configured resources, and provides allocation without explicit device paths or NVML health checks.
Plugin discovery and registration
pkg/device-plugin/nvidiadevice/nvinternal/plugin/...
Resolves CDI fallback, bypasses NVML enumeration, and registers CDI devices using configured memory, type, and scaling values.
GB10 support documentation
docs/nvidia-gb10-support.md
Documents prerequisites, configuration, CDI operation, and CDI-mode limitations for GB10 devices.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested labels: enhancement

Suggested reviewers: shouren, lengrongfu, archlitchi, mesutoezdil

Sequence Diagram(s)

sequenceDiagram
  participant PluginFactory
  participant CDIResourceManagers
  participant NvidiaDevicePlugin
  participant DeviceRegistration
  PluginFactory->>PluginFactory: resolve strategy as cdi
  PluginFactory->>CDIResourceManagers: create CDI resource managers
  PluginFactory->>NvidiaDevicePlugin: enable cdiDiscovery
  NvidiaDevicePlugin->>DeviceRegistration: build devices from CDI entries
  DeviceRegistration-->>NvidiaDevicePlugin: return registered devices
Loading

Poem

A rabbit hopped through CDI snow,
Found GPU names in specs below.
No NVML call could slow the way,
Preconfigured types joined the play.
“GB10 hops!” the bunny cried,
As CDI devices sprang inside.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.94% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: CDI-only support for NVIDIA GB10 accelerators in the device plugin.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@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 introduces support for the NVIDIA GB10 (Grace-Blackwell iGPU) and other CDI-only accelerators that cannot be enumerated via NVML. It adds a new cdi device discovery strategy that reads node CDI specs directly to discover GPUs, bypassing NVML. It also adds configuration options for specifying pre-configured device memory and type, and updates the Helm charts, documentation, and tests accordingly. One high-severity issue was found in pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go where calling d.GetUUID() with a single-value assignment will cause a compilation error, as it returns two values. It is recommended to use d.ID directly instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go Outdated
@tittuvarghese
tittuvarghese force-pushed the feat/nvidia-gb10-device-plugin branch from bc14794 to a3bfca2 Compare July 17, 2026 10:15

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/device-plugin/nvidiadevice/nvinternal/plugin/server.go (1)

295-296: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Skip MIG handling when CDI discovery is enabled.

The comment on line 265 states that MIG handling should be skipped entirely when in CDI discovery mode. However, the code currently enters the MIG handling block whenever operatingMode == "mig". Because deviceNames is empty in this mode, deviceSupportMig remains true, and the plugin attempts to execute nvidia-mig-parted (which relies on NVML). This results in a failed execution and an unnecessary error log before the plugin eventually falls back to a non-MIG configuration.

Update the condition to explicitly skip MIG handling when cdiDiscovery is enabled.

🐛 Proposed fix
 	migApplied := false
-	if plugin.operatingMode == "mig" {
+	if plugin.operatingMode == "mig" && !plugin.cdiDiscovery {
 		deviceSupportMig := true
🤖 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/server.go` around lines 295
- 296, Update the MIG handling condition near migApplied so it only executes
when operatingMode is "mig" and cdiDiscovery is disabled. Preserve the existing
MIG logic for non-CDI MIG mode and skip it entirely when CDI discovery is
enabled.
🧹 Nitpick comments (1)
docs/nvidia-gb10-support.md (1)

34-35: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value

Align the CDI path documentation with the mounted host path
docs/nvidia-gb10-support.md says the plugin scans /etc/cdi and /var/run/cdi, but the DaemonSet only mounts /var/run/cdi. Update the docs to match the mount, or add the missing /etc/cdi mount if both paths are intended.

🤖 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 `@docs/nvidia-gb10-support.md` around lines 34 - 35, Update the NVIDIA GPU
Operator/CDI setup documentation in nvidia-gb10-support.md to reference only the
mounted /var/run/cdi path, unless the DaemonSet is intentionally changed to
mount /etc/cdi as well. Ensure the documented plugin scan paths and generated
CDI spec location match the actual DaemonSet mount configuration.

Source: MCP tools

🤖 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 `@docs/nvidia-gb10-support.md`:
- Around line 71-73: Update the `preConfiguredDeviceMemory` documentation to
clarify that `122566` represents the DGX Spark’s reported usable GPU memory
after system reservation, not a direct 120 GiB-to-MiB conversion, and cite the
authoritative source for that value.

---

Outside diff comments:
In `@pkg/device-plugin/nvidiadevice/nvinternal/plugin/server.go`:
- Around line 295-296: Update the MIG handling condition near migApplied so it
only executes when operatingMode is "mig" and cdiDiscovery is disabled. Preserve
the existing MIG logic for non-CDI MIG mode and skip it entirely when CDI
discovery is enabled.

---

Nitpick comments:
In `@docs/nvidia-gb10-support.md`:
- Around line 34-35: Update the NVIDIA GPU Operator/CDI setup documentation in
nvidia-gb10-support.md to reference only the mounted /var/run/cdi path, unless
the DaemonSet is intentionally changed to mount /etc/cdi as well. Ensure the
documented plugin scan paths and generated CDI spec location match the actual
DaemonSet mount configuration.
🪄 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: 9954d92b-d79b-4347-9e38-8e7a698770f4

📥 Commits

Reviewing files that changed from the base of the PR and between 125c8c6 and bc14794.

📒 Files selected for processing (16)
  • charts/hami/templates/device-plugin/daemonsetnvidia.yaml
  • charts/hami/templates/scheduler/device-configmap.yaml
  • charts/hami/values.yaml
  • cmd/device-plugin/nvidia/main.go
  • cmd/device-plugin/nvidia/plugin-manager.go
  • docs/nvidia-gb10-support.md
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/cdi.go
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external.go
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external_test.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/factory.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/server.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_devices.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_devices_test.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_manager.go
  • pkg/device/nvidia/device.go

Comment thread docs/nvidia-gb10-support.md Outdated

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/device-plugin/nvidiadevice/nvinternal/plugin/server.go (1)

295-296: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Skip MIG handling when CDI discovery is active.

The comment on line 264 explicitly states that MIG handling should be skipped entirely for CDI-only accelerators. However, because deviceNames is empty in CDI mode, the loop over deviceNames (line 298) does zero iterations, leaving deviceSupportMig as true. This inadvertently allows the plugin to execute nvidia-mig-parted export, violating the intent to skip MIG handling.

Modify the condition to explicitly bypass the MIG configuration block when cdiDiscovery is true.

🐛 Proposed fix
 	migApplied := false
-	if plugin.operatingMode == "mig" {
+	if plugin.operatingMode == "mig" && !plugin.cdiDiscovery {
 		deviceSupportMig := true
🤖 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/server.go` around lines 295
- 296, Update the MIG configuration condition in the plugin server to require
both MIG operating mode and !cdiDiscovery, so CDI-only accelerators bypass the
entire MIG handling block. Preserve the existing MIG behavior when CDI discovery
is inactive.
🧹 Nitpick comments (1)
docs/nvidia-gb10-support.md (1)

22-22: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Specify a language for the fenced code block.

To improve syntax highlighting and resolve markdownlint warnings (MD040), specify a language for this code block (e.g., text or log).

♻️ Proposed fix
-```
+```text
🤖 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 `@docs/nvidia-gb10-support.md` at line 22, Specify a language identifier on the
fenced code block in the NVIDIA GB10 support documentation, using an appropriate
value such as text or log, while leaving the block’s contents unchanged.

Source: Linters/SAST tools

🤖 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.

Outside diff comments:
In `@pkg/device-plugin/nvidiadevice/nvinternal/plugin/server.go`:
- Around line 295-296: Update the MIG configuration condition in the plugin
server to require both MIG operating mode and !cdiDiscovery, so CDI-only
accelerators bypass the entire MIG handling block. Preserve the existing MIG
behavior when CDI discovery is inactive.

---

Nitpick comments:
In `@docs/nvidia-gb10-support.md`:
- Line 22: Specify a language identifier on the fenced code block in the NVIDIA
GB10 support documentation, using an appropriate value such as text or log,
while leaving the block’s contents unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ab66088-3c74-4984-915a-47da23bfb95c

📥 Commits

Reviewing files that changed from the base of the PR and between bc14794 and a3bfca2.

📒 Files selected for processing (16)
  • charts/hami/templates/device-plugin/daemonsetnvidia.yaml
  • charts/hami/templates/scheduler/device-configmap.yaml
  • charts/hami/values.yaml
  • cmd/device-plugin/nvidia/main.go
  • cmd/device-plugin/nvidia/plugin-manager.go
  • docs/nvidia-gb10-support.md
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/cdi.go
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external.go
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external_test.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/factory.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/server.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_devices.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_devices_test.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_manager.go
  • pkg/device/nvidia/device.go
🚧 Files skipped from review as they are similar to previous changes (11)
  • cmd/device-plugin/nvidia/plugin-manager.go
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external.go
  • cmd/device-plugin/nvidia/main.go
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/cdi.go
  • charts/hami/templates/device-plugin/daemonsetnvidia.yaml
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external_test.go
  • pkg/device/nvidia/device.go
  • charts/hami/templates/scheduler/device-configmap.yaml
  • charts/hami/values.yaml
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/factory.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_manager.go

@tittuvarghese
tittuvarghese force-pushed the feat/nvidia-gb10-device-plugin branch from a3bfca2 to d99e1f2 Compare July 17, 2026 10:31
Comment thread pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go
@coderabbitai
coderabbitai Bot requested a review from mesutoezdil July 17, 2026 10:33

@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: 3

🤖 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 `@docs/nvidia-gb10-support.md`:
- Line 22: Update the diagnostic log code fence in the documentation to specify
the text language, using the existing fenced block as the target.
- Line 102: Update the preConfiguredDeviceType bullet in the documentation to
begin with “It can be overridden,” making the sentence grammatically complete
while preserving the existing meaning and per-node preconfigureddevicetype
reference.
- Around line 76-97: Correct the memory conversion example in the documentation
so the sample Kubernetes capacity, preConfiguredDeviceMemory value, and derived
MiB explanation are consistent. Update the 122566 value or the displayed
calculation to reflect that 125506464Ki divided by 1024 is approximately
122565MiB, or explicitly identify any intentional policy rounding/adjustment.
🪄 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: 11481b5f-c1c0-43f0-a762-ae95cd3e0bef

📥 Commits

Reviewing files that changed from the base of the PR and between a3bfca2 and d99e1f2.

📒 Files selected for processing (1)
  • docs/nvidia-gb10-support.md

Comment thread docs/nvidia-gb10-support.md Outdated
Comment thread docs/nvidia-gb10-support.md
Comment thread docs/nvidia-gb10-support.md
@tittuvarghese
tittuvarghese force-pushed the feat/nvidia-gb10-device-plugin branch from d99e1f2 to 63cabd3 Compare July 17, 2026 10:35
@mesutoezdil

mesutoezdil commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

if you wouldn't mind doing merge commits instead of force pushing, that would make it a bit clearer what (if anything has changed).
and resolve the issues above

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go (1)

277-278: ⚠️ Potential issue | 🟠 Major

Bypass topology score calculation when using CDI discovery.

As noted in a previous review, nvidia.CalculateGPUScore invokes NVML. On a CDI-only node (e.g., GB10), NVML is unavailable or explicitly bypassed, meaning this call will fail or panic if ENABLE_TOPOLOGY_SCORE is true.

Update the condition to ensure the score calculation is skipped when cdiDiscovery is active.

🛠️ Proposed fix
-	if os.Getenv("ENABLE_TOPOLOGY_SCORE") == "true" {
+	if os.Getenv("ENABLE_TOPOLOGY_SCORE") == "true" && !plugin.cdiDiscovery {
🤖 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/register.go` around lines
277 - 278, Update the topology-score condition surrounding
nvidia.CalculateGPUScore to also require that cdiDiscovery is inactive. Preserve
the existing ENABLE_TOPOLOGY_SCORE behavior for non-CDI discovery and leave the
score handling unchanged once calculation is permitted.
🤖 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.

Outside diff comments:
In `@pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go`:
- Around line 277-278: Update the topology-score condition surrounding
nvidia.CalculateGPUScore to also require that cdiDiscovery is inactive. Preserve
the existing ENABLE_TOPOLOGY_SCORE behavior for non-CDI discovery and leave the
score handling unchanged once calculation is permitted.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fa9151a3-9a3e-4552-a6e9-18efab73cbb6

📥 Commits

Reviewing files that changed from the base of the PR and between d99e1f2 and 63cabd3.

📒 Files selected for processing (16)
  • charts/hami/templates/device-plugin/daemonsetnvidia.yaml
  • charts/hami/templates/scheduler/device-configmap.yaml
  • charts/hami/values.yaml
  • cmd/device-plugin/nvidia/main.go
  • cmd/device-plugin/nvidia/plugin-manager.go
  • docs/nvidia-gb10-support.md
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/cdi.go
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external.go
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external_test.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/factory.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/register.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/server.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_devices.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_devices_test.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_manager.go
  • pkg/device/nvidia/device.go
🚧 Files skipped from review as they are similar to previous changes (14)
  • cmd/device-plugin/nvidia/plugin-manager.go
  • charts/hami/templates/scheduler/device-configmap.yaml
  • charts/hami/templates/device-plugin/daemonsetnvidia.yaml
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external.go
  • charts/hami/values.yaml
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/external_test.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_devices_test.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/factory.go
  • cmd/device-plugin/nvidia/main.go
  • pkg/device/nvidia/device.go
  • pkg/device-plugin/nvidiadevice/nvinternal/plugin/server.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_manager.go
  • pkg/device-plugin/nvidiadevice/nvinternal/cdi/cdi.go
  • pkg/device-plugin/nvidiadevice/nvinternal/rm/cdi_devices.go

@tittuvarghese
tittuvarghese force-pushed the feat/nvidia-gb10-device-plugin branch 2 times, most recently from a37b72f to 541edb4 Compare July 17, 2026 10:53
@hami-robot hami-robot Bot added the lgtm label Jul 17, 2026
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.32432% with 38 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ce-plugin/nvidiadevice/nvinternal/plugin/server.go 0.00% 14 Missing ⚠️
...e-plugin/nvidiadevice/nvinternal/rm/cdi_devices.go 72.54% 8 Missing and 6 partials ⚠️
...e-plugin/nvidiadevice/nvinternal/rm/cdi_manager.go 76.00% 3 Missing and 3 partials ⚠️
...e-plugin/nvidiadevice/nvinternal/plugin/factory.go 57.14% 2 Missing and 1 partial ⚠️
...-plugin/nvidiadevice/nvinternal/plugin/register.go 97.43% 1 Missing ⚠️
Flag Coverage Δ
unittests 61.62% <74.32%> (+1.16%) ⬆️

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

Files with missing lines Coverage Δ
...g/device-plugin/nvidiadevice/nvinternal/cdi/cdi.go 10.83% <100.00%> (+10.83%) ⬆️
...ice-plugin/nvidiadevice/nvinternal/cdi/external.go 100.00% <100.00%> (ø)
pkg/device/nvidia/device.go 96.89% <ø> (ø)
...-plugin/nvidiadevice/nvinternal/plugin/register.go 31.31% <97.43%> (+16.93%) ⬆️
...e-plugin/nvidiadevice/nvinternal/plugin/factory.go 33.33% <57.14%> (+33.33%) ⬆️
...e-plugin/nvidiadevice/nvinternal/rm/cdi_manager.go 76.00% <76.00%> (ø)
...ce-plugin/nvidiadevice/nvinternal/plugin/server.go 37.32% <0.00%> (-0.11%) ⬇️
...e-plugin/nvidiadevice/nvinternal/rm/cdi_devices.go 72.54% <72.54%> (ø)

... and 6 files with indirect coverage changes

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

Guard the MIG operating-mode block with !cdiDiscovery so
nvidia-mig-parted no longer runs on CDI-only accelerators (e.g. GB10),
matching the documented behavior that MIG handling is skipped for
CDI-only nodes.

Signed-off-by: tittu.varghese <tittu.varghese@npci.org.in>
@tittuvarghese
tittuvarghese force-pushed the feat/nvidia-gb10-device-plugin branch from 5391d4f to 0ab307a Compare July 18, 2026 14:12

@DSFans2014 DSFans2014 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.

@tittuvarghese Does this issue exist with k8s-device-plugin?

@tittuvarghese

Copy link
Copy Markdown
Author

@tittuvarghese Does this issue exist with k8s-device-plugin?

@DSFans2014 it exists in K8-device-plugin as well, but they patched by tolerating the missing memory details. But i feel our approach is more cleaner and valid for truly CDI only node.

Sources:

@FouoF

FouoF commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@tittuvarghese I have reviewed all the issues and repos above and none of them prove that The GB10 not enumerable via NVML which is the root problem of this pr. We must confirm that it dose exist before further discussion.
And GetMemoryInfo() NOT_SUPPORTED is another problem.

@mesutoezdil

mesutoezdil commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

agree with @FouoF,

pls share raw nvml or nvidia-smi output from a real gb10 node proving the device is not enumerable,
if nvml does see it and only memory info fails then the fix is tolerating that,
not a new discovery strategy..

@mesutoezdil

Copy link
Copy Markdown
Contributor

closing bcs of inactivity of pr owner. it can be re-opened if needed

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.

5 participants