Skip to content

feat(ascend): support 910C vNPU templates vir05_1c_16g and vir10_3c_32g#2005

Merged
hami-robot[bot] merged 2 commits into
Project-HAMi:masterfrom
ouyangluwei163:feat/ascend-910c-vnpu-templates
Jul 8, 2026
Merged

feat(ascend): support 910C vNPU templates vir05_1c_16g and vir10_3c_32g#2005
hami-robot[bot] merged 2 commits into
Project-HAMi:masterfrom
ouyangluwei163:feat/ascend-910c-vnpu-templates

Conversation

@ouyangluwei163

@ouyangluwei163 ouyangluwei163 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Ascend HDK 26.0.RC1 enables NPU virtualization (vNPU) on the 910C. The 910C was previously registered without any vNPU templates, so it could only be allocated as a whole card and fractional (memory/core) requests could not be scheduled.

Add the vir05_1c_16g (16GB/5 aiCore/1 aiCPU) and vir10_3c_32g (32GB/10 aiCore/3 aiCPU) templates to the scheduler device config, and add examples/ascend/job-910C.yaml demonstrating a vNPU request.

What type of PR is this?
/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #2004

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Summary by CodeRabbit

  • New Features
    • Added new VNPU template profiles for Ascend910C/Ascend910 in scheduler configuration.
    • Introduced a new example Pod manifest demonstrating template-specific Ascend910C resource requests.
  • Behavior Changes
    • Enhanced Ascend910C request handling: allocation rounding and related validation now apply only when “SuperPod” mode is enabled.
  • Tests
    • Updated and expanded admission logic tests to cover SuperPod and vNPU split behavior.

Ascend HDK 26.0.RC1 enables NPU virtualization (vNPU) on the 910C. The
910C was previously registered without any vNPU templates, so it could
only be allocated as a whole card and fractional (memory/core) requests
could not be scheduled.

Add the vir05_1c_16g (16GB/5 aiCore/1 aiCPU) and vir10_3c_32g
(32GB/10 aiCore/3 aiCPU) templates to the scheduler device config, and
add examples/ascend/job-910C.yaml demonstrating a vNPU request.

Signed-off-by: ouyangluwei(riseunion) <ouyangluwei@riseunion.io>
@hami-robot hami-robot Bot requested review from FouoF and mesutoezdil July 3, 2026 07:54
@hami-robot hami-robot Bot added the size/S label Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds superPod-aware Ascend910C vNPU support, registers two 910C templates in the scheduler ConfigMap, updates admission handling and tests for split mode, and adds an example Pod manifest requesting the new resource shape.

Changes

Ascend 910C vNPU Template Support

Layer / File(s) Summary
vNPU config and template definitions
pkg/device/ascend/vnpu.go, charts/hami/templates/scheduler/device-configmap.yaml
Adds a superPod field to VNPU config and marks Ascend910 as superPod: true with vir05_1c_16g and vir10_3c_32g templates.
Ascend910C admission split-mode gating
pkg/device/ascend/device.go, pkg/device/ascend/device_test.go
Makes Ascend910C rounding and odd-request rejection depend on SuperPod, updates existing tests to set it, and adds split-mode cases for preserved limits and allowed odd counts.
Example 910C Pod manifest
examples/ascend/job-910C.yaml
Adds a Pod manifest that requests huawei.com/Ascend910C and huawei.com/Ascend910C-memory resources.

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

Poem

I nibble templates, neat and small,
Then hop through split mode, one and all.
A 910C pod goes sleep-snooze-sleep,
While vNPU slices stack up deep.
🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding support for the two Ascend 910C vNPU templates.
Linked Issues check ✅ Passed The changes add the requested 910C vNPU templates and supporting scheduling logic, matching issue #2004's expected behavior.
Out of Scope Changes check ✅ Passed The added example, config flag, and tests all support the 910C vNPU template work and do not appear unrelated.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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 adds vNPU templates for Ascend devices in the scheduler configuration and provides an example job configuration for Ascend910C. Feedback points out a critical bug where vNPU requests for Ascend910C are incorrectly rounded up to 2 NPUs during admission mutation, and suggests code modifications to bypass this rounding and adjust the scheduling logic for fractional vNPU requests.

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.

Comment thread examples/ascend/job-910C.yaml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
examples/ascend/job-910C.yaml (2)

12-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Comment "requesting 1 NPU" is misleading given auto-adjustment behavior.

Per pkg/device/ascend/device.go MutateAdmission, when commonWord == Ascend910CType and the request is 1, HAMi silently rounds it up to 2 (minimum allocation unit is one physical module = 2 NPUs). The example's comment says "requesting 1 NPU" without mentioning this auto-adjustment, which could confuse users about the actual resulting allocation.

📝 Suggested comment clarification
-          huawei.com/Ascend910C: 1 # requesting 1 NPU
+          huawei.com/Ascend910C: 1 # requesting 1 NPU (auto-adjusted to 2, the minimum allocation unit)
🤖 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 `@examples/ascend/job-910C.yaml` around lines 12 - 16, Update the example
comment in the Ascend 910C job manifest so it reflects the behavior in
MutateAdmission for Ascend910CType: a request of 1 is automatically rounded up
to 2 NPUs. Clarify the note near the huawei.com/Ascend910C resource to mention
the minimum physical module allocation and that the scheduler will adjust the
request, so users understand the actual allocated count.

