fix: require Ascend core resource for soft slicing#2024
Conversation
|
Welcome @fyuan1316! It looks like this is your first PR to Project-HAMi/HAMi 🎉 |
📝 WalkthroughWalkthroughThis PR adds hami-core vNPU admission validation that rejects requests missing a positive configured core resource while requesting memory. It also updates tests to cover the new rejection paths and error matching. Changeshami-core vNPU validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a validation check for Ascend soft slicing in HAMi-core mode, ensuring that the core resource is requested alongside the memory resource. It also adds a helper method isCoreResourceRequested to verify these resource limits and requests, and includes corresponding unit tests to validate the rejection of memory-only requests. There are no review comments, so no additional feedback is provided.
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.
108921c to
58b10cd
Compare
Signed-off-by: Yuan Fang <yuanfang@alauda.io>
58b10cd to
b3cee93
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: fyuan1316 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 |
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
I don't think this is the right way to do so, because we will support compete mode for HAMi-core vNPU mode, like we do for NVIDIA, task without 'core' resource will compete on computing cores with each other |
@archlitchi: After checking the design and implementation of other device types, especially the NVIDIA path, I agree that this PR is too strict. It would reject valid hami-core workloads that intentionally omit What I still want to address is the memory-only hami-core case: when a user sets I think there are two possible ways to implement this:
In both cases:
Do you think either of these directions is acceptable, or would you suggest a better approach? |
yeah, i think we can use Option 1, passing the pod context is reasonable for this method |
|
/lgtm cancel |
|
|
||
| if isHAMiCore { | ||
| if dev.config.ResourceCoreName != "" && !dev.hasPositiveCoreResourceRequest(ctr) { | ||
| return false, fmt.Errorf("ascend soft slicing requires positive core resource %s to be requested together with %s", dev.config.ResourceCoreName, dev.config.ResourceMemoryName) |
Summary
This PR adds an admission-time validation for Ascend soft slicing.
When a pod explicitly selects HAMi soft slicing with:
and the Ascend device config defines a
resourceCoreName, the workload must request the corresponding core resource together with the memory resource. Otherwise the admission webhook now rejects the pod with a clear error.This prevents memory-only soft-slicing requests from silently entering the template-matching path where the actual allocated memory can be greater than the requested value.
Changes
hami-coreAscend workloads inMutateAdmission.resourceCoreNamewhen soft slicing is requested.resourceCoreNameare not affected.Related
Test
go test ./pkg/device/ascendgo test ./pkg/devicego test ./pkg/schedulergit diff --checkSummary by CodeRabbit