Fix review issues #11-#16: StreamK fixpipe 单次计账 / K=1 AIV单缓冲方案 / MergeBatch b0 L0A/L0B 上限+路由可行回退 / advice-StreamK / 输入校验 / .gitignore+死代码清理
This commit is contained in:
@@ -84,6 +84,26 @@ class BmmCase:
|
||||
deterministic_level: int = 0 # 确定性等级, >=2 禁用 StreamK
|
||||
|
||||
# ---- 派生属性 ----
|
||||
def __post_init__(self):
|
||||
"""输入合法性校验 (issue#15): 非法维度/负值静默产出伪方案, 必须明确报错."""
|
||||
bad = []
|
||||
for nm, v, lo, ok0 in (("batch_a", self.batch_a, 1, False),
|
||||
("batch_b", self.batch_b, 1, False),
|
||||
("m", self.m, 1, False),
|
||||
("n", self.n, 1, False),
|
||||
("k", self.k, 0, True)):
|
||||
if not isinstance(v, int):
|
||||
bad.append(f"{nm}={v!r} 非整数")
|
||||
elif v < lo or (v == 0 and not ok0):
|
||||
bad.append(f"{nm}={v} 非法 (需 >= {lo})")
|
||||
if bad:
|
||||
raise ValueError("case 维度非法: " + "; ".join(bad) +
|
||||
" (m/n/batch 必须为正, k 可为 0)")
|
||||
for nm, dt in (("dtype_a", self.dtype_a), ("dtype_b", self.dtype_b),
|
||||
("dtype_c", self.dtype_c)):
|
||||
if str(dt).strip().lower() not in DTYPE_BYTES:
|
||||
raise ValueError(f"不支持的 dtype: {dt!r}, 支持 {sorted(DTYPE_BYTES)}")
|
||||
|
||||
@property
|
||||
def batch_c(self) -> int:
|
||||
return max(self.batch_a, self.batch_b)
|
||||
|
||||
Reference in New Issue
Block a user