Skip to content

design(amd): update amd design docs - #2067

Merged
hami-robot[bot] merged 4 commits into
Project-HAMi:masterfrom
FouoF:update-amd
Jul 17, 2026
Merged

design(amd): update amd design docs#2067
hami-robot[bot] merged 4 commits into
Project-HAMi:masterfrom
FouoF:update-amd

Conversation

@FouoF

@FouoF FouoF commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind design

What this PR does / why we need it:

This pr update the design docs in following points:
major changes:

  1. using HSA_CU_MASK instead of ROC_GLOBAL_CU_MASK
    HSA_CU_MASK supports per GPU CU mask which is essential for multi-gpu tasks. As tasks request different num of vGPU will create a cross using for GPUs. For example, task1 request 25% one gpu, it get gpu 0 CU 0-76. Then task2 requests 25%
    but 2 GPUs, it can not use gpu 1 CU 0-76 though they are ideal for gpu 0 is allocated.
  2. gpucore represents CU percentage instead of CU count
    This design is intended to align with other device apis and it also guarantee the consistency in metrics. Besides, CU total count may not exposed to the user.
  3. using HIP_DEVICE_MEMORY_LIMIT for all device HBM limit
    HAMi api only allow same gpumem allocation for all request devices. So one env for all devices can satisfy it.
  4. device plugin calculates concrete CUs instead of scheduler
    Device related logic better place in device plugin.

minor changes:

  1. using cu range instead of cu mask to describe allocation for better human readable
  2. add hami.io/amd-devices-to-allocate for better compatibility of exists progress
  3. add know limit Not support mixed type in one node

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Summary by CodeRabbit

  • Documentation
    • Updated AMD Instinct vGPU guidance to use fractional GPU memory in MiB (amd.com/gpumem, reflected as HIP_DEVICE_MEMORY_LIMIT=<MiB>m) and compute-unit partitioning as an inclusive 1–100% (amd.com/gpucores).
    • Reworked CU selection to replace the prior CU-mask hex-bitmask flow with container startup using ROCR_VISIBLE_DEVICES ordering and HSA_CU_MASK expressed as GPU_list:CU_list for non-overlapping CU ranges.
    • Refreshed WGP behavior/limitations, including adjacent CU-pair alignment for WGP-capable devices and that zero-interference isn’t guaranteed.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: d0edff6d-49d3-4480-a588-6360c10e4ed7

📥 Commits

Reviewing files that changed from the base of the PR and between 6381adc and 0414de0.

📒 Files selected for processing (1)
  • docs/develop/amd-vgpu.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/develop/amd-vgpu.md

📝 Walkthrough

Walkthrough

The AMD vGPU documentation updates memory allocation to MiB, compute allocation to percentages, and CU partitioning to a scheduler/device-plugin workflow using per-container HSA_CU_MASK.

Changes

AMD vGPU protocol

Layer / File(s) Summary
Allocation annotations and CU masking
docs/develop/amd-vgpu.md
The scheduler/device-plugin protocol documents per-device memory and CU-count annotations, ROCR_VISIBLE_DEVICES ordering, container-start HSA_CU_MASK injection, WGP constraints, and node-lock exclusivity.
Fractional resource model
docs/develop/amd-vgpu.md
GPU memory uses MiB and HIP_DEVICE_MEMORY_LIMIT, while GPU cores use validated percentages converted to CU counts; limitations and device-plugin layering guidance are updated.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • Project-HAMi/HAMi#1985: Updates the AMD vGPU allocation annotations and CU-mask translation semantics in the same design document.

Suggested reviewers: ouyangluwei163, dsfans2014

Poem

I’m a rabbit with masks in my paws,
Dividing CUs by documented laws.
MiB hops in, percentages take flight,
Containers start with masks just right.
The scheduler plans; the plugin delivers!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related to the changes, but it is generic and does not convey the specific AMD vGPU design updates. Use a more specific title, such as updating AMD vGPU masking and resource allocation design docs.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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

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

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 updates the AMD vGPU design document (docs/develop/amd-vgpu.md) to reflect architectural changes. Specifically, it updates the memory allocation unit to MiB, changes the compute allocation (amd.com/gpucores) from a raw CU count to a percentage, and switches the environment variable from ROC_GLOBAL_CU_MASK to HSA_CU_MASK. It also refines the allocation protocol annotations and documents a new limitation regarding mixed GPU types on a single node. The review comments correctly identify grammatical errors, typos, and capitalization inconsistencies in the newly added sections, providing clear and actionable corrections.

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 docs/develop/amd-vgpu.md Outdated
Comment thread docs/develop/amd-vgpu.md Outdated

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
docs/develop/amd-vgpu.md (1)

91-94: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Name the consumer for HIP_DEVICE_MEMORY_LIMIT. docs/develop/amd-vgpu.md:91-94 should say that HAMi’s AMD LD_AUDIT layer consumes this variable and document the expected <MiB>m format/version contract.

🤖 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 `@docs/develop/amd-vgpu.md` around lines 91 - 94, Update the AMD vGPU
documentation around the `HIP_DEVICE_MEMORY_LIMIT` description to identify
HAMi’s AMD `LD_AUDIT` layer as the consumer, and explicitly document that the
value must use the `<MiB>m` format as the expected version contract. Preserve
the existing container-scoping and per-container allocation details.
🤖 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.

