Update BMM_Theory: bmm_theory/timing.py (fix review issues #4-#10)
This commit is contained in:
@@ -98,18 +98,28 @@ def assemble_timing(t_mte2_gm: float, t_mte2_l2: float, t_dma_cmd: float,
|
|||||||
t_drain: float,
|
t_drain: float,
|
||||||
gm_read_bytes: float, l2_read_bytes: float,
|
gm_read_bytes: float, l2_read_bytes: float,
|
||||||
dma_cmd_count: float, cube_flops: float,
|
dma_cmd_count: float, cube_flops: float,
|
||||||
fixpipe_bytes: float) -> HardwareTiming:
|
fixpipe_bytes: float,
|
||||||
"""汇总各级时延, 判定瓶颈."""
|
reduce_serial: bool = True) -> HardwareTiming:
|
||||||
|
"""汇总各级时延, 判定瓶颈.
|
||||||
|
|
||||||
|
归约计账约定 (issue#9): REDUCE 默认**串行追加** (reduce_serial=True, 归约不可
|
||||||
|
掩盖, 体现在 t_drain 中), 不进稳态 max(); 仅当调用方显式声明归约可流水掩盖
|
||||||
|
(reduce_serial=False) 时才进稳态 max(). 避免"既取最大又串行追加"的双倍计账.
|
||||||
|
"""
|
||||||
t_mte2 = t_mte2_gm + t_mte2_l2 + t_dma_cmd
|
t_mte2 = t_mte2_gm + t_mte2_l2 + t_dma_cmd
|
||||||
stages = {
|
stages = {
|
||||||
"MTE2_GM": t_mte2_gm + t_dma_cmd,
|
"MTE2_GM": t_mte2_gm + t_dma_cmd,
|
||||||
"MTE2_L2": t_mte2_l2,
|
"MTE2_L2": t_mte2_l2,
|
||||||
"MMAD": t_mmad,
|
"MMAD": t_mmad,
|
||||||
"FIXPIPE": t_fixpipe,
|
"FIXPIPE": t_fixpipe,
|
||||||
"REDUCE": t_reduce,
|
|
||||||
}
|
}
|
||||||
|
if not reduce_serial:
|
||||||
|
stages["REDUCE"] = t_reduce
|
||||||
bottleneck = max(stages, key=stages.get)
|
bottleneck = max(stages, key=stages.get)
|
||||||
t_steady = max(stages.values())
|
t_steady = max(stages.values())
|
||||||
|
# 归约串行追加时, 若它是全链路最大项则瓶颈标注为 REDUCE (但时延只计一次)
|
||||||
|
if reduce_serial and t_reduce > t_steady:
|
||||||
|
bottleneck = "REDUCE"
|
||||||
return HardwareTiming(
|
return HardwareTiming(
|
||||||
gm_read_bytes=gm_read_bytes, l2_read_bytes=l2_read_bytes,
|
gm_read_bytes=gm_read_bytes, l2_read_bytes=l2_read_bytes,
|
||||||
t_mte2_gm=t_mte2_gm, t_mte2_l2=t_mte2_l2, t_mte2=t_mte2,
|
t_mte2_gm=t_mte2_gm, t_mte2_l2=t_mte2_l2, t_mte2=t_mte2,
|
||||||
|
|||||||
Reference in New Issue
Block a user