Skip to content

A5 RTT die-preflight scheduler assignment (mode 3) - #8

Open
yanghaoran29 wants to merge 1 commit into
mainfrom
feat/a5-rtt-die-sched-assignment
Open

A5 RTT die-preflight scheduler assignment (mode 3)#8
yanghaoran29 wants to merge 1 commit into
mainfrom
feat/a5-rtt-die-sched-assignment

Conversation

@yanghaoran29

Copy link
Copy Markdown
Owner

概要

在 A5 1O+4S 下增加 device 侧 RTT die 预检SIMPLER_SCHED_AICORE_ASSIGNMENT_OVERRIDE=3):各 Scheduler 线程用 physical core id 探测 die0/die1 AICore MMIO 延迟,按 avg(die0)-avg(die1) 排序后将 logical exec 0–1 绑定 die0 半区、2–3 绑定 die1 半区,再连续块分核。

对比基线为 main round-robin(mode 2:cluster ci → sched (ci % 4))。

Benchmark 环境

  • 平台:A5 tensormap_and_ringbuffer
  • 工具:tools/benchmark_main_vs_mode3.shbenchmark_rounds.sh
  • 每样例 编译 1 次、上板 20 轮;跳过 qwen3_14b_decode
  • 指标:Avg Effective / Avg Sched(us,来自 [STRACE]

全 suite(device 0,2026-08-21)

样例 Main Eff RTT Eff Δ Eff Main Sched RTT Sched Δ Sched
alternating_matmul_add / Case1 1335.9 1547.1 +15.8% 1310.1 1525.4 +16.4%
benchmark_bgemm / Case0 1582.3 1639.4 +3.6% 1561.6 1617.7 +3.6%
paged_attention_unroll / Case1 1900.4 2034.8 +7.1% 1878.2 2014.9 +7.3%
paged_attention_unroll / Case2 1064.7 1058.7 −0.6% 1042.6 1037.6 −0.5%
paged_attention_manual / Case1 1943.4 1831.3 −5.8% 1922.5 1805.2 −6.1%
paged_attention_manual / Case2 1045.8 1080.6 +3.3% 1025.2 1059.2 +3.3%
batch_paged_attention / Case1 7046.8 6756.9 −4.1% 7024.9 6736.7 −4.1%

负值表示 RTT(mode 3)更快。

单样例深测:benchmark_bgemm Case0(device 0,20 轮)

模式 Avg Effective (us) Avg Sched (us)
mode 1 host die-aware 1803.4 1781.4
mode 2 main RR 1738.1 1717.5
mode 3 RTT preflight 1594.2 1569.9

相对 main(mode 2):RTT Effective −8.3%,Sched −8.6%

结论

  • 大算子 / batch 类 workload 上 RTT 约 3–6% 收益。
  • 小算子类(alternating_matmul_add、bgemm 全 suite 轮)本轮未优于 main;bgemm 单测 20 轮 RTT 仍显著优于 main。
  • mode 3 启动需全核 handshake + RTT barrier,preamble 重于 decoupled 快路径。

启用

export SIMPLER_SCHED_AICORE_ASSIGNMENT_OVERRIDE=3   # RTT
export SIMPLER_SCHED_AICORE_ASSIGNMENT_OVERRIDE=2   # main baseline

Probe die0/die1 AICore MMIO latency at startup to rank scheduler threads,
then assign contiguous cluster blocks by measured affinity (mode 3). Also
land host topo die-aware assignment, half-split AICore die mapping, and
benchmark helpers for comparing main round-robin vs RTT placement.

Co-authored-by: Cursor <cursoragent@cursor.com>
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