You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(lammps): skip ghost-node work in fused DPA4C inference - #6160
Use a bucketed host-side local-node count to bound local readout and backward work for single-block compressed canonical DPA4C models. Keep the ghost contributions required for neighbor forces and allow CUDA graph reuse across changes in local ownership.
Two A800 GPUs, two MPI ranks, 4,096 carbon atoms, NVE. Each measurement used 20 warm-up and 80 timed steps. Values are median ms per MD step across three alternating baseline and patched runs.
Model
Neighbor rebuild
Baseline
Patched
Nano
Default
1.049
0.909
Nano
Every 4 steps
1.353
1.201
Plus
Default
3.178
2.232
Plus
Every 4 steps
3.369
2.481
22 C++ tests passed. Direct C API comparisons matched energy, forces and virial while retaining nonzero ghost forces. In a separate three-frame case with 13 atoms crossing a rank boundary and returning, the maximum force differences were zero for Nano and 1.68e-5 eV/Å for Plus. For Plus, the maximum total-energy difference was 0.00171 eV over the 4,096 atoms and the maximum system virial component difference was 0.00901 eV.
No actionable comments were generated in the recent review.
Walkthrough
The changes add bucketed row extents for canonical graphs with ghost nodes. Eligible short-range domains can use a separate graph replay runner. The Kokkos pair path passes the padded row count, and tests cover owned-count changes and energy output bounds.
LocalNodeExtent tracks a scoped row bound. The fused operator uses it to select the owned-node extent and to clear output buffers when rows extend beyond that extent.
Canonical graph construction can pad rows and return the row count. The Kokkos pair path uses that count for canonical inference and force and atomic-virial buffers.
DeepPotPTExpt selects a row bucket for eligible domains and uses a separate replay runner and internal energy buffer. It copies the owned energies to the caller. Tests cover owned-count changes and ensure an extra output slot remains unchanged.
This change bounds local readout and backward work for fused DPA4C inference to a bucketed owned-node count and allows CUDA graph replay to be reused when ownership changes. No concrete defect was established in review. Merge-readiness risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the perf(lammps) scope and the goal of skipping ghost-node work in fused DPA4C inference. The changeset adds bucketed local-node counts, a LocalNodeExtent helper, and the graph-replay …
Linked Issues check
Issue #6091 is the only active direct link. Its coding requirements are: (1) pass host-known nlocal to the fused DPA4C operator; (2) round nlocal up to a bucket and mask padded rows; (3) include the b…
Out of Scope Changes check
All listed changes connect to the objective of bounding local readout and backward work with a bucketed host-side count. DeepPotPTExpt.h/.cc add the state, bucket logic and separate replay runner for …
Full details: Title check
Explanation
The title names the perf(lammps) scope and the goal of skipping ghost-node work in fused DPA4C inference. The changeset adds bucketed local-node counts, a LocalNodeExtent helper, and the graph-replay and build changes that bound readout and backward work to owned nodes. Those edits match the title's main point. The title is specific enough for a reviewer scanning history. Its length (59 characters) is within normal limits.
Full details: Linked Issues check
Explanation
Issue #6091 is the only active direct link. Its coding requirements are: (1) pass host-known nlocal to the fused DPA4C operator; (2) round nlocal up to a bucket and mask padded rows; (3) include the bucket in the CUDA graph replay key; (4) launch readout, fitting and node-backward over the bucketed count; (5) keep graph replay across neighbor-list rebuilds while the bucket is unchanged. The summary shows these changes. DeepPotPTExpt.cc rounds the owned-node count to a 256-row bucket capped at nall_nodes, and includes domain and bucket size in the replay key. It updates the owned-node count outside capture. graph_compress.cu evaluates the node count through LocalNodeExtent::lookup(n_local, halo.owned) for the single-block energy-force path. compact_canonical_graph_kokkos.h pads node capacity with type -1 rows. pair_deepmd_kokkos.cpp sizes force and virial buffers to the bucketed row count. Ghost contributions for neighbor forces are kept, as the issue requires. Two deviations exist. First, nlocal reaches the operator through a thread-local LocalNodeExtent, not a new C API parameter. Second, the PR adds no new entry point or API version bump. The issue requires these only because it assumes a signature change, and the PR declares no public signature change. The reported tests (22 C++ tests, direct C API comparisons, and the 13-atom rank-crossing case) support correctness. The benchmark values differ in scale from the issue estimates. Those values are not coding requirements.
Full details: Out of Scope Changes check
Explanation
All listed changes connect to the objective of bounding local readout and backward work with a bucketed host-side count. DeepPotPTExpt.h/.cc add the state, bucket logic and separate replay runner for short-range canonical domains with halo nodes. Charge-state invalidation of both replay runners supports correct replay with the new key. local_node_extent.h/.cc supply the host count to the operator. compact_canonical_graph_kokkos adds node padding. pair_deepmd_kokkos sizes buffers to the bucketed row count. graph_compress.cu applies the bounded extent and clears buffers when the extent is smaller than the total node count. The dpa4c_canonical_test_common.h changes test the bucket, owned-count change, and replay behavior. Noncanonical edge paths keep the full node count, which keeps the change limited to the target path. No change was found that lacks a connection to #6091. This assessment is based on the change summary and was not confirmed by a full diff read.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: c169c4ce-f6d4-45a2-9eb3-5c7b3c2a14d6
Commits
Reviewing files that changed from the base of the PR and between ed85942 and 77a7295.
Files selected for processing: 8
source/api_cc/include/DeepPotPTExpt.h
source/api_cc/src/DeepPotPTExpt.cc
source/api_cc/tests/dpa4c_canonical_test_common.h
source/lib/include/local_node_extent.h
source/lib/src/local_node_extent.cc
source/lmp/compact_canonical_graph_kokkos.h
source/lmp/pair_deepmd_kokkos.cpp
source/op/pt/dpa4c/graph_compress.cu
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.
This branch has not been deployed
No deployments
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
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.
Use a bucketed host-side local-node count to bound local readout and backward work for single-block compressed canonical DPA4C models. Keep the ghost contributions required for neighbor forces and allow CUDA graph reuse across changes in local ownership.
Two A800 GPUs, two MPI ranks, 4,096 carbon atoms, NVE. Each measurement used 20 warm-up and 80 timed steps. Values are median ms per MD step across three alternating baseline and patched runs.
22 C++ tests passed. Direct C API comparisons matched energy, forces and virial while retaining nonzero ghost forces. In a separate three-frame case with 13 atoms crossing a rank boundary and returning, the maximum force differences were zero for Nano and 1.68e-5 eV/Å for Plus. For Plus, the maximum total-energy difference was 0.00171 eV over the 4,096 atoms and the maximum system virial component difference was 0.00901 eV.
Closes #6091.
Summary by CodeRabbit