Skip to content

[Performance][A5] Limit the host-offloaded Engram grid on prefill - #21827

Closed
linfeng-yuan wants to merge 3 commits into
vllm-project:mainfrom
linfeng-yuan:perf/dsv41-engram-prefill-aiv
Closed

linfeng-yuan wants to merge 3 commits into
vllm-project:mainfrom
linfeng-yuan:perf/dsv41-engram-prefill-aiv

Conversation

@linfeng-yuan

@linfeng-yuan linfeng-yuan commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it

Let A5 prefill workers reserve AIV capacity for the main stream while the host-offloaded Engram gather runs on the auxiliary stream. With engram_prefill_uva_aiv_limit=true, the lookup launches at most three quarters of the vector cores (48 on the tested 950DT) and each program gathers its strided rows. The flag defaults to false. Keep it off on decode workers.

How was this patch tested?

  • Historical paired 950DT prefill run with Engram overlap and the same three-quarter cap: steady input throughput +2.02%, 512/512 first-token outputs matched. The same cap on decode reduced throughput by 1.56%.
  • Ruff lint and format checks passed for touched Python files. Device validation of this draft on current main is pending.

Related: linfeng-yuan#19 used a fixed eight-program launch.

Maintainer validation (2026-11-14)

Ascend 950DT: 48 actual device cases passed, covering registered UVA memory, BF16/INT8/MXFP8, int32/int64 IDs, T=0/1/7/129, strided inputs, opt-in on/off, and graph replay. CPU-only execution was not substituted for these device checks. This remains an opt-in Prefill path; no general serving-throughput claim is inferred from the operator tests.

bash format.sh ci passed on the reviewed source; no formatter changes remain. Combined vLLM 0.33.0 P/D integration and same-condition throughput acceptance remain pending.

Integrated validation on Ascend 950DT

Validated the combined stack with vLLM 0.33.0 editable installs and the native CANNBotDSL 0.8.2 operator package. The figures below compare complete stacks.

  • Prefill: 131,072 input tokens, one output token, concurrency 64, 89.94% prefix reuse. Two runs completed 256 requests each. All 512 first tokens matched the archived paired requests, and steady input throughput was within 0.04% of the reference.
  • Decode: 128K input, 4,096 output tokens, concurrency 512, full cacheable-prefix reuse on all eight prefill ranks. Each configuration completed 2,048 requests. Sustained decode throughput was 28,002 vs. 28,531 effective output tokens/s. The first 512 requests averaged 7.31 vs. 8.48 seconds TTFT. Mean speculative acceptance was 3.5250 vs. 3.5305 tokens per step, including the target model token.

This verifies functional requests and throughput in the paired configuration. It does not establish long-output exact agreement or benchmark accuracy.

The integrated configuration applied the Engram grid cap to prefill only.

Signed-off-by: linfeng-yuan <1102311262@qq.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a performance optimization for A5 prefill workers by limiting the resource consumption of host-offloaded Engram lookups. By capping the grid size to three-quarters of the available vector cores, the system ensures that sufficient resources remain available for the main stream during multi-stream Engram overlap, resulting in improved input throughput.

Highlights

  • Performance Optimization: Introduced a configuration flag engram_prefill_uva_aiv_limit to cap the host-offloaded Engram lookup grid at 75% of available vector cores during prefill.
  • Resource Management: Enabled the Engram gather operation to reserve vector core capacity for the main stream, improving throughput by approximately 2% in prefill scenarios.
  • Kernel Update: Refactored the _engram_host_uva_gather_dequant_kernel to support grid-based execution, allowing for flexible program distribution across vector cores.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@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 a new configuration option, engram_prefill_uva_aiv_limit, which caps the host-offloaded Engram lookup grid to three-quarters of the available vector cores during prefill. To support this, the Triton kernel _engram_host_uva_gather_dequant_kernel was updated to use a grid-stride loop. The review feedback requests updating the pull request's title and summary to comply with the repository's style guide, providing a suggested title and summary.

get_current_hardware_profile().device_adaptor_family == DeviceAdaptorFamily.FP8_OPTIMIZED
)
)
engram_prefill_uva_aiv_limit: bool = False

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.

high

The Pull Request Title and Summary do not adhere to the repository's style guide. Please update them to match the required formats.

Suggested PR Title:

[Ops][Feature] Limit the host-offloaded Engram grid on prefill

Suggested PR Summary:

### What this PR does / why we need it?

Let A5 prefill workers reserve AIV capacity for the main stream while the host-offloaded Engram gather runs on the auxiliary stream. With `engram_prefill_uva_aiv_limit=true`, the lookup launches at most three quarters of the vector cores (48 on the tested 950DT) and each program gathers its strided rows. The flag defaults to false. Keep it off on decode workers.

### Does this PR introduce _any_ user-facing change?

Yes, introduces a new additional configuration option `engram_prefill_uva_aiv_limit` (boolean, defaults to `False`) to cap the host-offloaded Engram lookup grid.

### How was this patch tested?

- Historical paired 950DT prefill run with Engram overlap and the same three-quarter cap: steady input throughput +2.02%, 512/512 first-token outputs matched. The same cap on decode reduced throughput by 1.56%.
- Ruff lint and format checks passed for touched Python files. Device validation of this draft on current main is pending.
References
  1. The Pull Request Title and Summary must follow the specific formats defined in the Pull Request Summary Style Guide. (link)

@github-actions github-actions Bot added documentation Improvements or additions to documentation module:ops module:core labels Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

Signed-off-by: linfeng-yuan <1102311262@qq.com>
Signed-off-by: linfeng-yuan <1102311262@qq.com>
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions Bot removed the ready-precise run selected e2e test for pr label Nov 26, 2026
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.

1 participant