fix(tf): honor NVNMD tensor neighbor lists#5845
Conversation
📝 WalkthroughWalkthroughNVNMD CPU environment-matrix operations now parse neighbor lists from mesh tensors for ChangesNVNMD tensor neighbor-list handling
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Test
participant ProdEnvMatNVNMD
participant _prepare_coord_nlist_cpu
participant _prepare_mesh_nlist_cpu
Test->>ProdEnvMatNVNMD: provide mesh tensor and nei_mode 4
ProdEnvMatNVNMD->>_prepare_coord_nlist_cpu: pass mesh data and size
_prepare_coord_nlist_cpu->>_prepare_mesh_nlist_cpu: parse and validate mesh list
_prepare_mesh_nlist_cpu-->>_prepare_coord_nlist_cpu: return neighbor-list data or error
_prepare_coord_nlist_cpu-->>ProdEnvMatNVNMD: return status
ProdEnvMatNVNMD-->>Test: return environment-matrix result or InvalidArgumentError
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
83da73e to
74c0cd2
Compare
Parse and validate mode-4 mesh tensors instead of rebuilding their neighbor lists in the NVNMD environment-matrix operators. Reject truncated lists, invalid local indices, and neighbor indices outside the current frame before downstream coordinate or type access. Cover both operator variants, malformed tensor input, and positive out-of-range neighbor indices. Coding-Agent: Codex Codex-Version: codex-cli 0.144.4 Model: gpt-5.6-sol Reasoning-Effort: xhigh
74c0cd2 to
29cc7b5
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5845 +/- ##
==========================================
- Coverage 78.58% 78.31% -0.27%
==========================================
Files 1050 1050
Lines 120637 120672 +35
Branches 4356 4367 +11
==========================================
- Hits 94801 94510 -291
- Misses 24278 24582 +304
- Partials 1558 1580 +22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Why existing tests missed this
Existing NVNMD entrypoint tests only exercised self-built neighbor lists with 0-, 1-, 6-, or 7-element meshes. No NVNMD env-mat test passed a mesh larger than 16 elements, no malformed test supplied a nonnegative index beyond
nall, and no caller-provided list intentionally differed from the distance-built list. In normal inference paths those two lists are usually identical, so rebuilding the list produced plausible output and hid the bug.Validation
cmake --build source/build --target deepmd_op -j2TestOpProdEnvMatNvnmdTensorNlist(5 passed), including a positive out-of-range neighbor indexruff format .ruff check .git diff --checkFixes #5652
Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh
Summary by CodeRabbit
New Features
Bug Fixes
Tests