Skip to content

fix(enpu): align VNPU mode configuration with HAMi - #143

Merged
hami-robot[bot] merged 1 commit into
Project-HAMi:mainfrom
maverick-woo:fix/enpu-vnpu-mode-config
Oct 9, 2026
Merged

hami-robot[bot] merged 1 commit into
Project-HAMi:mainfrom
maverick-woo:fix/enpu-vnpu-mode-config

Conversation

@maverick-woo

@maverick-woo maverick-woo commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

What type of PR is this?

/kind bug

What this PR does / why we need it:

HAMi now selects the Ascend backend with vnpus.hamiVnpuMode, while the plugin still reads separate ENPU and hami-core booleans. As a result, a shared ConfigMap containing hamiVnpuMode: enpu is not enough to enable ENPU in the plugin.

Align the plugin, Helm values and ENPU YAML examples with the scheduler's single mode setting: template, hami-core (alias hamiCore), or enpu. Node settings override the global mode; omitted node settings inherit it. Keep the legacy hami-core flag as a fallback, reject removed ENPU flags and invalid modes, and update the migration documentation.

Which issue(s) this PR fixes:

Companion configuration alignment for Project-HAMi/HAMi#3110. Follow-up to #141.

Special notes for your reviewer:

This change covers configuration selection and propagation. It does not change the bundled ENPU runtime.

Validation:

  • Internal Go unit tests, targeted mode/ENPU race tests, ARM64 build, and golangci-lint v2.1.0 (zero issues).
  • Helm mode matrix, strict chart lint, generated documentation/schema checks, and chart release-path checks.
  • Ascend910B3 hardware and Kubernetes regression: global/node mode selection and inheritance, invalid configuration rejection, Pod runtime/config injection, policy selection, and allocation/data transfer.
  • Official vLLM-Ascend image with CANN 9.1.0: Qwen3-0.6B completed generation with a 4 GiB ENPU quota; a 1 GiB quota reached the runtime's rejection path. These are configuration/integration checks, not a claim of strict instantaneous memory isolation. Separate allocation probes observed runtime accounting delay, and CANN 9.2 compatibility findings are outside this configuration change.

Does this PR introduce a user-facing change?:

Yes. Replace enpu.enabled, vnpus.enpu, and node enpu booleans with hamiVnpuMode: enpu at the corresponding level. An omitted node mode now inherits the global mode. Existing explicit legacy hami-core settings retain their fallback behavior.

AI Disclosure:

Codex assisted with implementation, review, tests, documentation, and this PR description.

Summary by CodeRabbit

  • New Features
    • Added a unified vNPU mode setting for template, hami-core, and ENPU, with per-node overrides and global-mode inheritance. Existing hami-core settings remain available as a compatibility fallback.
    • ENPU nodes can select their mode individually, and their whole-device metrics are collected through DCMI.
  • Bug Fixes
    • Invalid modes and removed ENPU boolean settings are rejected with errors; failures to load node-specific configuration now stop startup.
  • Documentation
    • Updated deployment guides and examples with mode selection, precedence, inheritance, and upgrade guidance.

Use hamiVnpuMode for the shared config, node overrides and Helm examples.
Preserve legacy hami-core fallback, inherit omitted node modes and reject
invalid or removed mode settings. Add mode resolution and chart coverage.

Related to Project-HAMi/HAMi#3110.
Follow-up to Project-HAMi#141.

Signed-off-by: maverick123123 <yuming.wu@dynamia.ai>
@hami-robot

hami-robot Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@maverick-woo: The label(s) kind/bug cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?

/kind bug

What this PR does / why we need it:

HAMi now selects the Ascend backend with vnpus.hamiVnpuMode, while the plugin still reads separate ENPU and hami-core booleans. As a result, a shared ConfigMap containing hamiVnpuMode: enpu is not enough to enable ENPU in the plugin.

Align the plugin, Helm values and ENPU YAML examples with the scheduler's single mode setting: template, hami-core (alias hamiCore), or enpu. Node settings override the global mode; omitted node settings inherit it. Keep the legacy hami-core flag as a fallback, reject removed ENPU flags and invalid modes, and update the migration documentation.

Which issue(s) this PR fixes:

Companion configuration alignment for Project-HAMi/HAMi#3110. Follow-up to #141.

Special notes for your reviewer:

This change covers configuration selection and propagation. It does not change the bundled ENPU runtime.

