Update BMM_Theory: bmm_theory/branches/merge_batch.py

This commit is contained in:
2026-09-03 12:43:53 +00:00
parent af0a90bc25
commit 4f90f76db9

View File

@@ -82,6 +82,20 @@ class MergeBatchBranch(Branch):
"5_访存Bound: 2MN/(M+N) < R16/b0", "5_访存Bound: 2MN/(M+N) < R16/b0",
c5, f"AI={ai:.1f} vs R16/b0={s.r16/MIN_B0:.1f}")) c5, f"AI={ai:.1f} vs R16/b0={s.r16/MIN_B0:.1f}"))
# 条件 6: 转置对齐 (参考 bmmv3 源码条件 17/20)
# A 转置且 M>1 时, tempAlignM = b0 * alignM (M 维按 b0 对齐)
# A 转置或 B 不转置时, minBaseK 需按 basic_block_size 对齐
from ..models import align_up
if case.trans_a and m > 1:
temp_align_m = MIN_B0 * align_up(m, s.fractal)
l0a_need_trans = temp_align_m * s.fractal * dt * 2
c6 = l0a_need_trans <= s.l0a_bytes
checks.append(ConditionCheck(
"6_A转置对齐: A转置时 tempAlignM=b0*alignM 需驻留 L0A",
c6, f"tempAlignM={temp_align_m}, L0A需{l0a_need_trans/1024:.0f}KB(≤{s.l0a_bytes/1024:.0f})"))
else:
checks.append(ConditionCheck("6_A转置对齐", True, "A不转置或M=1, 无额外对齐要求"))
return checks return checks
# ------------------------------------------------------------------ # ------------------------------------------------------------------