Skip to content

feat(qy): MiniCPM5 FA, longctx MoE/RoPE, CUDA-graph capture safety - #597

Open
Ceng23333 wants to merge 9 commits into
InfiniTensor:refactor/adopt-modern-infini-stackfrom
Ceng23333:feat/qy-backend-build
Open

Ceng23333 wants to merge 9 commits into
InfiniTensor:refactor/adopt-modern-infini-stackfrom
Ceng23333:feat/qy-backend-build

Conversation

@Ceng23333

@Ceng23333 Ceng23333 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Enable MiniCPM5 on QY with FlashAttention, longctx MoE/RoPE GPU promotions, and CUDA-graph capture-safe sync helpers. Targets refactor/adopt-modern-infini-stack (post-refactor tip f94d83d).

Commits (high level)

  1. Allow QY flash-attn + MiniCPM5 MoE stack
  2. CUDA graph-safe FlashAttention for MiniCPM5
  3. Merge longctx MoE/RoPE GPU promotions onto cudagraph
    4–8. Capture-unsafe RoPE / avoid host sync under graph capture / sync helper fixes

Dependencies (merge order)

  1. InfiniOps feat(qy): QY ops backend with FA and longctx MoE/RoPE kernels InfiniOps#1002
  2. InfiniRT feat(qy): enable QY CUDA runtime device backend InfiniRT#49
  3. InfiniCCL feat(qy): QY-compatible CPU device header fix InfiniCCL#77
  4. InfiniCore chore(qy): pin InfiniRT/Ops/CCL for MiniCPM5 FA/longctx InfiniCore#1575
  5. This PR

Source pin: ITW release/2026.10.13-qy-minicpm5-16a3-fa-longctx-cudagraph

Validation

  • python3 scripts/format.py --ref f94d83d --check with clang-format 18.1.8 + ruff: pass
  • python -m unittest discover -s test/scripts -p "test_build_infini_stack.py" -v: 3 errors (test harness looking for ops.json / local layout; not QY-specific regressions)
  • python -m unittest discover -s test/static -p "test_*.py" -v: 5 failures + 1 error reflecting intentional QY/MiniCPM5 contract expansions (device qy in BaseConfig, new adapters/count, minicpm5_moe model sources, graph-safe FA provider selection). Contract tests need follow-up update on this branch or a stacked commit.
  • Full QY native build/serve: not run on PR host (no QY SDK). Integration-validated via the ITW release pin above.
  • build_infini_stack.py --dry-run: blocked here by local InfiniCore submodule worktree SHAs after Ops/RT rebase (pin PR still references pre-rebase tips).

Notes

  • Branch: feat/qy-backend-build
  • Large multi-commit PR; each commit is focused (Conventional Commits).

Made with Cursor

Stack PR index (merge order)

  1. InfiniOps: feat(qy): QY ops backend with FA and longctx MoE/RoPE kernels InfiniOps#1002
  2. InfiniRT: feat(qy): enable QY CUDA runtime device backend InfiniRT#49
  3. InfiniCCL: feat(qy): QY-compatible CPU device header fix InfiniCCL#77
  4. InfiniCore: chore(qy): pin InfiniRT/Ops/CCL for MiniCPM5 FA/longctx InfiniCore#1575
  5. InfiniLM: feat(qy): MiniCPM5 FA, longctx MoE/RoPE, CUDA-graph capture safety #597 → base refactor/adopt-modern-infini-stack

ITW pin: https://github.com/Ceng23333/InfiniTensorWorktree/tree/release/2026.10.13-qy-minicpm5-16a3-fa-longctx-cudagraph

Ceng23333 and others added 9 commits October 10, 2026 09:33
Whitelist DEVICE_TYPE_QY for FA, add denglin MoE adaptors and MiniCPM5
MoE model surface, and ship QY stack build/config helpers used by the
post-refactor integration.
Select the QY FA provider under graph capture, allowlist MiniCPM5
decode layouts, and keep MoE ATen/_dl_C ops in eager segments.
Apply C1-C3 longctx dirty sources (aten/dl kernels + sparse MoE block + server) on top of CUDA-graph FA MiniCPM5.
Longctx RoPE uses cudaMemcpy/pack and host sync; keep it in eager graph segments so FA/gemm capture still works with ENABLE_GRAPH=1.
Mark MulScalar capture-unsafe with MoE routing, and skip cudaStreamSynchronize while the stream is capturing so longctx QY kernels can participate in graph-on startup.
…nd ruff

Co-authored-by: Cursor <cursoragent@cursor.com>
@Ceng23333

Copy link
Copy Markdown
Contributor Author

QY required smoke (PR head)

  • Head SHA: 60757bd9e3325113d4df1b5f3e30a5d82af4bcf8
  • Host: Denglin QY, DENGLIN_DEVICES=3, port 18184
  • Command: build_infini_stack.py --backend qy --operator-config …/infiniops_ops_qy_m2.json --test + xmake _infinicore/_infinilm; EvalScope mixed-4096 P1/N10
  • Result: PASS
    • Stack m2 build/test OK
    • Short greedy fluent (你好 → 好的,您好!…)
    • EvalScope: EXIT=0, 10/10 (100%), no OOR (avg TTFT ~40.3s; ≤26s not required)
  • Log: …/logs/prhead-verify/evalscope-mixed-4096.log
  • Staging: bench_client_minicpm5-16a3_20261015_104057

Sibling PR heads: RT 95d30fe, Ops ed0b40d, CCL 13e5f61; Core gitlinks retargeted locally for e2e.

@Ceng23333

Copy link
Copy Markdown
Contributor Author

QY required smoke (PR head) — detailed

  • Head SHA: 60757bd9e3325113d4df1b5f3e30a5d82af4bcf8
  • Host: Denglin QY, DENGLIN_DEVICES=3, port 18184 (graph on, FA+paged)
  • Sibling heads: RT 95d30fe, Ops ed0b40d, CCL 13e5f61
  • Overall: PASS
  • Logs: …/logs/prhead-verify/stack-m2-build-test.log, greedy-hello.json, evalscope-mixed-4096.log
  • Staging: bench_client_minicpm5-16a3_20261015_104057

Build / stack

Step Detail Result
build_infini_stack.py --backend qy (m2, 23 ops incl. FA) --test PASS
InfiniRT ctest (via stack) 12/12 PASS
InfiniOps m2 install linked FA + paged KV PASS
InfiniCCL install TP1 CPU/OMPI PASS
xmake _infinicore + _infinilm against prhead prefix PASS

Serve / greedy

Check Result
DUT up http://127.0.0.1:18184/v1/models PASS (minicpm5-16a3)
Greedy 你好 (thinking off, max_tokens=64) PASS — 好的,您好!有什么我可以帮助您的吗? (11 tok)

EvalScope mixed-4096 (P1 / N10)

Metric Value Gate
EXIT 0 required
Success 10 / 10 (100%) required
Failed 0 required
OOR none observed required
Avg input / output tokens 4096 / 971.7 —
Avg TTFT (ms) 40322 ≤26s not required
Output throughput (tok/s) 4.2 —
Test duration (s) 2314.5 —

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