Fix issues #23-#25 (+#26 标注): GM读写共享总线累加计时 / ASW-切M/N 共享块 GM首读1次+L2重复读(n-1)次、场景按单batch判定、分组预算不再除B / StreamK 按plan实际tile芯片口径评估 / 降核线性带宽假设文档标注

This commit is contained in:
2026-09-04 11:43:23 +08:00
parent f4b23d9f05
commit 4843053ad3
10 changed files with 248 additions and 180 deletions

View File

@@ -99,19 +99,31 @@ def assemble_timing(t_mte2_gm: float, t_mte2_l2: float, t_dma_cmd: float,
gm_read_bytes: float, l2_read_bytes: float,
dma_cmd_count: float, cube_flops: float,
fixpipe_bytes: float,
reduce_serial: bool = True) -> HardwareTiming:
reduce_serial: bool = True,
fixpipe_to_gm: bool = True) -> HardwareTiming:
"""汇总各级时延, 判定瓶颈.
带宽端口口径 (issue#23, 用户澄清 + KB):
- GM 1.6TB/s 为**读写共享总线**: MTE2 的 GM 读与 Fixpipe 直写 GM 并发时无法
拆分读写占用, 时延累加 (读+写)/1.6TB/s, 并入 MTE2 搬移链;
- L2 带宽读写各自独享 5.2TB/s: L2 重复读段(读口) 与 Fixpipe→L2 写(写口)
互不竞争; MTE2 引擎顺序服务 GM/L2 装载, 两段相加 (官方 T≈HBM/1.6+L2/5.2);
- Fixpipe→L2 (resident) 写出独立为 FIXPIPE 级, 不进 GM 总线.
归约计账约定 (issue#9): REDUCE 默认**串行追加** (reduce_serial=True, 归约不可
掩盖, 体现在 t_drain 中), 不进稳态 max(); 仅当调用方显式声明归约可流水掩盖
(reduce_serial=False) 时才进稳态 max(). 避免"既取最大又串行追加"的双倍计账.
"""
t_mte2 = t_mte2_gm + t_mte2_l2 + t_dma_cmd
fix_gm = t_fixpipe if fixpipe_to_gm else 0.0 # Fixpipe 直写 GM 的时延
fix_l2 = 0.0 if fixpipe_to_gm else t_fixpipe # Fixpipe→L2 (5.2TB/s 写口)
# MTE2 搬移链 = GM 总线(读写共享, 读+直写累加) + L2 重复读段 + DMA 命令开销
# (同一 MTE2 引擎顺序服务 GM/L2 两类装载; GM 写由 Fixpipe 并发发起, 共享 GM 总线)
mte2_chain = t_mte2_gm + t_dma_cmd + fix_gm + t_mte2_l2
stages = {
"MTE2_GM": t_mte2_gm + t_dma_cmd,
"MTE2_L2": t_mte2_l2,
"MTE2": mte2_chain,
"MMAD": t_mmad,
"FIXPIPE": t_fixpipe,
"FIXPIPE": fix_l2, # 仅 Fixpipe→L2 (5.2 写口, 与 L2 读口互不竞争)
}
if not reduce_serial:
stages["REDUCE"] = t_reduce
@@ -135,8 +147,7 @@ def assemble_timing(t_mte2_gm: float, t_mte2_l2: float, t_dma_cmd: float,
def bound_type_of(bottleneck: str) -> str:
return {
"MMAD": "计算Bound",
"MTE2_GM": "访存Bound(GM)",
"MTE2_L2": "访存Bound(L2)",
"FIXPIPE": "写出Bound",
"MTE2": "访存Bound(GM读写共享+L2重复读)",
"FIXPIPE": "写出Bound(L2写口)",
"REDUCE": "归约Bound",
}.get(bottleneck, "")