Skip to content

[BugFix][MRV2] Use PCP-local graph capture buffers on v0.28.0 - #16179

Closed
zhao-stack wants to merge 7 commits into
vllm-project:mainfrom
zhao-stack:codex/fix-sfa-pcp-accuracy-v028-20260909
Closed

zhao-stack wants to merge 7 commits into
vllm-project:mainfrom
zhao-stack:codex/fix-sfa-pcp-accuracy-v028-20260909

Conversation

@zhao-stack

@zhao-stack zhao-stack commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

v0.28.0 sends global input buffers into MRV2 graph capture, whereas PCP runtime prepares persistent local input buffers. Main already selects PCP-local buffers upstream (#53515). This six-line candidate explicitly selects the PCP-local buffers on v0.28.0 before capture. It includes a regression for capture/runtime tensor identity and padding updates across PCP/non-PCP and release/main contracts.

This is a partial fix under investigation, not a resolved SFA PCP accuracy fix. It changes the observed release third-prompt output from Rund compasses to Rund596庄稼 and makes all reported token/top-5-logit records match main in controlled diagnostic observations. It does not satisfy the unchanged release golden Rund959arki or make the complete original target pass. Keep this PR draft.

Does this PR introduce any user-facing change?

Only the release PCP capture buffer source changes. Main retains its upstream-selected buffers. Investigation resumed: temporary tensor/metadata tracing is reintroduced on head 17e5b5467322b99a6263b7ce093960662e7933fc. These synchronizing test-only observers will be removed before any final fix is proposed. No golden, allowed-output, assertion, skip, upgrade-pointer or unrelated CPU collection-error changes. No changes to #16009, #15627, or baseline #16175; no labels or merge requested.

How was this patch tested?

  • Isolated actual capture method with real CPU tensors and a recording backend: unpatched1failed/3passed, patched4passed. This isolates module initialization and NPU capture; it is not a full UT or numerical hardware test.

  • No-production-patch diagnostics34356957326: main graph passes; release graph fails at prompt3 (compasses). Release eager cannot generate because of a separate missing input_buffers attribute, so that is not an accuracy result.

  • Original target with candidate34360230703: main1passed209.77s; release1failed208.26s at prompt2 (ERIChiretailhallenging), aborting the comparison before prompt3.

  • Candidate logits34362432893: main1passed, release1failed. All three token sequences and reported top-5 logits match between lanes. Relative to unpatched release, the first changed reported logit step is prompt3 generationstep4: token29490 (596)14.1875 exceeds token20410 ( compass)13.5625 and golden token32716 (959)12.9375.

  • PCP/batch controls34364655334: with graph/scored observation fixed, both PCP1 and PCP2/single-third-prompt produce Rund959arki; original PCP2/three-prompt batch produces Rund596庄稼. The first reported logit difference appears at generationstep2, before the sampled-token difference atstep4. This happens in both versions. PCP1 also changes the resulting process/EP group topology and fails prompt2, so it is not a passing original-target baseline.

  • These diagnostic/candidate runs used heads e53e/f780/8a09 rebased onto fixed Ascend 9e1cab90c0a8ec49369eb9aa1e8f387dbe5e4f1d. Empty baseline [CI] Diagnose SFA PCP accuracy on unchanged upstream main baseline #16175 uses033198/f5f691 and reports main3/3passed, release0/3passed at prompt2. It is not the same Ascend tree. Actual vLLM anchors are main b2f685834a6456197e7033966fdef52a23f1abcd and release 2cf0a6915ce544dc493a0990f2ea38d81601128a; main is not [Misc][Main2Main] Main2main 0909 #16009's a97dacb. Distinct runners and missing immutable model/tokenizer/image fingerprints preclude a strict environment-equivalence claim.

  • Ruff/check/format, isolated assertion checks and git diff checks passed. Full bash format.sh ci was run; Windows /bin/bash, shellcheck/python3 availability and an earlier memory-allocation failure prevent full local verification. No hook configuration was weakened.

  • Final head fa440ba895f26ee6b658230fe018a42ed44030b9 after removing diagnostics: main original target1passed207.34s; release original target1failed208.00s, prompt3 actual Rund596庄稼 versus expected Rund959arki. Actual checkoutfa440ba89 and rebasebase9e1cab90 verified in both logs. The full precision issue remains unresolved. Full-file validation has not been triggered because both original target lanes have not passed.

Remaining blocker: no intermediate-tensor/operator trace identifies the remaining PCP2 multiple-request numerical discrepancy, and no matched-environment positive reference for the full release golden is established. Existing token/logit evidence does not justify further arithmetic changes or a root-cause-closure claim.

  • Continued investigation: test_dsv3_2_sfa_pcp_tensor_diagnostic compares original batch versus third-prompt-only with unchanged sampling/goldens. It records decode layer output hashes/norms and captured/runtime metadata values/pointers. CPU observer checks and Ruff passed; hardware neutrality and results are pending.

  • Tensor diagnostic34431178636: original token behavior preserved in both lanes (batchthird596 / singlethird959), but layer snapshots remained warmup values and are NOT valid evidence of runtime equality. Actual request admission was staggered: third prefill mixed with earlier requests decoding; third firstdecode is workerstep4 in batch versusstep2 alone. Head c583a3d126646b78d1a15f6fadc5f9c7d8990404 corrects the temporary observer to record all compiled shapes, adds device update counts, extends collection to12 executions, omits mixed/prefill snapshot readouts and disables diagnostic compilecache reuse. No new production modification. Root cause remains open.

  • Corrected observer34433161210: single-third output preserved and snapshot counters/hashes update, but both batch cases died before generation due to a diagnostic copy shape mismatch (4x7168 versus3x7168) in compiled execution. This is not numerical root-cause evidence. Head a1a084e05cfb3cb46adaaee5b476fb327e84968d replaces dynamic copy extents with a fixed-four-row index selection; production patch unchanged.

  • vLLM main: vllm-project/vllm@b2f6858

Current blocker (2026-09-10): unchanged head a1a084e05cfb3cb46adaaee5b476fb327e84968d could not initialize the model in either run34434623808 or its single unchanged-head retry34435808925. Both lanes fail in ModelScope ModelFileSystemCache.save_model_meta with OSError: [Errno 122] Disk quota exceeded, before worker/model generation. Thus the latest observer shape correction has no NPU validation and there is still no valid paired layer trace. Automatic retries paused pending runner model-cache quota recovery. No original-target dual-lane pass, no full-file validation, and no numerical root-cause closure claimed. This PR remains a draft investigation with a partial capture-buffer correction and temporary diagnostics.

Signed-off-by: shenzhao <shenzhao9@huawei.com>
@zhao-stack

zhao-stack commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

/e2e tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py::test_dsv3_2_sfa_pcp_graph_diagnostic
[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

@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 introduces temporary diagnostic instrumentation to investigate accuracy failures observed in the v0.28.0 MRV2 SFA PCP configuration. By injecting custom logging into the model runner, the changes allow for the collection of granular token-level data and logit margins under different graph execution modes. This work is strictly for diagnostic purposes to isolate potential buffer ownership discrepancies and does not include any production-level fixes.

Highlights

  • Diagnostic Instrumentation: Added a new test case, test_dsv3_2_sfa_pcp_graph_diagnostic, to capture detailed execution data including raw logits and token IDs for investigating accuracy discrepancies.
  • Graph Mode Analysis: Implemented parameterization for graph_mode (FULL_DECODE_ONLY vs NONE) and collect_logits to isolate the impact of graph capture on model output.
  • Diagnostic Output: Integrated JSON-formatted logging within the test suite to emit structured diagnostic records during model execution.
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. ↩

@github-actions

github-actions Bot commented Sep 9, 2026

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.

@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

Suggested PR Title:

[Test][Feature] Add graph diagnostic test for DSV3.2 SFA PCP

Suggested PR Summary:

### What this PR does / why we need it?
This PR adds a new end-to-end diagnostic test `test_dsv3_2_sfa_pcp_graph_diagnostic` to compare graph execution modes and collect raw logits. Feedback was provided to update the patched `logged_generate` function signature to accept and forward `*args` and `**kwargs` to ensure compatibility with the original `VllmRunner.generate_greedy` method.

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

### How was this patch tested?
This is a test addition, which can be run via pytest.

Comment on lines +257 to +265
def logged_generate(runner, prompts, max_tokens):
if not collect_logits:
outputs = original_generate(runner, prompts, max_tokens)
records = [
{"prompt": prompt, "full_token_ids": ids, "full_text": text}
for prompt, (ids, text) in zip(prompts, outputs, strict=True)
]
else:
scored_outputs = runner.generate_greedy_logprobs(prompts, max_tokens, 5)

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 patched logged_generate function does not accept *args or **kwargs, which makes it incompatible with the signature of VllmRunner.generate_greedy. If generate_greedy is called with any additional arguments (such as images, videos, audios, or other keyword arguments), a TypeError will be raised. To ensure robustness and compatibility, the signature should be updated to accept and forward *args and **kwargs to both original_generate and generate_greedy_logprobs.

Suggested change
def logged_generate(runner, prompts, max_tokens):
if not collect_logits:
outputs = original_generate(runner, prompts, max_tokens)
records = [
{"prompt": prompt, "full_token_ids": ids, "full_text": text}
for prompt, (ids, text) in zip(prompts, outputs, strict=True)
]
else:
scored_outputs = runner.generate_greedy_logprobs(prompts, max_tokens, 5)
def logged_generate(runner, prompts, max_tokens, *args, **kwargs):
if not collect_logits:
outputs = original_generate(runner, prompts, max_tokens, *args, **kwargs)
records = [
{"prompt": prompt, "full_token_ids": ids, "full_text": text}
for prompt, (ids, text) in zip(prompts, outputs, strict=True)
]
else:
scored_outputs = runner.generate_greedy_logprobs(prompts, max_tokens, 5, *args, **kwargs)

Align release graph capture with the persistent inputs updated by PCP runtime. Keep main on its upstream-selected buffer contract. Add a buffer-identity regression; numerical SFA accuracy validation remains pending in the draft PR.

Signed-off-by: shenzhao <shenzhao9@huawei.com>
@zhao-stack zhao-stack changed the title [Test][MRV2] Diagnose v0.28.0 SFA PCP graph accuracy [BugFix][MRV2] Validate v0.28.0 SFA PCP capture buffers Sep 9, 2026
@zhao-stack

zhao-stack commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

/e2e tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py::test_dsv3_2_sfa_pcp_model_runner_v2_graph_accuracy
[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

@zhao-stack

zhao-stack commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

/e2e tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py::test_dsv3_2_sfa_pcp_graph_diagnostic[raw_logits-FULL_DECODE_ONLY]
[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

Keep graph mode and score observation fixed while changing only PCP size or the submitted prompt batch. Preserve the existing selected-prompt golden and original target assertions.

Signed-off-by: shenzhao <shenzhao9@huawei.com>
@zhao-stack

zhao-stack commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

/e2e tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py::test_dsv3_2_sfa_pcp_layout_diagnostic
[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

Keep only the release capture-buffer correction and its regression in the draft PR. Numerical validation still does not satisfy the unchanged v0.28.0 golden; retain the diagnostic records outside the production diff.

Signed-off-by: shenzhao <shenzhao9@huawei.com>
@zhao-stack zhao-stack changed the title [BugFix][MRV2] Validate v0.28.0 SFA PCP capture buffers [BugFix][MRV2] Use PCP-local graph capture buffers on v0.28.0 Sep 9, 2026
@zhao-stack

zhao-stack commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

/e2e tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py::test_dsv3_2_sfa_pcp_model_runner_v2_graph_accuracy
[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

Signed-off-by: shenzhao <shenzhao9@huawei.com>
@zhao-stack

zhao-stack commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

/e2e tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py::test_dsv3_2_sfa_pcp_tensor_diagnostic
[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

Signed-off-by: shenzhao <shenzhao9@huawei.com>
@zhao-stack

zhao-stack commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

/e2e tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py::test_dsv3_2_sfa_pcp_tensor_diagnostic
[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

Signed-off-by: shenzhao <shenzhao9@huawei.com>
@zhao-stack

zhao-stack commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

/e2e tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py::test_dsv3_2_sfa_pcp_tensor_diagnostic
[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

@zhao-stack

zhao-stack commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

/e2e tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py::test_dsv3_2_sfa_pcp_tensor_diagnostic
[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

@zhao-stack zhao-stack closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant