Skip to content

Add: A5 benchmark cases across graph runtimes - #1815

Merged
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
doraemonmj:feat/benchmark-a3-a5-runtimes
Aug 13, 2026
Merged

Add: A5 benchmark cases across graph runtimes#1815
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
doraemonmj:feat/benchmark-a3-a5-runtimes

Conversation

@doraemonmj

@doraemonmj doraemonmj commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add A5 host-build-graph scene cases for the non-Qwen benchmark workloads.
  • Add the actual benchmark_bgemm/Case0 workload to A5 TMR and HBG, using A5-specific fixed-128-tile kernels and scalar topology arguments.
  • Reuse each existing A5 TMR orchestration and incore source for the other HBG counterparts.
  • Keep the change limited to case migration: no runtime, harness, skill, metric, or A2/A3 changes.

Related to #1727.

Coverage matrix

Benchmark workload A3 TMR A3 HBG A5 TMR A5 HBG
alternating_matmul_add Case1 Case1 Case1 Case1 (new)
benchmark_bgemm Case0 Case0 Case0 (new) Case0 (new)
paged_attention_unroll Case1, Case2 Case1, Case2 Case1, Case2 Case1, Case2 (new)
paged_attention_unroll_manual_scope Case1, Case2 Case1, Case2 Case1, Case2 Case1, Case2 (new)
batch_paged_attention Case1 Case1 Case1 Case1 (new)
qwen3_14b_decode StressBatch16Seq3500 × × ×
spmd_paged_attention Case1, Case2 × × ×

The five included workloads have full A3/A5 × TMR/HBG case coverage. × marks a counterpart that is not present in the current tree or this PR:

  • qwen3_14b_decode: excluded by request.
  • spmd_paged_attention: excluded from this PR and left for follow-up.

A5 BGEMM details

  • Preserves the A3 benchmark_bgemm/Case0 shape: 500 matmul tasks, 500 add tasks, tile size 128, incore_loop=4, and grid_k=2.
  • Uses A5-specific AIC/AIV kernels because the A2/A3 kernels are not directly reusable on A5.
  • Supplies graph-topology values as scalar orchestration arguments. A5 HBG builds the graph on the host, so it must not directly dereference a config tensor's device address.
  • The A5 HBG test references the A5 TMR kernel and orchestration sources.

Validation

  • A5 hardware (a5new), all NPU access through task-submit --device auto:
    • benchmark_bgemm/Case0 TMR + golden: passed (task_20260813_113257_36868417320)
    • benchmark_bgemm/Case0 HBG + golden: passed (task_20260813_113313_3713652657)
    • Remaining four workloads: default HBG/TMR sweep 4/4 + 4/4; selected manual benchmark cases 3/3 + 3/3.
  • A5 lock-free scene compilation: 6/6 classes passed on the rebased tree.
  • pre-commit passed: headers, platform literals, clang-format, cpplint, ruff, pyright, and whitespace checks.
  • git diff --check passed.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

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: ef75735f-f731-41c3-910b-353111fe429f

📥 Commits

Reviewing files that changed from the base of the PR and between ab9bdb9 and 0e5fb5d.

📒 Files selected for processing (5)
  • examples/a5/host_build_graph/bgemm/test_bgemm.py
  • examples/a5/host_build_graph/paged_attention_unroll_manual_scope/test_paged_attention_unroll_manual_scope.py
  • tests/st/a5/host_build_graph/alternating_matmul_add/test_alternating_matmul_add.py
  • tests/st/a5/host_build_graph/batch_paged_attention/test_batch_paged_attention.py
  • tests/st/a5/host_build_graph/paged_attention_unroll/test_paged_attention_unroll.py

📝 Walkthrough

Walkthrough

Adds five A5 host-build-graph scene tests. The tests register orchestration and device kernels, define execution cases, generate task arguments, compute golden outputs, and run through SceneTestCase.

Changes

A5 host-build-graph benchmark scenes

