Commit adf5b83
perf(test): reduce redundant .pt2 compilations in GPU CI (#5379)
## Summary
- **Strategy 1**: Share frozen `.pt2`/`.pte` in `setUpClass` for
`test_dp_freeze.py` and `test_change_bias.py`, avoiding redundant
AOTInductor compilations (~82s each)
- **Strategy 2**: Remove `test_min_nbor_dist_roundtrip_pt2` — `.pte`
test already covers the same metadata round-trip path (identical
`metadata.json` in ZIP)
- **Strategy 3**: Move `dp.init()` from per-test `SetUp()` to static
`SetUpTestSuite()` in 9 C++ test files, loading each model once per
typed test suite instead of once per test
- **Strategy 4**: Parallelize 6 gen scripts in `test_cc_local.sh` (2
groups of 3 with PID-based error propagation)
- **Cleanup**: Remove stale `.pt2`/`.pte` files before regeneration so
outdated model files cannot be accidentally reused
## Benchmark (V100-SXM2-16GB, torch 2.10)
| Test | Before | After | Saving |
|------|--------|-------|--------|
| test_dp_freeze.py | 536s | 299s | 237s (44%) |
| test_change_bias.py | 495s | 460s | 35s (7%) |
| C++ PtExpt tests | 467s | 71s | 396s (85%) |
| **Total measured** | **1498s** | **830s** | **668s (11 min)** |
Strategy 4 (parallel gen scripts) saves additional build-phase time
(~200s estimated).
## Test plan
- [x] `python -m pytest source/tests/pt_expt/test_dp_freeze.py -v` — 7/7
passed
- [x] `python -m pytest source/tests/pt_expt/test_change_bias.py -v` —
11/11 passed
- [x] C++ PtExpt tests (`runUnitTests_cc --gtest_filter='*PtExpt*'`) —
128/128 passed
- [ ] Full CI pass
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Tests**
* Fixtures now share model instances across test cases and
initialize/reset them once per suite, reducing per-test overhead and
adjusting skip behavior when optional backends aren’t present.
* Python tests now reuse pre-generated frozen artifacts across tests
instead of regenerating per-test.
* Removed a redundant metadata round-trip unit test.
* **Chores**
* Model-generation script now cleans stale artifacts and runs generation
tasks in parallel to speed setup.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>1 parent efc27cf commit adf5b83
File tree
13 files changed
+355
-175
lines changed- source
- api_cc/tests
- install
- tests/pt_expt
- model
13 files changed
+355
-175
lines changedLines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
116 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
117 | 124 | | |
118 | 125 | | |
119 | | - | |
| 126 | + | |
120 | 127 | | |
121 | 128 | | |
122 | | - | |
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
| |||
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
| 151 | + | |
| 152 | + | |
145 | 153 | | |
146 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
147 | 158 | | |
148 | 159 | | |
149 | 160 | | |
| |||
Lines changed: 27 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | | - | |
| 86 | + | |
80 | 87 | | |
81 | 88 | | |
82 | | - | |
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
| |||
98 | 104 | | |
99 | 105 | | |
100 | 106 | | |
| 107 | + | |
| 108 | + | |
101 | 109 | | |
102 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
103 | 114 | | |
104 | 115 | | |
105 | 116 | | |
| |||
325 | 336 | | |
326 | 337 | | |
327 | 338 | | |
328 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
329 | 346 | | |
330 | 347 | | |
331 | | - | |
| 348 | + | |
332 | 349 | | |
333 | 350 | | |
334 | | - | |
335 | 351 | | |
336 | 352 | | |
337 | 353 | | |
| 354 | + | |
| 355 | + | |
338 | 356 | | |
339 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
340 | 361 | | |
341 | 362 | | |
342 | 363 | | |
| |||
Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | | - | |
| 91 | + | |
85 | 92 | | |
86 | 93 | | |
87 | | - | |
88 | 94 | | |
89 | 95 | | |
90 | 96 | | |
| |||
103 | 109 | | |
104 | 110 | | |
105 | 111 | | |
| 112 | + | |
| 113 | + | |
106 | 114 | | |
107 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
108 | 119 | | |
109 | 120 | | |
110 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
76 | 83 | | |
77 | 84 | | |
78 | | - | |
| 85 | + | |
79 | 86 | | |
80 | 87 | | |
81 | | - | |
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
| |||
97 | 103 | | |
98 | 104 | | |
99 | 105 | | |
| 106 | + | |
| 107 | + | |
100 | 108 | | |
101 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
| |||
218 | 229 | | |
219 | 230 | | |
220 | 231 | | |
221 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
222 | 239 | | |
223 | 240 | | |
224 | | - | |
| 241 | + | |
225 | 242 | | |
226 | 243 | | |
227 | | - | |
228 | 244 | | |
229 | 245 | | |
230 | 246 | | |
| |||
243 | 259 | | |
244 | 260 | | |
245 | 261 | | |
| 262 | + | |
| 263 | + | |
246 | 264 | | |
247 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
248 | 269 | | |
249 | 270 | | |
250 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
75 | 82 | | |
76 | 83 | | |
77 | | - | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | | - | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
| |||
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| 105 | + | |
| 106 | + | |
99 | 107 | | |
100 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
101 | 112 | | |
102 | 113 | | |
103 | 114 | | |
| |||
492 | 503 | | |
493 | 504 | | |
494 | 505 | | |
495 | | - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
496 | 513 | | |
497 | 514 | | |
498 | | - | |
| 515 | + | |
499 | 516 | | |
500 | 517 | | |
501 | | - | |
502 | 518 | | |
503 | 519 | | |
504 | 520 | | |
| |||
517 | 533 | | |
518 | 534 | | |
519 | 535 | | |
| 536 | + | |
| 537 | + | |
520 | 538 | | |
521 | 539 | | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
522 | 543 | | |
523 | 544 | | |
524 | 545 | | |
| |||
0 commit comments