Skip to content

feat: support node filtering based on hami-vnpu-core annotation - #1812

Merged
hami-robot[bot] merged 17 commits into
Project-HAMi:masterfrom
ashergaga:master
Apr 29, 2026
Merged

feat: support node filtering based on hami-vnpu-core annotation#1812
hami-robot[bot] merged 17 commits into
Project-HAMi:masterfrom
ashergaga:master

Conversation

@ashergaga

Copy link
Copy Markdown
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it:
This PR enhances the hami-scheduler filtering strategy by enabling it to perceive the state of hami-vnpu-core on a node-by-node basis.

Core Logic:
During the Predicate (Filter) phase, the scheduler now retrieves and inspects the hami-vnpu-core annotation on the Node. If a Pod's annotation declares huawei.com/vnpu-mod: hami-core, the scheduler will strictly match nodes that have enabled the hami-vnpu-core annotation.

…tioning

Signed-off-by: ashergaga <1214443299@qq.com>
Signed-off-by: ashergaga <1214443299@qq.com>
Signed-off-by: ashergaga <1214443299@qq.com>
Signed-off-by: ashergaga <1214443299@qq.com>
Signed-off-by: ashergaga <1214443299@qq.com>
Signed-off-by: ashergaga <1214443299@qq.com>
Signed-off-by: ashergaga <1214443299@qq.com>
Signed-off-by: ashergaga <1214443299@qq.com>
@hami-robot hami-robot Bot added the kind/feature new function label Apr 28, 2026
@hami-robot
hami-robot Bot requested a review from chaunceyjiang April 28, 2026 07:29
@hami-robot
hami-robot Bot requested a review from wawa0210 April 28, 2026 07:29
@hami-robot hami-robot Bot added the size/M label Apr 28, 2026

@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 hami-core mode in the device allocation logic, including a new node selector annotation and validation checks to ensure compatibility between pod annotations and node capabilities. The review feedback highlights a typo in a comment, suggests simplifying the node annotation check, proposes using a logical XOR to reduce code duplication in the validation logic, and points out inconsistent indentation and alignment in the constant definitions.

Comment thread pkg/device/ascend/device.go Outdated
Comment thread pkg/device/ascend/device.go Outdated
Comment thread pkg/device/ascend/device.go Outdated
Comment thread pkg/device/common/common.go Outdated
Signed-off-by: ashergaga <1214443299@qq.com>
Signed-off-by: ashergaga <1214443299@qq.com>
Signed-off-by: ashergaga <1214443299@qq.com>
@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/device/ascend/device.go 95.00% 0 Missing and 1 partial ⚠️
Flag Coverage Δ
unittests 58.06% <95.00%> (+0.07%) ⬆️

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

Files with missing lines Coverage Δ
pkg/device/common/common.go 53.33% <ø> (ø)
pkg/device/ascend/device.go 81.96% <95.00%> (+0.70%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: ashergaga <1214443299@qq.com>
@hami-robot hami-robot Bot added size/L and removed size/M labels Apr 28, 2026
Signed-off-by: ashergaga <1214443299@qq.com>
Comment thread pkg/device/ascend/device.go

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

/lgtm

@hami-robot

hami-robot Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: archlitchi, ashergaga

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@hami-robot hami-robot Bot added the approved label Apr 29, 2026
@hami-robot
hami-robot Bot merged commit 15db17a into Project-HAMi:master Apr 29, 2026
13 checks passed
mesutoezdil pushed a commit to mesutoezdil/HAMi that referenced this pull request Jun 14, 2026
…ect-HAMi#1812)

* feat(ascend): add ResourceCoreName to support hami-core compute partitioning

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: add docs ascend910-hami-vnpu-support

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: fix ai suggestion

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: fix golangci lint

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: fix format

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: add unit test & proposal

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: hami-vnpu-core ReadMe modify

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: add failureReason ModeNotFit

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: fix ai suggestion

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: fix cilint

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: fix unit test error

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: add unit test

Signed-off-by: ashergaga <1214443299@qq.com>

* feat: fix cilint

Signed-off-by: ashergaga <1214443299@qq.com>

---------

Signed-off-by: ashergaga <1214443299@qq.com>
Wangmin362 pushed a commit to Wangmin362/HAMi that referenced this pull request Jul 8, 2026
…ssing the node mode gate

The node soft/hard exclusivity added in Project-HAMi#1812 rejects a mismatched pod with
ModeNotFit, but the check is nested inside
`request.Memreq > 0 && request.Memreq < totalMemPerCard && request.Nums > 0`.
A whole-card memory request (Memreq == card capacity) or a memory-less request
(Memreq == 0) never enters that block, so a hami-core (soft-split) pod can be
scheduled onto a hard-split node, bypassing the exclusivity.

Lift the soft-pod arm out of the memory-range condition: a pod that declares
hami-core mode must land on a hami-core node regardless of how much memory it
requests. The reverse arm (a legacy pod on a hami-core reserved node) stays
inside the memory-range condition on purpose, so plain whole-card jobs are not
rejected when a node -- or the global hamiVnpuCore default -- marks the node as
hami-core.

Verified on real hardware (8x Ascend 910B4): a hami-core pod requesting the
whole card (32768 MiB) or no memory field is now held Pending with ModeNotFit
on a hard node, matching the sub-capacity behaviour, while matching-mode and
whole-card legacy requests keep scheduling.

Signed-off-by: wangmin <wangmin@riseunion.io>
hami-robot Bot pushed a commit that referenced this pull request Jul 9, 2026
…ssing the node mode gate (#2029)

* fix(ascend): stop whole-card/memory-less hami-core requests from bypassing the node mode gate

The node soft/hard exclusivity added in #1812 rejects a mismatched pod with
ModeNotFit, but the check is nested inside
`request.Memreq > 0 && request.Memreq < totalMemPerCard && request.Nums > 0`.
A whole-card memory request (Memreq == card capacity) or a memory-less request
(Memreq == 0) never enters that block, so a hami-core (soft-split) pod can be
scheduled onto a hard-split node, bypassing the exclusivity.

Lift the soft-pod arm out of the memory-range condition: a pod that declares
hami-core mode must land on a hami-core node regardless of how much memory it
requests. The reverse arm (a legacy pod on a hami-core reserved node) stays
inside the memory-range condition on purpose, so plain whole-card jobs are not
rejected when a node -- or the global hamiVnpuCore default -- marks the node as
hami-core.

Verified on real hardware (8x Ascend 910B4): a hami-core pod requesting the
whole card (32768 MiB) or no memory field is now held Pending with ModeNotFit
on a hard node, matching the sub-capacity behaviour, while matching-mode and
whole-card legacy requests keep scheduling.

Signed-off-by: wangmin <wangmin@riseunion.io>

* address review: make the legacy-vNPU filter log nil-safe

Use klog.KObj(pod) instead of dereferencing nodeInfo.Node.Name and
pod.Name directly, matching the hami-core arm above and avoiding a
potential nil dereference (both are guarded as possibly nil earlier in
Fit).

Signed-off-by: wangmin <wangmin@riseunion.io>

* address review: drop verbose comments and internal markers

Signed-off-by: wangmin <wangmin@riseunion.io>

---------

Signed-off-by: wangmin <wangmin@riseunion.io>
Co-authored-by: wangmin <wangmin@riseunion.io>
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.

3 participants