Skip to content

Commit 1f2bde0

Browse files
committed
better reason strings
Signed-off-by: Bill Nell <bnell@redhat.com>
1 parent 122591f commit 1f2bde0

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
@@ -215,17 +215,21 @@ def is_valid(self) -> tuple[bool, Optional[str]]:
215215
int(self.is_per_tensor_act_quant) +
216216
int(self.quant_block_shape is not None)) > 1:
217217
# invalid quant config
218-
return False, "Bad quant_config."
218+
return False, f"Bad quant_config {self.quant_config}."
219219

220220
# check type support
221221
if self.quant_dtype is None:
222222
if (self.dtype not in self.pf_supported_types()
223223
or self.dtype not in self.fe_supported_types()):
224-
return False, "Unsupported type 1."
224+
return False, (f"Unsupported type {self.dtype} not in "
225+
f"{self.pf_supported_types()} and "
226+
f"{self.fe_supported_types()}.")
225227
else:
226228
if (self.quant_dtype not in self.pf_supported_types()
227229
or self.quant_dtype not in self.fe_supported_types()):
228-
return False, "Unsupported type 2."
230+
return False, (f"Unsupported quant type {self.quant_dtype} "
231+
f"not in {self.pf_supported_types()} and "
232+
f"{self.fe_supported_types()}.")
229233

230234
# Check block quanization support
231235
is_block_quatized = self.quant_block_shape is not None
@@ -241,11 +245,11 @@ def is_valid(self) -> tuple[bool, Optional[str]]:
241245

242246
# Check dependencies (turn into asserts?)
243247
if self.needs_deep_ep() and not has_deep_ep():
244-
return False, "Needs DeepEP."
248+
return False, "Needs DeepEP, but DeepEP not available."
245249
if self.needs_deep_gemm() and not has_deep_gemm():
246-
return False, "Needs DeepGEMM."
250+
return False, "Needs DeepGEMM, but DeepGEMM not available."
247251
if self.needs_pplx() and not has_pplx(): # noqa: SIM103
248-
return False, "Needs PPLX."
252+
return False, "Needs PPLX, but PPLX not available."
249253

250254
return True, None
251255

tests/kernels/moe/test_modular_kernel_combinations.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,15 @@ def is_nyi_config(config: Config) -> bool:
160160
def generate_valid_test_cases(world_size: int,
161161
prepare_finalize_types) -> list[tuple[Any, ...]]:
162162
cases = []
163+
total = 0
163164

164165
for k, n, e, dtype, quant_config, combination, chunk_size in product(
165166
Ks, Ns, Es, DTYPEs, MK_QUANT_CONFIGS,
166167
product(prepare_finalize_types, MK_FUSED_EXPERT_TYPES),
167168
FUSED_MOE_CHUNK_SIZEs):
168169

170+
total = total + 1
171+
169172
config = Config(
170173
Ms=Ms,
171174
K=k,
@@ -180,24 +183,26 @@ def generate_valid_test_cases(world_size: int,
180183
world_size=world_size,
181184
)
182185

183-
# TODO
186+
# TODO(bnell): figure out how to get verbose flag here.
184187
verbose = False #pytestconfig.getoption('verbose') > 0
185188

186189
valid, reason = config.is_valid()
187190

188191
if not valid:
189192
if verbose:
190-
print(f"Tests config {config} is not valid: {reason}")
193+
print(f"Test config {config} is not valid: {reason}")
191194
continue
192195

193196
if is_nyi_config(config):
194197
if verbose:
195-
print(f"Tests config {config} is nyi.")
198+
print(f"Test config {config} is nyi.")
196199
continue
197200

198201
cases.append((k, n, e, dtype, quant_config, combination[0],
199202
combination[1], chunk_size, world_size))
200203

204+
print(f"{len(cases)} of {total} valid configs generated.")
205+
201206
return cases
202207

203208

0 commit comments

Comments
 (0)