Commit a9061cd
Han Wang
fix(pt_expt): trace graph lower on the model's device; fix CUDA test device placement
The graph-lower compile/export path traces the model on CPU (make_fx keeps real
parameters, and the export path moves the model to CPU to dodge a CUDA
autograd-stream limitation). _trace_and_compile_graph built its synthetic trace
inputs on the global DEVICE instead, so on a GPU host it mixed a CPU model with
CUDA inputs and failed make_fx tracing. Build the synthetic inputs on the model's
own device. (No effect on CUDA training, where the model already lives on DEVICE.)
The graph-export tests then run the exported program, which _trace_and_export
moves to env.DEVICE via move_to_device_pass, but fed it CPU inputs and compared
against a CPU eager model. Place the graph inputs (and the eager reference) on
env.DEVICE; the with-comm host control tensors stay on CPU by design. Also read
the CUDA repinit.mean stats buffer through .detach().cpu() before np.asarray, and
relax the escape-hatch force check to CUDA scatter-add reduction-order noise
(energy stays bit-exact). All CPU-only, so the CPU CI never exercised these paths.1 parent 13b098b commit a9061cd
4 files changed
Lines changed: 52 additions & 19 deletions
File tree
- deepmd/pt_expt/train
- source/tests/pt_expt/model
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
691 | 691 | | |
692 | 692 | | |
693 | 693 | | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
694 | 702 | | |
695 | 703 | | |
696 | 704 | | |
697 | 705 | | |
698 | 706 | | |
699 | | - | |
| 707 | + | |
700 | 708 | | |
701 | 709 | | |
702 | 710 | | |
| |||
705 | 713 | | |
706 | 714 | | |
707 | 715 | | |
708 | | - | |
| 716 | + | |
709 | 717 | | |
710 | 718 | | |
711 | 719 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
330 | 334 | | |
331 | 335 | | |
332 | 336 | | |
333 | 337 | | |
334 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
335 | 342 | | |
336 | 343 | | |
337 | 344 | | |
| |||
745 | 752 | | |
746 | 753 | | |
747 | 754 | | |
748 | | - | |
| 755 | + | |
749 | 756 | | |
750 | 757 | | |
751 | 758 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
163 | 166 | | |
164 | 167 | | |
165 | 168 | | |
| |||
171 | 174 | | |
172 | 175 | | |
173 | 176 | | |
174 | | - | |
| 177 | + | |
175 | 178 | | |
176 | 179 | | |
177 | 180 | | |
| |||
191 | 194 | | |
192 | 195 | | |
193 | 196 | | |
194 | | - | |
195 | | - | |
196 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
| |||
Lines changed: 25 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
239 | 242 | | |
240 | 243 | | |
241 | 244 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
251 | 266 | | |
252 | 267 | | |
253 | 268 | | |
| |||
265 | 280 | | |
266 | 281 | | |
267 | 282 | | |
268 | | - | |
| 283 | + | |
269 | 284 | | |
270 | 285 | | |
271 | 286 | | |
| |||
0 commit comments