Inline comments:
In `@docs/develop/amd-vgpu.md`:
- Around line 98-104: Update the AMD vGPU documentation around amd.com/gpucores
to define the accepted percentage range and a single deterministic conversion
rule for fractional CU results, then state that the scheduler records that
rounded CU count in the standard AMD allocation annotation consumed by the
device-plugin. Ensure the documented behavior consistently prevents over- or
under-allocation.
- Around line 111-115: Update the mixed-device limitation bullet in amd-vgpu.md
to clearly state that a node cannot support multiple GPU types because the
device plugin derives the GPU type from the single amd.com/gpu.product-name
label. Correct the grammar while preserving the existing limitation and
rationale.
- Around line 23-24: Update the HSA_CU_MASK description in the AMD vGPU
documentation to replace “arbitrary” with “fine-grained, hardware-valid,”
preserving the existing explanation of per-pod CU partitioning and the
contrasting hardware-partitioning statement.
- Around line 64-73: Update the CU allocation contract in the device-plugin
documentation to define each allocated UUID’s container-local GPU index after
ROCR_VISIBLE_DEVICES reordering. Specify how the UUID-to-CU-range entries are
paired with those indices when generating HSA_CU_MASK, while preserving the
existing CU ID-list grammar and annotation format.
- Around line 64-73: Clarify the scope of hami.io/amd-cu-allocated in the
documentation: state explicitly whether it is written as a pod annotation or
returned in the container allocation response, and identify the component that
reads it to inject HSA_CU_MASK at container start. Align the surrounding wording
so the allocation source and consumer are unambiguous.

---

Nitpick comments:
In `@docs/develop/amd-vgpu.md`:
- Around line 91-94: Update the AMD vGPU documentation around the
`HIP_DEVICE_MEMORY_LIMIT` description to identify HAMi’s AMD `LD_AUDIT` layer as
the consumer, and explicitly document that the value must use the `<MiB>m`
format as the expected version contract. Preserve the existing container-scoping
and per-container allocation details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f2024e4d-3e0a-40a8-966b-0da74986f847

📥 Commits

Reviewing files that changed from the base of the PR and between a1b418c and a358f60.

📒 Files selected for processing (1)
  • docs/develop/amd-vgpu.md

Comment thread docs/develop/amd-vgpu.md Outdated
Comment thread docs/develop/amd-vgpu.md Outdated
Comment thread docs/develop/amd-vgpu.md Outdated
Comment thread docs/develop/amd-vgpu.md Outdated
Comment thread docs/develop/amd-vgpu.md Outdated
Comment thread docs/develop/amd-vgpu.md Outdated
@mesutoezdil

mesutoezdil commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

pls also address the coderabbit points on wgp cu pairing, the gpu index ambiguity in hsa_cu_mask, and the percentage rounding rule, those look like real gaps not just style

@hami-robot hami-robot Bot added size/L and removed size/M labels Jul 15, 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.

Actionable comments posted: 3

🤖 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.

Inline comments:
In `@docs/develop/amd-vgpu.md`:
- Around line 133-143: Update the cuCount conversion documentation to define how
round() handles exact .5 ties, specifying round-half-up (or another single
deterministic rule), and state that this rule is applied before clamping and
recording the result. Keep the existing percentage formula, examples, and [1,
devcore] bounds unchanged.
- Around line 145-147: Update the AMD vGPU documentation around the cuCount and
HSA_CU_MASK description to present CU range selection as intended behavior
rather than an enforced exclusivity guarantee. Also revise the related wording
near AMDDevices.LockNode and ReleaseNodeLock to avoid claiming node-level
exclusivity until shared-state locking is implemented.
- Around line 39-43: Clarify the WGP-capable device behavior in the design text
by explicitly defining how odd CU counts are handled before constructing
HSA_CU_MASK: state whether the scheduler rounds the count, rejects it, or stores
an adjusted pair-aligned value, and ensure the documented mask-building behavior
follows that decision.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8710261c-2a2f-4936-b4ab-2dd6660c4346

📥 Commits

Reviewing files that changed from the base of the PR and between a358f60 and 3023099.

📒 Files selected for processing (1)
  • docs/develop/amd-vgpu.md

Comment thread docs/develop/amd-vgpu.md
Comment thread docs/develop/amd-vgpu.md Outdated
Comment thread docs/develop/amd-vgpu.md
@coderabbitai coderabbitai Bot added the kind/documentation Improvements or additions to documentation label Jul 15, 2026
@github-actions github-actions Bot removed the kind/documentation Improvements or additions to documentation label Jul 15, 2026
Comment thread docs/develop/amd-vgpu.md
Comment thread docs/develop/amd-vgpu.md Outdated
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 59.71% <ø> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 11 files with indirect coverage changes

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

@mesutoezdil

Copy link
Copy Markdown
Contributor

/lgtm

FouoF added 4 commits July 17, 2026 10:44
Signed-off-by: Jifei Wang <jifei.wang@dynamia.ai>
Signed-off-by: Jifei Wang <jifei.wang@dynamia.ai>
Signed-off-by: Jifei Wang <jifei.wang@dynamia.ai>
Signed-off-by: Jifei Wang <jifei.wang@dynamia.ai>
@hami-robot hami-robot Bot removed the lgtm label Jul 17, 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 Jul 17, 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

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