1-16: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Static analysis flags root/privilege-escalation defaults on example manifest.

Checkov flags missing allowPrivilegeEscalation: false and non-root securityContext (CKV_K8S_20, CKV_K8S_23). Since this is a demo/example manifest, this is low priority, but adding a minimal securityContext would align with security best practices for example docs that users may copy verbatim.

🤖 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 `@examples/ascend/job-910C.yaml` around lines 1 - 16, The example Pod manifest
is missing the basic container hardening settings flagged by Checkov. Update the
ubuntu-container spec to include a minimal securityContext with
allowPrivilegeEscalation set to false and runAsNonRoot enabled (and, if needed,
a non-root runAsUser) so the example aligns with safer defaults while keeping
the existing Pod and resources fields intact.

Source: Linters/SAST tools

🤖 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 `@examples/ascend/job-910C.yaml`:
- Around line 12-16: Update the example comment in the Ascend 910C job manifest
so it reflects the behavior in MutateAdmission for Ascend910CType: a request of
1 is automatically rounded up to 2 NPUs. Clarify the note near the
huawei.com/Ascend910C resource to mention the minimum physical module allocation
and that the scheduler will adjust the request, so users understand the actual
allocated count.
- Around line 1-16: The example Pod manifest is missing the basic container
hardening settings flagged by Checkov. Update the ubuntu-container spec to
include a minimal securityContext with allowPrivilegeEscalation set to false and
runAsNonRoot enabled (and, if needed, a non-root runAsUser) so the example
aligns with safer defaults while keeping the existing Pod and resources fields
intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 014964da-43df-4e85-8dfe-f8e1bede193f

📥 Commits

Reviewing files that changed from the base of the PR and between 430b458 and 3b835f5.

📒 Files selected for processing (2)
  • charts/hami/templates/scheduler/device-configmap.yaml
  • examples/ascend/job-910C.yaml

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 59.50% <100.00%> (+0.41%) ⬆️

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

Files with missing lines Coverage Δ
pkg/device/ascend/device.go 83.21% <100.00%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread examples/ascend/job-910C.yaml
The 910C round-up-to-2 logic assumed every 910C is a SuperPod module
(minimum allocation unit of 2 NPUs). This forced fractional/odd vNPU
requests up to 2 NPUs, making vir05_1c_16g and vir10_3c_32g slices
unschedulable on non-SuperPod cards.

Add a superPod flag to VNPUConfig (default false) and only apply the
round-up when it is set, so vNPU memory slices and odd NPU counts are
preserved. Enable superPod on the 910C entry in the scheduler device
config and cover both paths with Test_MutateAdmission910C_VNPUSplit.

Signed-off-by: ouyangluwei(riseunion) <ouyangluwei@riseunion.io>
@hami-robot hami-robot Bot added size/M and removed size/S labels Jul 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
pkg/device/ascend/device.go (1)

134-149: 🎯 Functional Correctness | 🟠 Major

Gating logic looks correct in isolation, but see cross-file config concern.

The added dev.config.SuperPod condition correctly matches the intent described in the commit message (round-up/odd-reject only applies when SuperPod is enabled) and is consistent with all updated/new tests in device_test.go. However, this behavior directly depends on how superPod is set per-entry in charts/hami/templates/scheduler/device-configmap.yaml — see the companion comment on pkg/device/ascend/vnpu.go Line 40 regarding a potential contradiction between superPod: true and the newly added fractional templates on the same Ascend910C entry.

🤖 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/device/ascend/device.go` around lines 134 - 149, The Ascend910C gating in
the device allocator is fine, but it depends on the per-entry SuperPod setting
being consistent with the chart config. Update the device config generation path
so the Ascend910C entry does not combine dev.config.SuperPod=true with
fractional templates on the same entry; make the rendered config match the
intended SuperPod-only rounding/rejection behavior used by the logic in the
Ascend device handling. Verify the config source that populates
dev.config.SuperPod and the templates feeding it stay aligned for the Ascend910C
resource entry.
🤖 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.

Duplicate comments:
In `@pkg/device/ascend/device.go`:
- Around line 134-149: The Ascend910C gating in the device allocator is fine,
but it depends on the per-entry SuperPod setting being consistent with the chart
config. Update the device config generation path so the Ascend910C entry does
not combine dev.config.SuperPod=true with fractional templates on the same
entry; make the rendered config match the intended SuperPod-only
rounding/rejection behavior used by the logic in the Ascend device handling.
Verify the config source that populates dev.config.SuperPod and the templates
feeding it stay aligned for the Ascend910C resource entry.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 13c4f117-da55-4a82-8e10-c60efa86dd65

📥 Commits

Reviewing files that changed from the base of the PR and between 3b835f5 and 83a75d5.

📒 Files selected for processing (4)
  • charts/hami/templates/scheduler/device-configmap.yaml
  • pkg/device/ascend/device.go
  • pkg/device/ascend/device_test.go
  • pkg/device/ascend/vnpu.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • charts/hami/templates/scheduler/device-configmap.yaml

@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 Jul 8, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jul 8, 2026
@hami-robot hami-robot Bot merged commit 439a4a2 into Project-HAMi:master Jul 8, 2026
17 checks passed
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.

feat(ascend): support 910C vNPU templates vir05_1c_16g and vir10_3c_32g (Ascend HDK 26.0.RC1)

3 participants