Skip to content

Commit 2fdf274

Browse files
committed
better reason strings
Signed-off-by: Bill Nell <bnell@redhat.com>
1 parent 0e217d2 commit 2fdf274

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

tests/kernels/moe/modular_kernel_tools/common.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,17 +229,21 @@ def is_valid(self) -> tuple[bool, Optional[str]]:
229229
+ int(self.quant_block_shape is not None)
230230
) > 1:
231231
# invalid quant config
232-
return False, "Bad quant_config."
232+
return False, f"Bad quant_config {self.quant_config}."
233233

234234
# check type support
235235
if self.quant_dtype is None:
236236
if (self.dtype not in self.pf_supported_types()
237237
or self.dtype not in self.fe_supported_types()):
238-
return False, "Unsupported type 1."
238+
return False, (f"Unsupported type {self.dtype} not in "
239+
f"{self.pf_supported_types()} and "
240+
f"{self.fe_supported_types()}.")
239241
else:
240242
if (self.quant_dtype not in self.pf_supported_types()
241243
or self.quant_dtype not in self.fe_supported_types()):
242-
return False, "Unsupported type 2."
244+
return False, (f"Unsupported quant type {self.quant_dtype} "
245+
f"not in {self.pf_supported_types()} and "
246+
f"{self.fe_supported_types()}.")
243247

244248
# Check block quanization support
245249
is_block_quatized = self.quant_block_shape is not None
@@ -255,11 +259,11 @@ def is_valid(self) -> tuple[bool, Optional[str]]:
255259

256260
# Check dependencies (turn into asserts?)
257261
if self.needs_deep_ep() and not has_deep_ep():
258-
return False, "Needs DeepEP."
262+
return False, "Needs DeepEP, but DeepEP not available."
259263
if self.needs_deep_gemm() and not has_deep_gemm():
260-
return False, "Needs DeepGEMM."
264+
return False, "Needs DeepGEMM, but DeepGEMM not available."
261265
if self.needs_pplx() and not has_pplx(): # noqa: SIM103
262-
return False, "Needs PPLX."
266+
return False, "Needs PPLX, but PPLX not available."
263267

264268
return True, None
265269

tests/kernels/moe/test_modular_kernel_combinations.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,15 @@ def is_nyi_config(config: Config) -> bool:
168168
def generate_valid_test_cases(world_size: int,
169169
prepare_finalize_types) -> list[tuple[Any, ...]]:
170170
cases = []
171+
total = 0
171172

172173
for k, n, e, dtype, quant_config, combination, chunk_size in product(
173174
Ks, Ns, Es, DTYPEs, MK_QUANT_CONFIGS,
174175
product(prepare_finalize_types, MK_FUSED_EXPERT_TYPES),
175176
FUSED_MOE_CHUNK_SIZEs):
176177

178+
total = total + 1
179+
177180
config = Config(
178181
Ms=Ms,
179182
K=k,
@@ -188,24 +191,26 @@ def generate_valid_test_cases(world_size: int,
188191
world_size=world_size,
189192
)
190193

191-
# TODO
194+
# TODO(bnell): figure out how to get verbose flag here.
192195
verbose = False #pytestconfig.getoption('verbose') > 0
193196

194197
valid, reason = config.is_valid()
195198

196199
if not valid:
197200
if verbose:
198-
print(f"Tests config {config} is not valid: {reason}")
201+
print(f"Test config {config} is not valid: {reason}")
199202
continue
200203

201204
if is_nyi_config(config):
202205
if verbose:
203-
print(f"Tests config {config} is nyi.")
206+
print(f"Test config {config} is nyi.")
204207
continue
205208

206209
cases.append((k, n, e, dtype, quant_config, combination[0],
207210
combination[1], chunk_size, world_size))
208211

212+
print(f"{len(cases)} of {total} valid configs generated.")
213+
209214
return cases
210215

211216

0 commit comments

Comments
 (0)