Commit 9bc4eb5
authored
feat(dpa1): add compressible l=2 moments across PT backends (deepmodeling#5911)
## Summary
- Add compressible `l=2` moment features across the DPA1 PyTorch
backends.
- Extend the DPA1/SeAtten descriptor, Triton and CUDA graph kernels,
tabulation paths, and graph energy/force handling for the new moment
basis.
- Keep the regular PyTorch and `pt_expt` descriptor paths aligned with
the compressed implementation.
- Correct compressed DPA1/SeAtten evaluation with `exclude_types` by
honoring unsorted neighbor lists throughout tabulation.
- Update argument validation, documentation, serialization versioning,
and backend-specific tests for the new functionality.
## Motivation
The DPA1 compressed path previously lacked the `l=2` moment basis and
corresponding PT-backend coverage. This change supplies the missing
basis and propagates it through descriptor construction, compression,
graph execution, tabulation, and force/energy evaluation so compressed
and regular paths can represent the same angular information.
## Validation
- All pre-commit hooks passed.
- The focused pure-Python DPA1/DPModel tests passed (`12 passed`,
including 6 subtests).
- The selected compressed CPU custom-op tests passed (`29 passed`, 19
skipped).
- The extended component-basis CPU operator tests passed (`2 passed`,
including 6 subtests).
- The handwritten `l=2/3/4` CUDA VJP formulas were checked numerically
against PyTorch autograd with maximum absolute error below `9e-15`; CUDA
compilation/runtime was not available on the macOS review host.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added configurable `lmax` (1–4) for DPA1/SE-attention, expanding the
moment basis size (4/9/16/25) and enabling learnable higher-order
per-degree degree weighting.
* Updated CPU/CUDA/Triton fused descriptor paths to use the expanded
basis (`basis_dim`) and to thread the per-degree gain through
forward/backward computations.
* **Bug Fixes**
* Improved serialization/deserialization to preserve `lmax` and
higher-order degree-gain parameters reliably across reloads.
* **Documentation**
* Documented `lmax`/basis-dimension behavior and clarified higher-order
execution constraints and experimental high-`lmax` routing.
* **Tests**
* Added/extended unit and parity tests for higher `lmax`, serialization,
and coordinate-derivative validation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 15f4437 commit 9bc4eb5
47 files changed
Lines changed: 5109 additions & 2167 deletions
File tree
- deepmd
- dpmodel/descriptor
- kernels
- cuda/dpa1
- triton/dpa1
- pt_expt/descriptor
- pt/model/descriptor
- utils
- doc/model
- source
- lib
- include
- src
- gpu
- op/pt
- tests
- common/dpmodel
- pt_expt/descriptor
- pt
- model
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
| |||
158 | 161 | | |
159 | 162 | | |
160 | 163 | | |
| 164 | + | |
161 | 165 | | |
162 | 166 | | |
163 | 167 | | |
| |||
195 | 199 | | |
196 | 200 | | |
197 | 201 | | |
| 202 | + | |
198 | 203 | | |
199 | 204 | | |
200 | 205 | | |
| |||
204 | 209 | | |
205 | 210 | | |
206 | 211 | | |
207 | | - | |
| 212 | + | |
208 | 213 | | |
209 | 214 | | |
210 | 215 | | |
| |||
246 | 251 | | |
247 | 252 | | |
248 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
249 | 259 | | |
250 | 260 | | |
251 | 261 | | |
| |||
282 | 292 | | |
283 | 293 | | |
284 | 294 | | |
285 | | - | |
| 295 | + | |
286 | 296 | | |
287 | 297 | | |
288 | 298 | | |
| |||
295 | 305 | | |
296 | 306 | | |
297 | 307 | | |
| 308 | + | |
298 | 309 | | |
299 | 310 | | |
300 | 311 | | |
301 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
302 | 318 | | |
303 | 319 | | |
304 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| 97 | + | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| |||
117 | 120 | | |
118 | 121 | | |
119 | 122 | | |
120 | | - | |
| 123 | + | |
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
| |||
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
| 137 | + | |
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
| |||
155 | 159 | | |
156 | 160 | | |
157 | 161 | | |
| 162 | + | |
158 | 163 | | |
159 | 164 | | |
160 | 165 | | |
| |||
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
221 | | - | |
| 226 | + | |
222 | 227 | | |
223 | | - | |
| 228 | + | |
224 | 229 | | |
225 | 230 | | |
226 | 231 | | |
| |||
245 | 250 | | |
246 | 251 | | |
247 | 252 | | |
248 | | - | |
| 253 | + | |
249 | 254 | | |
250 | | - | |
| 255 | + | |
251 | 256 | | |
252 | 257 | | |
253 | 258 | | |
| |||
329 | 334 | | |
330 | 335 | | |
331 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
332 | 342 | | |
333 | 343 | | |
334 | 344 | | |
| |||
346 | 356 | | |
347 | 357 | | |
348 | 358 | | |
| 359 | + | |
349 | 360 | | |
350 | 361 | | |
351 | 362 | | |
| |||
362 | 373 | | |
363 | 374 | | |
364 | 375 | | |
| 376 | + | |
365 | 377 | | |
366 | 378 | | |
367 | 379 | | |
| |||
426 | 438 | | |
427 | 439 | | |
428 | 440 | | |
| 441 | + | |
429 | 442 | | |
430 | 443 | | |
431 | 444 | | |
| |||
0 commit comments