Update BMM_Theory: bmm_theory/branches/merge_batch.py (fix review issues #4-#10)

This commit is contained in:
2026-09-03 11:34:26 +00:00
parent c0b358fa94
commit 1385d01816

View File

@@ -52,6 +52,15 @@ class MergeBatchBranch(Branch):
"2_L0C容量: 2*(b0*M)*(b0*N)*4B <= L0C",
c2, f"need={l0c_need}B, L0C={s.l0c_bytes}B"))
# 条件 2b: 合并后 b0*M / b0*N 在 L0A/L0B 最小 K 粒度(16)下也放得下
# (issue#5: fp32 大 M/N 时 base tile 溢出 L0A/L0B, 合并语义决定 base 不可再切小)
l0a_min = MIN_B0 * m * s.fractal * dt * 2
l0b_min = MIN_B0 * n * s.fractal * dt * 2
c2b = l0a_min <= s.l0a_bytes and l0b_min <= s.l0b_bytes
checks.append(ConditionCheck(
"2b_L0AB容量: 合并后 b0*M/b0*N 在最小K粒度下可驻留 L0A/L0B",
c2b, f"L0A需{l0a_min/1024:.0f}KB(≤{s.l0a_bytes/1024:.0f}), L0B需{l0b_min/1024:.0f}KB(≤{s.l0b_bytes/1024:.0f})"))
# 条件 3: b_core*(MK+KN)*dtype >= min_DatamountPerCore
amt = b_core * (m * k + k * n) * dt
c3 = amt >= s.min_datamount_per_core