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

This commit is contained in:
2026-09-03 11:34:18 +00:00
parent 0c19d99d3a
commit 9ef240f505

View File

@@ -2,7 +2,10 @@
case 输入 csv 列 (表头, 大小写不敏感, 缺省列取默认值):
case_id, batch_a, batch_b, m, n, k,
dtype_a, dtype_b, dtype_c, trans_a, trans_b, has_bias, deterministic_level
dtype_a, dtype_b, dtype_c, trans_a, trans_b, has_bias, out_nd, deterministic_level
建模边界说明: trans_a/trans_b (转置对 dValue/排布的影响) 与 has_bias (bias 读写增量)
本期不建模, 仅透传记录; out_nd=False 会禁用 StreamK (进入条件 4).
方案输入 csv (评估模式): ImplPlan 全部字段, 见 ImplPlan.csv_fields().
@@ -14,6 +17,7 @@ case 输入 csv 列 (表头, 大小写不敏感, 缺省列取默认值):
from __future__ import annotations
import csv
import sys
from pathlib import Path
from .models import BmmCase, ImplPlan, EvalResult
@@ -61,10 +65,17 @@ def load_cases(path: str | Path) -> list:
trans_a=_to_bool(r.get("trans_a")),
trans_b=_to_bool(r.get("trans_b")),
has_bias=_to_bool(r.get("has_bias")),
out_nd=_to_bool(r.get("out_nd"), True),
deterministic_level=_to_int(r.get("deterministic_level"), 0),
))
except ValueError as e:
raise ValueError(f"{path}{i+2}行解析失败: {e}") from e
# issue#8: A/B dtype 不一致告警 (注释承诺的 warning 落地)
for c in cases:
if c.dtype_a.strip().lower() != c.dtype_b.strip().lower():
print(f"[warn] case {c.case_id}: A/B dtype 不一致 "
f"({c.dtype_a} vs {c.dtype_b}), 数据量按较大者建模, "
f"混精度对 dValue/带宽的影响未精确建模", file=sys.stderr)
return cases