Support dependent axis auto-resolution in dump comparator (#21024)

This commit is contained in:
fzyzcjy
2026-03-20 21:56:39 +08:00
committed by GitHub
parent 2d7a262ca3
commit ecd7e40d20
7 changed files with 888 additions and 11 deletions
@@ -1935,6 +1935,56 @@ class TestEntrypointReplicatedAxis:
assert isinstance(summary, SummaryRecord)
assert summary.failed == 1
def test_sharded_tp_with_dependent_etp_passes(self, tmp_path, capsys):
"""TP2 sharded + ETP2 dependent (etp=tp) + EP2 replicated → no undeclared error."""
torch.manual_seed(42)
full_tensor = torch.randn(2, 4, 8)
tp_shards = list(full_tensor.chunk(2, dim=1))
baseline_dir = tmp_path / "baseline"
target_dir = tmp_path / "target"
for side_dir in [baseline_dir, target_dir]:
rank = 0
for tp_rank in range(2):
for ep_rank in range(2):
_create_rank_dump(
side_dir,
rank=rank,
name="attn_v",
tensor=tp_shards[tp_rank],
dims="b num_kv_heads[tp] d # ep:replicated",
parallel_info={
"tp_rank": tp_rank,
"tp_size": 2,
"etp_rank": tp_rank,
"etp_size": 2,
"ep_rank": ep_rank,
"ep_size": 2,
},
)
rank += 1
argv = _make_argv(
baseline_dir / _FIXED_EXP_NAME,
target_dir / _FIXED_EXP_NAME,
diff_threshold=0.01,
)
records, exit_code = _run_and_parse(argv, capsys)
errors = [r for r in records if isinstance(r, ComparisonErrorRecord)]
assert len(errors) == 0, f"Unexpected errors: {errors}"
comp = _assert_single_comparison_passed(records)
assert comp.errors == []
summary = records[-1]
assert isinstance(summary, SummaryRecord)
assert summary.passed == 1
assert summary.errored == 0
assert exit_code == 0
class TestEntrypointAlignment:
"""Test smart token alignment with aux tensors."""