|
18 | 18 | BLOCK_SIZES = [32, 128] |
19 | 19 | seed_everything(0) |
20 | 20 |
|
| 21 | +#override pytest parameters when enable mini pytest |
| 22 | +MINI_PYTEST_PARAMS = { |
| 23 | + "default": { |
| 24 | + "m": [1], |
| 25 | + "num_experts": [32], |
| 26 | + "topk": [1], |
| 27 | + "block_size": [32], |
| 28 | + "max_tokens_per_batch": [13] |
| 29 | + }, |
| 30 | +} |
| 31 | + |
21 | 32 |
|
22 | 33 | def _group_tokens_by_expert( |
23 | 34 | sorted_ids: torch.Tensor, |
@@ -281,9 +292,12 @@ def test_moe_align_block_size_with_expert_map(m: int, topk: int, |
281 | 292 | ) |
282 | 293 |
|
283 | 294 |
|
284 | | -def test_moe_align_block_size_deterministic(): |
285 | | - m, topk, num_experts, block_size = 128, 2, 32, 64 |
286 | | - |
| 295 | +@pytest.mark.parametrize("m", [128]) |
| 296 | +@pytest.mark.parametrize("topk", [2]) |
| 297 | +@pytest.mark.parametrize("num_experts", [32]) |
| 298 | +@pytest.mark.parametrize("block_size", [64]) |
| 299 | +def test_moe_align_block_size_deterministic(m: int, topk: int, |
| 300 | + num_experts: int, block_size: int): |
287 | 301 | torch.manual_seed(42) |
288 | 302 | topk_ids = torch.randint(0, |
289 | 303 | num_experts, (m, topk), |
@@ -435,11 +449,14 @@ def test_moe_align_block_size_opcheck(): |
435 | 449 | ) |
436 | 450 |
|
437 | 451 |
|
438 | | -def test_batched_moe_align_block_size_opcheck(): |
439 | | - max_tokens_per_batch = 512 |
440 | | - num_experts = 4 |
441 | | - block_size = 16 |
442 | | - |
| 452 | +@pytest.mark.parametrize("max_tokens_per_batch", [512]) |
| 453 | +@pytest.mark.parametrize("num_experts", [4]) |
| 454 | +@pytest.mark.parametrize("block_size", [16]) |
| 455 | +def test_batched_moe_align_block_size_opcheck( |
| 456 | + max_tokens_per_batch: int, |
| 457 | + num_experts: int, |
| 458 | + block_size: int, |
| 459 | +): |
443 | 460 | expert_num_tokens = torch.randint( |
444 | 461 | low=0, |
445 | 462 | high=max_tokens_per_batch, |
|
0 commit comments