Validation:

  • Internal Go unit tests, targeted mode/ENPU race tests, ARM64 build, and golangci-lint v2.1.0 (zero issues).
  • Helm mode matrix, strict chart lint, generated documentation/schema checks, and chart release-path checks.
  • Ascend910B3 hardware and Kubernetes regression: global/node mode selection and inheritance, invalid configuration rejection, Pod runtime/config injection, policy selection, and allocation/data transfer.
  • Official vLLM-Ascend image with CANN 9.1.0: Qwen3-0.6B completed generation with a 4 GiB ENPU quota; a 1 GiB quota reached the runtime's rejection path. These are configuration/integration checks, not a claim of strict instantaneous memory isolation. Separate allocation probes observed runtime accounting delay, and CANN 9.2 compatibility findings are outside this configuration change.

Does this PR introduce a user-facing change?:

Yes. Replace enpu.enabled, vnpus.enpu, and node enpu booleans with hamiVnpuMode: enpu at the corresponding level. An omitted node mode now inherits the global mode. Existing explicit legacy hami-core settings retain their fallback behavior.

AI Disclosure:

Codex assisted with implementation, review, tests, documentation, and this PR description.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hami-robot
hami-robot Bot requested review from DSFans2014 and archlitchi October 8, 2026 11:25
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2453e126-7ea1-4bc4-82e2-fe4a2f55006e
📥 Commits

Reviewing files that changed from the base of the PR and between 6f6ee02 and 60866b3.

📒 Files selected for processing (22)
  • Makefile
  • ascend-device-configmap.yaml
  • ascend-device-node-configmap.yaml
  • charts/ascend-device-plugin/README.md
  • charts/ascend-device-plugin/README.md.gotmpl
  • charts/ascend-device-plugin/templates/_helpers.tpl
  • charts/ascend-device-plugin/templates/configmap.yaml
  • charts/ascend-device-plugin/values.schema.json
  • charts/ascend-device-plugin/values.yaml
  • cmd/main.go
  • docs/hami.md
  • docs/hami_cn.md
  • docs/volcano.md
  • docs/volcano_cn.md
  • examples/enpu/README.md
  • examples/enpu/README_cn.md
  • examples/enpu/device-plugin-values.yaml
  • internal/manager/manager.go
  • internal/manager/manager_test.go
  • internal/vnpu.go
  • internal/vnpu_test.go
  • scripts/test-vnpu-mode-chart.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The plugin and Helm chart now select the vNPU backend through hamiVnpuMode, with global and node-level resolution, legacy fallbacks, and validation. The manager uses the resolved mode for its hami-core and ENPU checks. Configuration examples and deployment documentation reflect the new setting.

Changes

vNPU mode selection

Layer / File(s) Summary
Define and resolve vNPU modes
internal/vnpu.go, internal/vnpu_test.go, ascend-device-configmap.yaml, ascend-device-node-configmap.yaml, examples/enpu/device-plugin-values.yaml, cmd/main.go
Global and node configuration now resolve template, hami-core, or enpu, with normalization, legacy fallbacks, and validation. Sample configurations use hamiVnpuMode. A node-config load error now stops startup.
Apply mode selection in the Helm chart
charts/ascend-device-plugin/values.yaml, charts/ascend-device-plugin/values.schema.json, charts/ascend-device-plugin/templates/_helpers.tpl, charts/ascend-device-plugin/templates/configmap.yaml, scripts/test-vnpu-mode-chart.sh, Makefile
The chart accepts and validates hamiVnpuMode, resolves it during rendering, and rejects removed boolean settings and invalid modes. The chart mode checks run as part of verify-helm-chart.
Use resolved modes in manager predicates
internal/manager/manager.go, internal/manager/manager_test.go
The manager resolves global and node modes for its hami-core and ENPU predicates. Tests cover mode overrides and the ENPU device-count limit.
Document mode configuration and deployment
charts/ascend-device-plugin/README.md, charts/ascend-device-plugin/README.md.gotmpl, docs/hami.md, docs/hami_cn.md, docs/volcano.md, docs/volcano_cn.md, examples/enpu/README.md, examples/enpu/README_cn.md
The documentation and deployment examples describe mode selection, defaults, inheritance, legacy fallbacks, and ENPU configuration.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Suggested labels: enhancement

Merge Risk: ⚪ Minimal · up to 60866

The mode-selection migration appears mergeable after normal checks; no concrete blocking issue was established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 6 files. (16 skipped:… 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: aligning ENPU and VNPU mode configuration with HAMi across plugin configuration, Helm values, and examples.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 6 files. (16 skipped: 16 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the modes at dawn
Template, core, and ENPU drawn
Node settings choose their proper way
Old flags yield when modes hold sway
The chart tests greet the passing day

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the enhancement New feature or request label Oct 8, 2026

@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 Oct 9, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: archlitchi, maverick-woo

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 Oct 9, 2026
@hami-robot
hami-robot Bot merged commit 1cf890f into Project-HAMi:main Oct 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved enhancement New feature or request lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants