Skip to content

[Feature] Support DiffusionGemma NPU graph and kernel cleanup - #11279

Closed
leedongkun30-arch wants to merge 1 commit into
vllm-project:mainfrom
leedongkun30-arch:feature/diffusion-gemma-npu-graph-canvas
Closed

leedongkun30-arch wants to merge 1 commit into
vllm-project:mainfrom
leedongkun30-arch:feature/diffusion-gemma-npu-graph-canvas

Conversation

@leedongkun30-arch

@leedongkun30-arch leedongkun30-arch commented Jul 1, 2026 •

Copy link
Copy Markdown

What this PR does

This draft adds Ascend NPU support for DiffusionGemma block-diffusion serving and records the current kernel-cleanup checkpoint for the final PR shape.

The PR-facing scope is:

  1. Make DiffusionGemma graph decode stable on Ascend by keeping graph metadata on persistent NPU buffers and using the graph-capturable BNSD fused-infer-attention path for head_dim=256.
  2. Make canvas batch serving correct by carrying causal/denoise phase per request and selecting the right mask in mixed batches.
  3. Reduce DiffusionGemma small-op clouds around attention input prep, MoE routing/topk post-processing, and MoE combine tail without changing the denoise/sampler policy or reducing the GEMM count.

This PR should be reviewed as a kernel/runtime cleanup, not as an algorithm-side draft/sampling change.

Current E2E checkpoint: TP=1 N=200 150 -> 163 tok/s

Latest local kernel-cleanup validation uses CANN 9.0.1 on physical NPU 1. The baseline row is the existing TP=1 graph baseline summary with the same sample count and generation settings.

Mode TP N Correct Generation time Tokens Throughput Speedup
Baseline graph 1 200 189/200 314.762s 47,365 150.479 tok/s 1.000x
Kernel cleanup 1 200 186/200 292.134s 47,721 163.353 tok/s 1.086x

The earlier TP=1 N=20 kernel-cleanup run reported 181.356 tok/s, but it is no longer used as the PR headline because the shorter sample set was optimistic. The PR E2E number is now the N=200 result above.

Run files:

  • Baseline summary: ~/_workspace/results/dgemma-fusion-ab-168/summary_baseline_tp1_mml1024_util09.json
  • Current E2E summary: ~/_workspace/results/dgemma-fusion-ab-168/summary_kernelonly_cann901_mml1024_util09_manualfia_topkpost_skipabs_kv2_dev1_n200.json
  • Previous N=20 checkpoint summary: ~/_workspace/results/dgemma-fusion-ab-168/summary_kernelonly_cann901_mml1024_util09_manualfia_topkpost_skipabs_dev1_n20_afterpathfix.json

Fusion set in the kernel-cleanup path

Enabled in the current E2E path:

  • VLLM_ASCEND_DGEMMA_MANUAL_FIA_BNSD=1: manual BNSD fused-infer-attention entry path.
  • VLLM_ASCEND_DGEMMA_MOE_INIT_ROUTING_V2=1: newer MoE routing/init path.
  • VLLM_ASCEND_DGEMMA_ROUTING_TOPK_VALUES=1 and VLLM_ASCEND_DGEMMA_TOPK_VALUES_POST_ASCENDC=1: fuse the topk-values post/renorm-scale tail.
  • VLLM_ASCEND_DGEMMA_MOE_SKIP_COMBINE_ABS=1: remove redundant abs work in the MoE combine tail.
  • VLLM_ASCEND_DGEMMA_SKIP_RMSNORM_QUANT_SP_PATTERNS=1 and VLLM_ASCEND_DGEMMA_SKIP_RMSNORM_QUANT_CUSTOM_PATTERNS=1: avoid graph-fusion pass patterns that interfere with this DiffusionGemma path.

Not included:

  • No algorithm-side draft/sampler changes.
  • No GEMM-count reduction.
  • No shipped Cloud2 grouped-GEMM epilogue fusion. The AIC/AIV handoff experiment is deferred.
  • Vendor GEMM/CANN kernels were reference material only, not executed directly as the PR solution.

1-block forward profile: baseline vs kernel cleanup

Captured on 2026-07-24 with CANN 9.0.1, physical NPU 1, TP=1, max_num_seqs=1, max_model_len=1024, one dummy decode block, run_fullgraph with num_tokens=256.

This profile is a device-op breakdown for the cleanup path. It explains where the kernel-side gain comes from, but the PR headline E2E number is the N=200 result above.

Artifacts:

  • Baseline trace: ~/_workspace/results/dgemma-fusion-ab-168/profile_1block_baseline150_cann901_dev1.json
  • Cleanup trace: ~/_workspace/results/dgemma-fusion-ab-168/profile_1block_best181_cann901_dev1.json
  • Summary: ~/_workspace/results/dgemma-fusion-ab-168/profile_1block_150_181_summary.md
  • Op cloud report: ~/_workspace/results/dgemma-fusion-ab-168/opcloud_1block_150_181/oneblock_opcloud.html

Device-op summary:

Bucket Baseline ms / count Cleanup ms / count Delta
Total traced device ops 41.241 / - 32.284 / - -8.957 ms (-21.7%)
Dense MatMul + GMM 14.076 / 210 13.922 / 210 -0.155 ms
Routing reductions 7.620 / 420 1.833 / 150 -5.787 ms
Custom routing/post kernels 0.000 / 0 1.987 / 60 +1.987 ms
Copy/layout 4.835 / 668 3.919 / 608 -0.916 ms
Elementwise 16.803 / 1022 14.785 / 812 -2.018 ms
MoE tail 0.620 / 30 0.554 / 30 -0.066 ms

Selected op changes:

Op Baseline Cleanup
aclnnGroupedMatmulV5_GroupedMatmul_GroupedMatmul 6.316 ms x60 6.165 ms x60
aclnnMatmul_MatMulCommon_MatMulV2 7.760 ms x150 7.756 ms x150
aclnnReduceSum_ReduceSumOpAiCore_ReduceSum 2.368 ms x60 0.000 ms x0
aclnnSoftmax_SoftmaxAiCore_SoftmaxV2 2.014 ms x90 0.472 ms x30
aclnnSWhere_SelectV2AiCore_SelectV2 1.506 ms x90 0.350 ms x30
aclnnRepeatInterleaveIntWithDim_RepeatInterleaveV2_RepeatInterleaveV2 1.017 ms x60 0.000 ms x0
aclnnMoeInitRoutingV3_MoeInitRoutingV3_MoeInitRoutingV3 0.000 ms x0 1.541 ms x30
DgemmaTopkValuesPost 0.000 ms x0 0.446 ms x30

Interpretation: dense MatMul/GMM stayed essentially unchanged, while the routing reduction cloud and several layout/elementwise tails shrank. The next large step likely needs a safe GEMM-adjacent epilogue or producer-consumer handoff, not more standalone tiny kernels.

Earlier graph/batch validation

CANN 9.1.0 TP=2 local validation, GSM8K first 200. This is separate from the TP=1 kernel-cleanup E2E checkpoint above.

Mode max_num_seqs Correct Generation time Throughput Speedup
eager 1 192/200 636.221s 90.390 tok/s 1.00x
ACL graph 1 193/200 291.120s 197.386 tok/s 2.18x
ACL graph + canvas batch 2 193/200 227.757s 252.172 tok/s 2.79x

Local preflight limitations

  • Full pre-commit run --all-files --hook-stage manual is blocked in this environment because Node.js is v12.22.9, while markdownlint-cli@0.45.0 requires Node.js >=20.

  • Coverage tooling still reports existing uncovered CANN custom-op dynamic implementation files unrelated to this DiffusionGemma change.

  • Current local worktree contains experimental custom-op scratch changes; final code push should separate the E2E checkpoint changes from deferred Cloud2/GMM-epilogue experiments.

  • vLLM main: vllm-project/vllm@65ada0c

@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 comprehensive support for DiffusionGemma on Ascend NPU platforms within the V2 runner. It addresses critical stability and correctness issues related to graph capture and batched canvas serving. By implementing per-request attention metadata and a robust manual attention fallback, the changes ensure that mixed-phase batches (where requests may be in different denoising stages) are handled correctly without degrading generation quality. The PR also includes necessary scheduler adjustments to maintain the required canvas length for block-diffusion.

Highlights

  • DiffusionGemma NPU Support: Enabled Ascend NPU support for DiffusionGemma block-diffusion serving in the V2 runner, ensuring stable graph capture and correct canvas batching.
  • Per-Request Attention Metadata: Implemented per-request causal/bidirectional attention masks to prevent generation degradation in mixed-phase batches.
  • Graph-Safe Attention Fallback: Added a capturable manual attention fallback for large head sizes to ensure stability during ACL graph replay.
  • Scheduler Integration: Updated the scheduler to handle DiffusionGemma canvas sizing, ensuring the full denoising canvas is processed during decode steps.
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.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/scripts/test_config.yaml
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 Jul 1, 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.


Tip

💡 Consider Linking a Related Issue or RFC

Your PR title contains the [Feature] tag, indicating a bug fix or new feature.

Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>
  • Refs #<rfc_or_issue_number> (for RFCs)

🙏 Thanks for helping us keep the project well-organized!

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

[Attention][Feature] Support DiffusionGemma block-diffusion canvas batching on Ascend NPU

Suggested PR Summary:

### What this PR does / why we need it?
This pull request adds support for DiffusionGemma block-diffusion canvas batching on Ascend NPU. It introduces a per-request causal/bidirectional selector (`causal_per_req`) to handle mixed-phase canvas batching where some requests are in the causal/commit phase and others are in the bidirectional denoise phase. It also implements a manual attention fallback path (`_forward_manual_attention` and its capturable version) for head sizes unsupported by FIA, routes DiffusionGemma to an adapted `AscendDiffusionGemmaModelState`, and adds scheduling and model runner wiring for the block-diffusion canvas.

Feedback:
- In `_persist_seqlens`, `self._seqlens_persist` is created on the CPU tensor's device, which is CPU. This will cause PyTorch to treat it as a constant during graph capture, preventing in-place updates from being visible during replay. It should be created on `self.device`.
- In `vllm_ascend/worker/v2/model_runner.py`, `self.decode_query_len` is unconditionally overwritten later in `__init__` to `self.num_speculative_steps + 1`, which needs to be made conditional on `not self._is_diffusion_gemma` to avoid shape mismatches.

### Does this PR introduce _any_ user-facing change?
No, this is an internal backend support addition for DiffusionGemma on Ascend NPU.

### How was this patch tested?
Added end-to-end NPU support test `test_diffusion_gemma_26b_a4b.py` and unit tests in `test_diffusion_gemma_causal_per_req.py`.

Comment thread vllm_ascend/attention/attention_v1.py Resolved
Comment thread vllm_ascend/worker/v2/model_runner.py Resolved
@leedongkun30-arch
leedongkun30-arch force-pushed the feature/diffusion-gemma-npu-graph-canvas branch 5 times, most recently from 5fb9d29 to ccdaee8 Compare July 1, 2026 17:33
@leedongkun30-arch
leedongkun30-arch force-pushed the feature/diffusion-gemma-npu-graph-canvas branch 3 times, most recently from d133a10 to b1d0859 Compare July 2, 2026 08:48
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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

@leedongkun30-arch
leedongkun30-arch force-pushed the feature/diffusion-gemma-npu-graph-canvas branch 2 times, most recently from 956d4ed to 5f61bf2 Compare July 15, 2026 08:57
@github-actions

Copy link
Copy Markdown
Contributor

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

leedongkun30-arch commented Jul 18, 2026 •

Copy link
Copy Markdown
Author

DiffusionGemma decode performance update

I re-ran the DiffusionGemma-26B-A4B batch-1 decode measurements on Ascend 910B with max_model_len=2048, max_num_seqs=1, graph capture size 256, and the qkv path enabled via VLLM_ASCEND_DGEMMA_FUSE_QKVPROJ_ASCENDC=1.

E2E result

Path GSM8K n Accuracy Generated toks Wall tok/s
Baseline, qkv fusion off 20 0.950 5940 68.3s 87.03
DgemmaFusedNormRope only 20 0.950 6175 46.6s 132.54
Final qkv MIX scratch path + DgemmaFusedNormRope 20 0.950 6184 42.2s 146.40
PR patch-only clean vLLM hot run 20 0.950 6184 45.8s 135.15

Final best speedup is 146.40 / 87.03 = 1.68x over the baseline, or +59.37 tok/s. The PR patch-only clean-vLLM validation is still baseline-positive at 135.15 / 87.03 = 1.55x.

PR patch-layer validation

I also validated the PR-facing wiring without relying on the scratch-edited gemma4.py:

  • Clean vLLM worktree: ~/_scratch/vllm_prpatch_clean
  • Clean gemma4.py: no direct DGEMMA_FUSE, qkv custom-op, scratch, or router/fold edits
  • PYTHONPATH order: clean vLLM first, then this vllm-ascend checkout
  • Patch confirmation: Gemma4Attention.forward.__module__ == vllm_ascend.patch.worker.patch_gemma4_qkv
  • Hot-cache E2E: DIFF_GSM8K n=20 correct=19 acc=0.950 wall=45.8s gen_toks=6184 tok/s=135.15
  • Graph evidence: compiled graph loaded from cache in 0.144s, torch.compile took 6.35s, graph capture completed, and decode used run_fullgraph with num_tokens=256

The first clean-vLLM run exposed a fullgraph issue from calling os.getenv inside Gemma4Attention.forward because torch_npu wraps it with logging. The patch now reads VLLM_ASCEND_DGEMMA_FUSE_QKVPROJ_ASCENDC once at module import, so the forward path is fullgraph-safe.

Kernel contribution split

The final implementation uses two graph-captured custom kernels in the pre-attention path:

  1. DgemmaFusedNormRope: q/k/v RMSNorm + neox RoPE AIV kernel.

    • Baseline -> norm_rope-only: 87.03 -> 132.54 tok/s
    • Increment: +45.51 tok/s (+52.3%)
    • Share of final E2E gain: about 76.7%
  2. DgemmaFusedQkvProjNormRope: qkv projection MIX op, used in scratch-only mode.

    • Norm_rope-only -> final qkv MIX scratch path: 132.54 -> 146.40 tok/s
    • Increment: +13.86 tok/s (+10.5% incremental over norm_rope-only)
    • Share of final E2E gain: about 23.3%

The final wiring intentionally consumes the qkv MIX op's persistent scratch output, then runs the proven AIV norm_rope op. This avoids the graph-replay lifetime hazard seen when directly consuming q/k/v returned tensors from the MIX op, while still letting the qkv GEMM portion move out of the Python/graph small-op cloud.

Profiling / performance JSON analysis

The earlier 3x slowdown was not consistent with the kernel microbenchmarks and was not explained by host dispatch or cos/sin preprocessing:

  • qkv MIX device time improved after sync relaxation: 307 us/call -> 254 us/call (-17.5%).
  • Host-wall microbench for the qkv path also improved: 92.4 us/layer -> 74.7 us/layer (-19%).
  • N=1 graph profiling showed only modest deltas:
    • NOTIFY/cross-core sync: baseline 58.7 ms/step, MIX 73.2 ms/step.
    • Device span: baseline 102 ms/step, MIX 113 ms/step (+11 ms).
    • Host dispatch count: MIX was only about +12% vs baseline.

Those numbers cannot explain an observed 87 tok/s -> 18-30 tok/s regression. The root cause was runtime package/ABI contamination: a partial qkv libcust_opapi.so was missing existing required symbols such as aclnnAddRmsNormBias and aclnnMoeInitRoutingCustom, while an older full opapi had the stale qkv ABI. Rebuilding and installing the full current opapi plus the current qkv kernel/config restored the expected E2E behavior.

Correctness checks

Bit-exact tolerance remains within the existing 5e-3 threshold:

  • T=1: q/k maxrel 0, v maxrel 4.762e-03
  • T=256: q maxrel 2.941e-03, k maxrel 3.165e-03, v maxrel 3.401e-03

The final E2E result keeps GSM8K accuracy at 0.950, matching the baseline accuracy run.

leedongkun30-arch commented Jul 18, 2026 •

Copy link
Copy Markdown
Author

Routing follow-up:

I rechecked the DiffusionGemma router side after the attention qkv/norm_rope path stabilized. The result is still do not include routing fusion in this PR, but the evidence is now a little more nuanced than the first single-run result.

Measured on die2, mml=2048, MNS=1, graph decode:

Path GSM8K acc tok/s Notes
qkv attention fast path only 0.950 146.40 earlier hot reference
qkv attention + dgemma_fused_router_norm 0.950 140.75 earlier single run, -3.9%

Same-die repeated A/B on 2026-07-18:

Run Path GSM8K acc tok/s
A qkv attention only 0.950 127.58
A qkv attention + router_norm 0.950 132.37
B qkv attention only 0.950 132.21
B qkv attention + router_norm 0.950 132.69

Average delta is +2.0%, but the second paired delta is only +0.36%; this is too close to E2E variance to justify expanding the PR.

Other routing checks:

Candidate Result
dgemma_fused_router_norm accurate and ~5.2-5.5x faster than eager norm/root_size/scale in isolation, but E2E benefit is noise-level
dgemma_fused_router_norm_proj slower than split AIV norm + CANN MatMul (T=1: 11.89us vs 9.72us, T=256: 21.91us vs 16.47us)
moe_gating_top_k already registered under this Python name and already used by the generic Ascend Gemma4 selector path; Gemma4 shape E=128, top_k=8 is ids-exact vs reference with maxrel around 1e-7, ~2.4-2.6x faster than torch reference
per_expert_scale -> w2/down_proj folding accuracy preserved, but E2E-negative: fold hot 129.55 tok/s; router_norm + fold hot 124.40 tok/s
per_expert_scale[topk_ids] postprocess host-wall microbench makes it look large (~48-56us), but graph profile shows the actual replay cost is only ~4.3us per MoE layer (cast + mul + final cast); Python alternatives (index_select, in-place clone, bf16 gather/mul) were slower

Graph-profile detail for the scale postprocess:

Profile MoeGatingTopK med scale cast med scale mul med final cast med scale postprocess total
qkv-only 17.26us 1.16us 1.62us 1.52us 4.30us
qkv + router_norm 17.66us 1.16us 1.62us 1.48us 4.26us

Interpretation: routing is not currently the clean headroom item. Top-k/gating is already on the optimized Ascend path, projection should stay CANN MatMul, and the remaining router norm/scale changes are too small or negative in E2E. A real routing breakthrough would likely need the gating kernel API itself to consume per_expert_scale internally or would need to reduce a larger MoE dispatch/combine cost. This PR should remain focused on the attention-side qkv/norm_rope work.

leedongkun30-arch commented Jul 19, 2026 •

Copy link
Copy Markdown
Author

Router-front Ascend C fusion validation (NPU3, 2026-07-19)

Code update pushed to the PR. Final PR head: 2624c77c596f84df957e478e7462896bffb2590c.

Related commits:

  • Router-front code/artifacts: 77250ddcdf855107037d40faa6968593b08536ba
  • Text-encoding cleanup: 3d1f7bf7bb5bb5e830adc305951c1580a298f978
  • Perfetto / Chrome trace capture: 2624c77c596f84df957e478e7462896bffb2590c