Layer / File(s) Summary
BGEMM scene configuration and validation
examples/a5/host_build_graph/bgemm/test_bgemm.py
Adds BGEMM kernel wiring, an A5 case, tiled tensor generation, and a batched matmul golden result.
Alternating matmul-add scene
tests/st/a5/host_build_graph/alternating_matmul_add/test_alternating_matmul_add.py
Adds orchestration and compute kernels, default and manual cases, deterministic arguments, and matmul-plus-addition validation.
Paged-attention unroll scenes
tests/st/a5/host_build_graph/paged_attention_unroll/test_paged_attention_unroll.py, examples/a5/host_build_graph/paged_attention_unroll_manual_scope/test_paged_attention_unroll_manual_scope.py
Adds standard and manual-scope paged-attention unroll scenes with shared input generation and golden-output computation.
Batch paged-attention scene
tests/st/a5/host_build_graph/batch_paged_attention/test_batch_paged_attention.py
Adds batched paged-attention kernel wiring, two A5 bfloat16 cases, task arguments, and golden-output writeback.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Mergeability Score: ⚪ Minimal · up to 0e5fb

This change adds localized A5 host-build-graph benchmark cases without changing kernels, runtime behavior, harnesses, skills, or metrics; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant SceneTestCase
  participant HostBuildGraph
  participant DeviceKernels
  participant GoldenHelper
  SceneTestCase->>HostBuildGraph: register kernels and build task arguments
  HostBuildGraph->>DeviceKernels: execute the configured workload
  SceneTestCase->>GoldenHelper: compute expected tensor outputs
  GoldenHelper-->>SceneTestCase: return golden tensors
Loading

Poem

A rabbit hops through graphs so bright,
With tiled sums packed just right.
Attention flows from Q to V,
Golden answers wait to see.
A5 kernels run and cheer—
“Host-built scenes are hopping here!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the A5 benchmark case additions across graph runtime variants.
Description check ✅ Passed The description directly explains the A5 host-build-graph benchmark additions, coverage, implementation scope, and validation results.

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.

- Add A5 host-build-graph counterparts for the non-Qwen benchmark cases
- Add benchmark_bgemm Case0 for A5 TMR and HBG with fixed 128-tile kernels
- Pass BGEMM topology as scalar arguments for host-side graph construction
@doraemonmj
doraemonmj force-pushed the feat/benchmark-a3-a5-runtimes branch from 0e5fb5d to e295bbd Compare August 13, 2026 03:34
@doraemonmj doraemonmj changed the title Add: A5 host-build-graph benchmark cases Add: A5 benchmark cases across graph runtimes Aug 13, 2026
@ChaoZheng109
ChaoZheng109 merged commit 75f7911 into hw-native-sys:main Aug 13, 2026
17 checks passed
@ChaoZheng109

Copy link
Copy Markdown
Collaborator

整体 LGTM 👍 —— 用例迁移边界清晰,所有引用的 kernel/orchestration 源码均可解析,HBG 各用例的 generate_args / compute_golden 与对应 A5 TMR 孪生逐一对齐,A5 BGEMM 改用标量传拓扑参数(HBG host 侧构图不能解引用 config 张量的 device 地址)的设计正确,也比 A3 更干净。

有两个非阻塞的遗留项,想请你确认一下是本 PR 顺手补,还是有意留作后续:

1. benchmark_bgemm 用例缺 a5sim 平台覆盖

TMR 和 HBG 的 bgemm Case0 都只声明了 "platforms": ["a5"],只能在真实硬件上跑,不会进 sim CI 通道。对比:

  • A3 的 benchmark_bgemm["a2a3sim", "a2a3"];
  • 本 PR 同批迁移的 alternating_matmul_add Case0 也带了 ["a5sim", "a5"]

如果 A5 固定 128-tile 的 kernel 能在 a5sim 下正常跑,建议给 bgemm 补上 a5sim,这样能获得 CI 上的免硬件回归保护(否则这两个用例只有靠人手动在 a5 上跑才能发现回归)。如果是 kernel 目前跑不了 a5sim,麻烦在 PR 里说明一下原因。

2. 新增的 A5 TMR benchmark_bgemm 目录缺 README.md

A3 的 examples/a2a3/tensormap_and_ringbuffer/benchmark_bgemm/ 目录里有 README.md,而新建的 examples/a5/tensormap_and_ringbuffer/benchmark_bgemm/ 没有。属文档 parity 的小缺口,补一份(说明 A5 固定 128-tile、标量传参与 A3 的差异)会方便后来者。

两项都不影响合入,确认后即可。

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.

2 participants