[WIP] CI: split test into 4 parallel shards - #68
Open
cennn wants to merge 7 commits into
Open
Conversation
Split the monolithic test job (~39 min) into 4 independent shards: - test-perf: perf_tests (timing-sensitive, isolated for rerun) - test-api: api_tests + model_tests (heavy torch.compile) - test-feature: feature_tests + torch_native_tests (FSDP/cache/mixed) - test-depyf: magi_depyf (mostly CPU bytecode roundtrips) All 4 shards run in parallel after build, each with 25-min timeout. With 4 runners, wall-clock test time drops from ~39 min to ~15 min.
Replace 4 copy-pasted test jobs with a single matrix job (fail-fast: false). Restore env-check diagnostic output (PT version, CUDA version, GPU name).
…tion Reorganize tests/feature_tests/ into logical subdirectories: - fsdp/: FSDP overlap tests + torchrun subprocess helpers - cache/: cache invariant, topology, artifact, build cleanup - pass/: inductor passes, CUTLASS fusion, conv channels-last All moves use git mv (pure rename, 0 code changes). Helpers use Path(__file__).parent so relative paths remain correct. CI matrix expanded from 4 to 7 shards: perf, api, feature-fsdp, feature-cache, feature-pass, feature-runtime, depyf. Each shard auto-selects the least-loaded GPU via nvidia-smi at startup (CUDA_VISIBLE_DEVICES) to minimise contention when multiple shards land on the same physical runner.
FSDP overlap e2e/reorder and profiling collective tests use torchrun --nproc_per_node=2, requiring 2 visible GPUs. Previous single-GPU selection would cause these tests to skip or fail.
test_register_custom_op.py alone has 88 tests and is the heaviest file in api_tests. Splitting gives better load balance across runners.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
动机
当前 CI 每个 PyTorch 版本的 test job 耗时约 39 分钟(单个
pytest -v tests/),是整个 pipeline 的瓶颈。现有 4 个 runner 但只用了 1 个跑测试,利用率低。且feature_tests/下 23 个测试文件混杂在一起,功能边界不清,定位失败困难。核心改动
1. 重组
tests/feature_tests/为逻辑子目录(纯git mv,0 行代码改动)Helper 目录随 test 一起移动(
fsdp_overlap_helper/→fsdp/、cache_reuse_helper/→cache/),所有 helper 引用都用Path(__file__).parent / ...相对路径,移动后自动正确。2. CI matrix 从 1 → 7 个并行 shard
tests/perf_tests/tests/api_tests/+tests/model_tests/tests/feature_tests/fsdp/tests/feature_tests/cache/tests/feature_tests/pass/tests/feature_tests/(remaining) +tests/torch_native_tests/tests/magi_depyf/用
strategy.matrix实现,fail-fast: false保证不互相取消。3. 自动选卡:每个 shard 启动时
nvidia-smi查询显存占用最低的 GPU →CUDA_VISIBLE_DEVICES,多 shard 共享 runner 时减少 GPU 争抢。收益
文件变更
_ci_pipeline.yml:single test → 7-shard matrix + GPU auto-selecttests/feature_tests/:23 个 test 文件按功能归入fsdp//cache//pass/子目录,纯 rename 0 代码改动