Hardware and flags:

  • Ascend 910B3, NPU3 only: ASCEND_RT_VISIBLE_DEVICES=3, visible_npus=[3], PCI 0000:82:00.0
  • VLLM_ASCEND_DGEMMA_FUSE_QKVPROJ_ASCENDC=1
  • VLLM_ASCEND_DGEMMA_FUSE_ROUTER_FRONT_ASCENDC=1

E2E performance

Mode N Correct Accuracy Wall Generated tokens Throughput Speedup
baseline reference 20 19/20 95.0% 68.3s 5940 87.03 tok/s 1.00x
qkv + router-front hot 20 19/20 95.0% 42.6s 6184 145.08 tok/s 1.67x

Correctness gates

Check Result
pre-E2E cases=1500, iddiff=0, wmax=0.000913247
repeat bad=0/300, hot_us=50.59
NPU isolation visible_npus=[3], NPU3 PCI 0000:82:00.0

Perfetto / Chrome trace capture

Rendered directly from the torch_npu profiler trace_view.json files in Perfetto UI, with debug tracks for REGION/router_front, the baseline small-op cluster, and fused DgemmaFusedRouterFront.

DiffusionGemma router-front Perfetto Chrome trace capture

Trace summary: docs/assets/pr11279/router_front_profile_summary.md

Path Captures p50 p90 Mean
baseline router-front 8 802.2 us 833.1 us 843.8 us
fused DgemmaFusedRouterFront 8 207.6 us 228.9 us 215.4 us

Trace-region speedup: 3.86x.

Top op changes in the captured region:

Op Baseline count Fused count Change
DgemmaFusedRouterFront 0 8 appeared, 171.8 us total
MatMulV2 8 0 removed, 52.6 us total
Mul 32 0 removed, 43.1 us total
Cast 32 0 removed, 38.5 us total
ReduceMean 8 0 removed, 36.6 us total
MoeGatingTopK 8 0 removed, 33.5 us total
DgemmaApplyRouterScale 8 0 removed, 14.9 us total
Add 8 0 removed, 11.0 us total
Rsqrt 8 0 removed, 9.7 us total

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 19, 2026
@leedongkun30-arch leedongkun30-arch changed the title [Feature] Support DiffusionGemma NPU graph and batching [Feature] Support DiffusionGemma NPU graph and kernel cleanup Jul 24, 2026
yiz-liu added a commit that referenced this pull request Dec 1, 2026
### What this PR does / why we need it?

Enable DiffusionGemma text generation from text or image inputs on
Ascend 950DT through the standard vLLM serving API. The implementation
reuses the upstream model, sampler and scheduler. The upstream
structured diffusion server also supports decision requests on the same
engine. The V2 runner preserves upstream canvas input preparation.
Ascend attention selects causal or bidirectional FIA output per token
and keeps the two graph tasks and workspaces distinct for replay.

This is a model-scoped implementation and validation of structured
decisions. Related work in #11279 explores a broader kernel optimization
path.

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

Yes. Serve the BF16 checkpoint directly through `/v1/chat/completions`
for text or image input, or use `/v1/completions` for text. The optional
upstream structured diffusion server adds `/v1/systemone`.

### How was this patch tested?

#### Review follow-up

On Ascend 950DT in BF16 at TP=1 with vLLM `c410543`, `0e23e1a` passed
all six end-to-end smoke profiles. After the review fixes, `5f10330`
passed 51 CPU attention tests, including the causal sliding-window
boundary and the padded query offsets used by both FIA replay providers.
In a separate 950DT run with `cudagraph_mode=FULL`, three concurrent
requests completed and runtime metrics recorded six FULL replays with
192 real tokens and 256 captured query rows. The structured decision
smoke passed in the same run.

The runtime-equivalent `ac21f01` also matched greedy token IDs across
eager, FULL, and PIECEWISE on three concurrent requests with `top_k=1`.
Runtime metrics recorded four 192-to-256-token replays in each graph
mode. The selected-token logprobs returned by this setting were all
`0.0`, so this check only establishes token ID parity. Unfiltered
logprob parity remains unverified.

#### Accuracy and throughput baseline

Tested PR head `b2cf3b8` with upstream vLLM `c410543` and
`google/diffusiongemma-26B-A4B-it@cd401955` in BF16, TP=1 on Ascend
950DT. All six end-to-end profiles passed. Both performance modes ran on
the same NPU with async scheduling, up to four active sequences, a
256-token batch budget and prefix caching disabled. Each setting used a
3 s warm-up and a 15 s measurement window. All eight settings per mode
had zero request errors.

#### LLM serving

Text and image chat, completions, streaming, chunked prefill and prefix
caching passed. FULL and PIECEWISE replay were verified with four active
sequences. The table measures text streaming through
`/v1/chat/completions`.

| Concurrent requests | Eager output tok/s | Graph output tok/s | Eager
TTFT p50 (ms) | Graph TTFT p50 (ms) |
| ---: | ---: | ---: | ---: | ---: |
| 1 | 65.5 | 161.3 | 729 | 299 |
| 4 | 198.7 | 400.3 | 1,101 | 562 |
| 8 | 205.6 | 416.8 | 2,690 | 1,384 |

| LLM accuracy workload | DiffusionGemma on Ascend | Google
DiffusionGemma baseline |
| --- | ---: | ---: |
| GPQA Diamond, thinking disabled | 129/198 (65.15%) | [64.6% (Table
3)](https://arxiv.org/html/2608.00146) |

GPQA ran once on all 198 questions through `/v1/chat/completions` in
eager mode, with no failed requests, missing answers or length stops.
The published score is a reference for the same model and benchmark. The
evaluation setups differ.

#### Structured decisions

Text and image decisions and constrained and unconstrained reads passed.
The load test sent one choice question per request through
`/v1/systemone`.

| Concurrent requests | Eager req/s | Graph req/s | Eager p99 (ms) |
Graph p99 (ms) |
| ---: | ---: | ---: | ---: | ---: |
| 1 | 5.80 | 11.87 | 180 | 88 |
| 2 | 7.07 | 15.20 | 291 | 145 |
| 4 | 10.27 | 22.60 | 430 | 191 |
| 8 | 10.40 | 22.60 | 805 | 375 |
| 16 | 10.47 | 22.47 | 2,404 | 1,553 |

| Decision accuracy workload | DiffusionGemma on Ascend | Reference |
| --- | ---: | ---: |
| System One Bench (2,200 decisions) | 68.73% / 0.6663 macro-F1 | 66.95%
/ 0.6435, d1-3B on the same cases |
| Public JevBench (231 cases) | 194/231 (84.0%) | [194/231, published
djev](https://github.com/fstandhartinger/jevbench/blob/main/results/v1.2/additions/djev-per-task.json)
|

All accuracy requests returned valid responses. System One ECE was
0.2375 versus 0.0333 for d1-3B. JevBench compares exact case IDs; 185
were correct in both runs.

CPU regressions cover phase-mask updates, distinct FIA replay providers,
padded FULL replay metadata, and the causal sliding-window boundary.
Multi-card validation remains open.

- vLLM main:
vllm-project/vllm@c410543

---------

Signed-off-by: Deniz Özcan <66875687+do420@users.noreply.github.com>
Co-authored-by: Yizhou <liu_yizhou@outlook.com>
@leedongkun30-arch
leedongkun30-arch force-pushed the feature/diffusion-gemma-npu-graph-canvas branch 2 times, most recently from 5b09b65 to fbcb0fa Compare December 3, 2026 15:19
Signed-off-by: leedongkun30-arch <237956497+leedongkun30-arch@users.noreply.github.com>
@leedongkun30-arch

Copy link
Copy Markdown
Author

Work on DiffusionGemma support for Atlas A2 and A3 continues in #24544.

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