Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
8bea38f
feat(dpmodel): segment_max/segment_softmax over trailing feature dims
Jul 12, 2026
ba95854
feat(dpmodel): repformer graph twins for cal_hg/cal_grrg/symmetrizati…
Jul 12, 2026
79dc371
feat(dpmodel): repformer layer graph twins for g1_conv / g2_g1g1
Jul 12, 2026
b513622
refactor(dpmodel): graph-twin naming convention <func_name>_graph
Jul 12, 2026
2c32acc
feat(dpmodel): graph twins for repformer attention ops
Jul 12, 2026
83babe4
feat(dpmodel): RepformerLayer.call_graph
Jul 12, 2026
b75374f
test(dpmodel): cover update_chnnl_2=False and cal_gg1=None in Repform…
Jul 12, 2026
a1e00c3
feat(dpmodel): DescrptBlockRepformers.call_graph + exchange seam
Jul 12, 2026
3b89378
feat(dpmodel): graph-native DPA2 (uses_graph_lower, call_graph, dense…
Jul 12, 2026
21a4ee1
test(dpmodel): pin dpa2 adapter davg-nonzero divergence; exercise rea…
Jul 12, 2026
9fbe20d
docs(dpmodel): correct davg-residual root-cause framing in dpa2 call_…
Jul 12, 2026
69f4c4b
feat(pt_expt): dpa2 graph lower routing tests + border_op graph exchange
Jul 12, 2026
6c7c7f4
test(pt_expt): pin repformer parallel test to the dense route
Jul 12, 2026
b08304d
feat(dpmodel,pt_expt): owned-node (n_local) energy mask in graph outp…
Jul 12, 2026
650b715
feat(pt_expt): with-comm graph .pt2 artifact for message-passing models
Jul 12, 2026
99d714e
test(cc): dpa2 graph .pt2 fixtures + universal gtest row
Jul 12, 2026
c9e91ae
feat(cc): multi-rank message-passing graph route (run_model_graph_wit…
Jul 12, 2026
fef2d53
fix(cc): fail loudly on empty rank in MP graph route; fix stale comment
Jul 12, 2026
83179f1
test(lmp): dpa2 graph LAMMPS single- and multi-rank tests
Jul 12, 2026
b0fe611
fix(cc): put nlocal/nghost comm tensors on model device for graph wit…
Jul 12, 2026
6d7e151
docs: DPA-2 graph-native inference route (pt_expt)
Jul 12, 2026
1e9c15b
test(lmp): scale dpa2 MP virial tolerance; bound empty-rank deadlock …
Jul 13, 2026
966d378
fix(pt_expt): derive graph-trace device from model params, not global…
Jul 13, 2026
9a365e3
test(pt_expt): dpa2 joins KNOWN_GRAPH_DENSE_DIVERGENT in default-fall…
Jul 13, 2026
854d654
test(pt_expt): per-model divergence envelopes in default-fallback test
Jul 13, 2026
2e49936
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2026
1e5cd13
style: fix ruff C408/B905 in repformer graph-ops test
Jul 13, 2026
bc0d70a
fix(dpmodel): dpa2 dense call must not route through divergent graph …
Jul 13, 2026
778a4bc
test(dpa2): exclude AOTInductor graph .pt2 from LeakSanitizer build
Jul 13, 2026
37863e2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2026
10a359d
test(dpa2): make LSAN graph-section skip deterministic via explicit e…
Jul 13, 2026
c633186
docs(dpa2): note graph-route attention cutoff smoothness
Jul 13, 2026
2c29ace
feat(dpmodel): fixed-phantom-count smooth attention on the dpa2 graph…
Jul 13, 2026
4b96fdb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2026
b73302b
docs(dpmodel): numpydoc sections for the phantom-compensated attentio…
Jul 14, 2026
58c23e4
docs(dpmodel,pt_expt): numpydoc sections for all remaining PR-added m…
Jul 14, 2026
34370df
fix(pt_expt): collective empty-rank preflight + extended-axis aparam …
Jul 14, 2026
314a371
test(dpa2): address review nits (pairs=None coverage, dup fixture, No…
Jul 14, 2026
9e33f1c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
569dfd7
test(dpa2): tighten graph-vs-dense envelope post-compensation + prove…
Jul 14, 2026
1265c66
test(lammps): DPA2 graph empty-subdomain (nlocal=0, nghost>0) MP==SP …
Jul 14, 2026
a266a3b
docs(dpa2): document pt_expt eager/training default-flip + legacy esc…
Jul 14, 2026
ffbc655
feat(pt_expt): graph-native Hessian + fix fparam graph export/train (…
Jul 14, 2026
b048e23
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
2acc142
fix(pt_expt): derive graph trace edge_capacity from real edge count, …
Jul 14, 2026
37ce12d
fix(pt_expt,dpmodel): graph-lower aparam is flat (N, nda) on the node…
Jul 14, 2026
cc29057
fix(pt_expt): gate the graph default-flip to energy-output models
Jul 14, 2026
e95f2ba
fix(cc): graph aparam width + ghost-only-rank synthesis; bound all MP…
Jul 14, 2026
569d40c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
acc973d
perf(cc,pt_expt): cache empty-rank preflight on ago==0; split n_local…
Jul 14, 2026
a2496a0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
994813b
fix(pt_expt): persist disable_graph_lower across checkpoint restart
Jul 14, 2026
bb4d6c2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
ad0a954
fix(dpmodel): signed phantom count -- smooth graph attention for arbi…
Jul 14, 2026
95b3dee
fix(pt_expt): keep the graph-lower routing bool out of traced forward…
Jul 15, 2026
44ebdda
Merge master into feat-graph-dpa2 (integrate #5758 dpa1 graph CUDA re…
Jul 15, 2026
990053c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 15, 2026
41bbd49
fix(dpmodel,pt_expt): gate nonzero-mean dpa2 off the graph default; d…
Jul 15, 2026
bc90a20
style(pt_expt): explicit device on the graph_lower_disabled buffer init
Jul 15, 2026
d33ad3b
docs: use the LAMMPS-native 'ghost' terminology for the extended region
Jul 15, 2026
8248d4d
fix(dpmodel,cc): strictly positive phantom floor; device-edge flat ap…
Jul 15, 2026
643bb15
hardening(cc): assert the flat graph-route aparam contract at the run…
Jul 15, 2026
486b146
hardening: assert three latent invariants surfaced by the merge audit
Jul 15, 2026
3006793
fix(pt_expt): fold extended_virial in the compiled translate; documen…
Jul 15, 2026
5219119
fix(dpmodel): gate the phantom denominator floor to the negative-coun…
Jul 15, 2026
1a01380
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 15, 2026
017f861
fix(pt_expt): scope the Triton exclude_types veto to the graph dispatch
Jul 16, 2026
8011829
fix(dpmodel): soft slot-occupancy phantom denominator (positive AND c…
Jul 16, 2026
7e11d63
Merge branch 'feat-graph-dpa2' of github.com:wanghan-iapcm/deepmd-kit…
Jul 16, 2026
206810e
fix(dpmodel): make _slot_occupancy export-safe on the unbacked pair axis
Jul 16, 2026
04ad574
chore(tests): resolve CodeQL findings (import style, keepalive del)
Jul 16, 2026
8a1ac1f
fix(dpmodel): keep gradients off the water-filling cumsum (inductor u…
Jul 16, 2026
9ed7caf
test(pt_expt): move graph with-comm export tests next to the dense twin
Jul 16, 2026
dfd49ef
fix(dpmodel): C1 slot-occupancy denominator (no force kink at the bel…
Jul 16, 2026
002713d
fix(dpmodel): log-space chi -- no division by a subnormal ph_e in the…
Jul 16, 2026
96604dd
Merge upstream/master into feat-graph-dpa2
Jul 16, 2026
ad6e39f
fix(dpmodel): float64 cut selection in the water-filling; correct the…
Jul 16, 2026
652ace4
Merge branch 'master' into feat-graph-dpa2
OutisLi Jul 18, 2026
48ae340
fix: address CodeRabbit round-3 findings (MPI fence placement, LSAN s…
Jul 18, 2026
13b098b
Merge branch 'feat-graph-dpa2' of github.com:wanghan-iapcm/deepmd-kit…
Jul 18, 2026
ed4c1be
fix(pt_expt): trace graph lower on the model's device; fix CUDA test …
Jul 18, 2026
cfe9cb9
ci(cuda): raise Test CUDA job timeout to 480 min
Jul 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
test_cuda:
name: Test Python and C++ on CUDA
runs-on: gpu
# The full CUDA suite (serial pytest ~3h43m + C++ + LAMMPS) exceeds the
# default 360-min job limit; the self-hosted GPU runner has no hard cap.
timeout-minutes: 480
# https://github.com/deepmodeling/deepmd-kit/pull/2884#issuecomment-1744216845
# container:
# image: nvidia/cuda:12.9.1-cudnn-devel-ubuntu22.04
Expand Down
7 changes: 7 additions & 0 deletions deepmd/dpmodel/atomic_model/base_atomic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@
fparam: Array | None = None,
aparam: Array | None = None,
charge_spin: Array | None = None,
comm_dict: dict | None = None,
) -> dict:
"""Graph analogue of :meth:`forward_common_atomic` on the flat node axis.

Expand All @@ -406,6 +407,11 @@
charge_spin
charge/spin conditioning. Unused by the dpa1 graph path; accepted so
the interface stays stable for charge/spin-conditioned descriptors.
comm_dict
MPI communication metadata forwarded to :meth:`forward_atomic_graph`
(and, from there, the descriptor's ``call_graph``). ``None`` for
non-parallel inference (default). Mirrors :meth:`forward_common_atomic`'s
``comm_dict`` on the dense route.

Returns
-------
Expand All @@ -420,6 +426,7 @@
fparam=fparam,
aparam=aparam,
charge_spin=charge_spin,
comm_dict=comm_dict,
)
return self._finalize_atomic_ret(ret_dict, output_mask, atype)

Expand Down Expand Up @@ -551,16 +558,16 @@
out = ret_dict[kk]
# explicit trailing product (NOT -1): a zero-atom forward (nloc==0)
# has size 0, and numpy cannot infer -1 for a size-0 array.
trail = math.prod(out.shape[len(lead) :])
flat = xp.reshape(out, (*lead, trail))
flat = xp.where(atom_mask[..., None], flat, xp.zeros_like(flat))
ret_dict[kk] = xp.reshape(flat, out.shape)
ret_dict["mask"] = xp.astype(atom_mask, xp.int32)
return ret_dict

def call(
self,
extended_coord: Array,

Check warning

Code scanning / CodeQL

Signature mismatch in overriding method Warning

This method does not accept arbitrary keyword arguments, which overridden
NativeOP.call
does.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at least 4 positional arguments, whereas overridden
NativeOP.call
may be called with 1.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at most 8 positional arguments, whereas overridden
NativeOP.call
may be called with arbitrarily many.
This call
correctly calls the base method, but does not match the signature of the overriding method.
extended_atype: Array,
nlist: Array,
mapping: Array | None = None,
Expand Down
18 changes: 13 additions & 5 deletions deepmd/dpmodel/atomic_model/dp_atomic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def forward_atomic_graph(
fparam: Array | None = None,
aparam: Array | None = None,
charge_spin: Array | None = None,
comm_dict: dict | None = None,
) -> dict[str, Array]:
"""Graph analogue of :meth:`forward_atomic` on the flat node axis.

Expand All @@ -322,6 +323,11 @@ def forward_atomic_graph(
charge_spin
charge/spin conditioning. Unused by the dpa1 graph path; accepted so
the interface stays stable for charge/spin-conditioned descriptors.
comm_dict
MPI communication metadata forwarded to the descriptor's
``call_graph`` (the message-passing part). ``None`` for
non-parallel inference (default). Mirrors :meth:`forward_atomic`'s
``comm_dict`` on the dense route.

Returns
-------
Expand All @@ -338,14 +344,16 @@ def forward_atomic_graph(
xp = array_api_compat.array_namespace(graph.edge_vec)
type_embedding = self.descriptor.type_embedding.call()
gg, rot_mat = self.descriptor.call_graph(
graph, atype, type_embedding=type_embedding
graph, atype, type_embedding=type_embedding, comm_dict=comm_dict
Comment thread
wanghan-iapcm marked this conversation as resolved.
)
fparam_node = None
if fparam is not None:
frame_id = frame_id_from_n_node(
graph.n_node,
n_total=atype.shape[0],
)
# Pass the STATIC flat node count (``atype.shape[0] == N``) so the
# helper does not fall back to ``int(sum(n_node))``: that int() on a
# traced tensor breaks make_fx / torch.export
# (``GuardOnDataDependentSymNode``) for the graph .pt2 export and
# compiled-training paths when ``numb_fparam > 0``.
frame_id = frame_id_from_n_node(graph.n_node, n_total=atype.shape[0])
fparam_node = xp.take(fparam, frame_id, axis=0) # (N, ndf)
aparam_node = aparam
if aparam is not None and graph.n_local is not None and aparam.ndim == 3:
Expand Down
24 changes: 24 additions & 0 deletions deepmd/dpmodel/descriptor/dpa1.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,23 @@
)
return self.se_atten.tebd_input_mode in ("concat", "strip")

def uses_compact_edge_pairs(self) -> bool:
"""Returns whether the graph lower traces compact edge pairs.

The transformer attention lower (``attn_layer > 0``) enumerates
neighbor pairs via the compact ``center_edge_pairs`` realization
(unbacked-SymInt ``nonzero``/``repeat`` sizes, ``pairs.py``);
the factorizable lower (``attn_layer == 0``) traces with backed
symbols only. ``check_graph_trace_torch_version`` keys its
torch >= 2.6 requirement on this capability.

Returns
-------
bool
Whether tracing :meth:`call_graph` runs ``center_edge_pairs``.
"""
return self.se_atten.attn_layer > 0

def disable_graph_lower(self) -> None:
"""Force the legacy dense lower for this descriptor.

Expand Down Expand Up @@ -540,16 +557,16 @@
)
remap_index, has_new_type = get_index_between_two_maps(self.type_map, type_map)
obj = self.se_atten
obj.ntypes = len(type_map)
self.type_map = type_map
self.type_embedding.change_type_map(type_map=type_map)
obj.reinit_exclude(map_pair_exclude_types(obj.exclude_types, remap_index))
if has_new_type:
# the avg and std of new types need to be updated
extend_descrpt_stat(
obj,
type_map,
des_with_stat=model_with_new_type_stat.se_atten

Check warning

Code scanning / CodeQL

Signature mismatch in overriding method Warning

This method does not accept arbitrary keyword arguments, which overridden
NativeOP.call
does.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at least 4 positional arguments, whereas overridden
NativeOP.call
may be called with 1.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at most 8 positional arguments, whereas overridden
NativeOP.call
may be called with arbitrarily many.
This call
correctly calls the base method, but does not match the signature of the overriding method.
if model_with_new_type_stat is not None
else None,
)
Expand Down Expand Up @@ -781,6 +798,7 @@
atype: Array,
type_embedding: Array | None = None,
static_nnei: int | None = None,
comm_dict: dict | None = None,
) -> tuple[Array, Array]:
"""Descriptor-level graph-native forward.

Expand Down Expand Up @@ -817,6 +835,12 @@
(N,) flat LOCAL atom types where ``N = sum(n_node)``.
type_embedding
(ntypes_with_padding, tebd_dim) type-embedding table.
comm_dict
MPI communication metadata. Accepted for ABI parity with
:meth:`DescrptDPA2.call_graph` (uniform ``forward_atomic_graph``
call site), but UNUSED: a single se_atten descriptor has no
cross-rank message passing (``has_message_passing_across_ranks()``
is ``False``), so this is always ``None`` in practice.

Returns
-------
Expand Down Expand Up @@ -2207,13 +2231,13 @@
self.temperature = temperature
self.trainable_ln = trainable_ln
self.ln_eps = ln_eps
self.smooth = smooth
self.precision = precision
self.network_type = NeighborGatedAttentionLayer

self.attention_layers = [
NeighborGatedAttentionLayer(
nnei,

Check warning

Code scanning / CodeQL

Signature mismatch in overriding method Warning

This method does not accept arbitrary keyword arguments, which overridden
NativeOP.call
does.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at least 3 positional arguments, whereas overridden
NativeOP.call
may be called with 1.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at most 5 positional arguments, whereas overridden
NativeOP.call
may be called with arbitrarily many.
This call
correctly calls the base method, but does not match the signature of the overriding method.
embed_dim,
hidden_dim,
dotr=dotr,
Expand Down Expand Up @@ -2352,13 +2376,13 @@
self.normalize = normalize
self.temperature = temperature
self.trainable_ln = trainable_ln
self.ln_eps = ln_eps
self.precision = precision
self.attention_layer = GatedAttentionLayer(
nnei,
embed_dim,
hidden_dim,
dotr=dotr,

Check warning

Code scanning / CodeQL

Signature mismatch in overriding method Warning

This method does not accept arbitrary keyword arguments, which overridden
NativeOP.call
does.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at least 3 positional arguments, whereas overridden
NativeOP.call
may be called with 1.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at most 5 positional arguments, whereas overridden
NativeOP.call
may be called with arbitrarily many.
This call
correctly calls the base method, but does not match the signature of the overriding method.
do_mask=do_mask,
scaling_factor=scaling_factor,
normalize=normalize,
Expand Down Expand Up @@ -2500,14 +2524,14 @@
self.temperature = temperature
self.precision = precision
self.scaling = (
(self.head_dim * scaling_factor) ** -0.5
if temperature is None
else temperature
)
self.normalize = normalize
self.in_proj = NativeLayer(
embed_dim,
hidden_dim * 3,

Check warning

Code scanning / CodeQL

Signature mismatch in overriding method Warning

This method does not accept arbitrary keyword arguments, which overridden
NativeOP.call
does.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at most 6 positional arguments, whereas overridden
NativeOP.call
may be called with arbitrarily many.
This call
correctly calls the base method, but does not match the signature of the overriding method.
This method requires at least 3 positional arguments, whereas overridden
NativeOP.call
may be called with 1.
This call
correctly calls the base method, but does not match the signature of the overriding method.
bias=bias,
use_timestep=False,
precision=precision,
Expand Down
Loading
Loading