fix(scheduler): graceful handling of asymmetric GPU topology to prevent panics - #2217
fix(scheduler): graceful handling of asymmetric GPU topology to prevent panics#2217Norway-02 wants to merge 3 commits into
Conversation
Signed-off-by: Norway-02 <anshulkhetade02@gmail.com>
Signed-off-by: Norway-02 <anshulkhetade02@gmail.com>
…nt panics Signed-off-by: Norway-02 <anshulkhetade02@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Norway-02 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughThe changes preserve complete device data when creating replicas, switch selected ChangesDevice replication
NVLink scoring
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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/rm/device_map.go`:
- Around line 345-355: Deep-copy orig.Paths when constructing replicatedDevice
so each replica owns an independent path slice and mutations cannot affect the
original or sibling replicas. Update the replica construction near
devices.insert and add a regression test verifying path mutations remain
isolated across replicas.
In `@pkg/device/nvidia/calculate_score.go`:
- Around line 214-227: The scoring loop around the directional link slices in
the GPU score calculation must match links by identity rather than comparing
equal-index entries. Use a stable link identity or ordering derived from the
existing link representation, preserve only links present in both directions,
and score those matched pairs. Add a regression test covering the same shared
links returned in reversed orders.
🪄 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: b8437b9f-a885-4ccf-ba59-78c93c821228
📒 Files selected for processing (6)
pkg/device-plugin/nvidiadevice/nvinternal/plugin/server_test.gopkg/device-plugin/nvidiadevice/nvinternal/rm/device_map.gopkg/device-plugin/nvidiadevice/nvinternal/rm/device_map_test.gopkg/device-plugin/nvidiadevice/nvinternal/rm/devices.gopkg/device/nvidia/calculate_score.gopkg/device/nvidia/calculate_score_test.go
|
this runs in the device plugin at registration, not the scheduler, the links map is built symmetrically from deterministic pci topology, and 2 of the 3 commits are unrelated changes to forked nvinternal code we keep in sync with upstream. additionally, the pr does not contains no ai assistance disclosure as required by contributing.md. can be closed, as this adds review load without fixing a reachable issue. |
|
I apologize, you are completely right on all points. I misunderstood the architectural boundaries (device plugin vs scheduler) and the determinism of the topology build. I also accidentally included unrelated local commits, and missed the AI disclosure requirement. I'm closing this immediately to avoid wasting any more of your time. Thank you for the review. |
Graceful Handling of Asymmetric GPU Topology
Motivation
The scheduler currently assumes GPU P2P topology information is perfectly symmetric and terminates when this assumption is violated. Although asymmetric topology reports are unexpected (and originally treated as an internal invariant assertion), handling them gracefully improves scheduler robustness while preserving observability through warning logs. Because the scheduler processes topology data from across the cluster, terminating on inconsistent runtime data causes a denial-of-service for all GPU scheduling, making robust fallback preferable to a hard panic.
Changes
calculateGPUPairScorewith graceful handling of asymmetric P2P topology information.Linksmap lookups safely return nil slices without panicking, and that existingnilchecks on device pointers prevent other nil dereferences in this path.Testing
Added regression tests covering:
Verified with:
go test ./pkg/device/nvidia/...Summary by CodeRabbit