fix: use Score as primary sort key in GPU scheduler policy#2012
fix: use Score as primary sort key in GPU scheduler policy#2012mesutoezdil wants to merge 4 commits into
Conversation
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughGPU device sorting now supports optional NUMA grouping. Pod annotations propagate NUMA-binding state into scheduling, while score-first and NUMA-aware ordering are covered by policy and NVIDIA fit tests. ChangesGPU NUMA sorting and scheduling
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Pod
participant Scheduler
participant DeviceUsageList
participant NVIDIA_Fit
Pod->>Scheduler: submit GPU request and NUMA annotation
Scheduler->>DeviceUsageList: set policy and NumaBind
DeviceUsageList->>NVIDIA_Fit: provide ordered devices
NVIDIA_Fit-->>Scheduler: return selected devices
Possibly related PRs
Suggested labels: 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 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mesutoezdil 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 |
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
78d9d87 to
e1858ae
Compare
e1858ae to
c7b6cf5
Compare
NUMA was the primary key in Less(), which broke binpack and spread when devices span NUMA nodes. Score is now primary, NUMA is the tiebreaker. Keep NUMA grouping when a pod requests numa-bind, so Fit can still accumulate a same-NUMA run and NUMA affinity is not broken. Fixes Project-HAMi#1806 Closes Project-HAMi#2010 Part of Project-HAMi#1889 Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
c7b6cf5 to
b83a621
Compare
Same conflict shape as feat/mutex-policy: upstream refactored inline node-usage construction into buildNodeUsage() while this branch added NumaBind support to the same code path. Kept the buildNodeUsage refactor and carried NumaBind: numaBindingRequested(task) into it. Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
@coderabbitai review |
|
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/scheduler/scheduler.go (1)
531-542: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify boolean parsing.
Since
strconv.ParseBoolalways returnsfalsewhen it encounters an error (e.g., an invalid or empty string), you can safely discard the error to simplify the return statement.♻️ Proposed refactor
func numaBindingRequested(task *corev1.Pod) bool { if task == nil { return false } v, ok := task.Annotations[nvidia.NumaBind] if !ok { return false } - enforce, err := strconv.ParseBool(v) - return err == nil && enforce + enforce, _ := strconv.ParseBool(v) + return enforce }🤖 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/scheduler/scheduler.go` around lines 531 - 542, In numaBindingRequested, simplify the strconv.ParseBool handling by discarding the parse error and returning only the parsed boolean value. Preserve the existing nil-pod and missing-annotation behavior.
🤖 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.
Nitpick comments:
In `@pkg/scheduler/scheduler.go`:
- Around line 531-542: In numaBindingRequested, simplify the strconv.ParseBool
handling by discarding the parse error and returning only the parsed boolean
value. Preserve the existing nil-pod and missing-annotation behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 30b690ff-1102-467a-93bf-6627d95cff50
📒 Files selected for processing (4)
pkg/scheduler/numa_sort_test.gopkg/scheduler/policy/gpu_policy.gopkg/scheduler/policy/gpu_policy_test.gopkg/scheduler/scheduler.go
strconv.ParseBool returns false on error, so the parse error can be discarded without changing behavior. No functional change. Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
|
/assign @archlitchi |
Fix the GPU scheduler sort in
Less(). NUMA was the primary key, which broke binpack and spread when devices span NUMA nodes. Score is now the primary key and NUMA is the tiebreaker.To keep NUMA affinity working, NUMA grouping is preserved when a pod requests numa-bind (
nvidia.com/numa-bind).Fit()accumulates a contiguous same-NUMA run, so score-primary interleaving would make numa-bind requests fail even when one NUMA node can host them. ANumaBindflag onDeviceUsageListselects the sort mode.Changes
pkg/scheduler/policy/gpu_policy.go:Less()sorts by Score first, NUMA is the tiebreaker;NumaBindkeeps NUMA grouping.pkg/scheduler/scheduler.go: setNumaBindfrom the pod numa-bind annotation.Fit()-level test for both the numa-bind and the score-primary paths.Fixes #1806
Closes #2010
Part of #1889
Summary by CodeRabbit