Skip to content

fix: correct register cores for HamiVnpuCore mode#91

Merged
hami-robot[bot] merged 1 commit into
Project-HAMi:mainfrom
FouoF:fix-vnpu-core
Jun 30, 2026
Merged

fix: correct register cores for HamiVnpuCore mode#91
hami-robot[bot] merged 1 commit into
Project-HAMi:mainfrom
FouoF:fix-vnpu-core

Conversation

@FouoF

@FouoF FouoF commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Currently, the register annotation always register cores according to device preset. However, the vNPU core mod assume one device have 100 cores.

Although the scheduler has handled this inconsistency. It still effects the metrics thus it will be limit 8 and allocated 100.
This pr aims to correct this inconsistency.

Summary by CodeRabbit

  • New Features

    • Devices in the special core-allocation mode now report a full 100% allocatable core value.
    • Core allocation displayed to users remains consistent across supported device types in this mode.
  • Bug Fixes

    • Corrected device registration so core capacity is set appropriately instead of using the standard device core value in the special mode.
  • Tests

    • Added coverage for the updated core-allocation behavior.

Signed-off-by: Jifei Wang <jifei.wang@dynamia.ai>
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dffb28e5-3bb2-4899-99d5-cddc746c4da6

📥 Commits

Reviewing files that changed from the base of the PR and between ce9ab91 and ea64f5f.

📒 Files selected for processing (3)
  • internal/server/register.go
  • internal/server/register_test.go
  • internal/server/server.go

📝 Walkthrough

Walkthrough

Adds a new exported constant HamiVnpuCoreMaxPercent = 100 in server.go. In registerHAMi, Devcore now uses this constant instead of dev.AICore when IsHamiVnpuCore() returns true. A new test case validates this override.

HamiVnpu Devcore override

Layer / File(s) Summary
Constant definition and conditional Devcore assignment
internal/server/server.go, internal/server/register.go, internal/server/register_test.go
HamiVnpuCoreMaxPercent (100) is defined; registerHAMi conditionally assigns it to Devcore when IsHamiVnpuCore() is true; test case IsHamiVnpuCore_Devcore100 asserts the value and node annotation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny hops in, core set to one hundred percent,
Soft-slice mode now knows just what to invent,
IsHamiVnpuCore flips a switch so bright,
Devcore springs to max with delight!
🐇✨

🚥 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 matches the main change: correcting core registration for HamiVnpuCore mode.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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 Jun 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jun 30, 2026
@hami-robot hami-robot Bot merged commit 3c29535 into Project-HAMi:main Jun 30, 2026
11 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.

2 participants