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
Browse filesBrowse the repository at this point in the historyBrowse files
Han Wang
committed
feat(dpa4): wire charge-spin FiLM + SFPG bridging onto the graph route
Both features already worked inside the shared _call_graph_impl trunk;
only three wiring gaps kept them off the NeighborGraph lower:
- DescrptDPA4.call_graph dropped charge_spin before it reached the
trunk. It now accepts charge_spin, canonicalizes it (same
_canonicalize_charge_spin the dense call() adapter uses, so
call_graph is the single owner of that step on the graph route),
recovers nf from graph.n_node.shape[0] (static shape, export-safe),
and threads it through _call_graph_common. Gated end-to-end by a new
DescrptDPA4.supports_charge_spin() capability method, mirrored
exactly on supports_native_spin: DPAtomicModel caches
self.supports_charge_spin and forward_atomic_graph only forwards the
kwarg to descriptors that declare it, so dpa1/dpa2/dpa3's call_graph
(which has no charge_spin parameter) never TypeErrors.
- uses_graph_lower() rejected charge_spin_embedding and
bridging_switch outright; both branches are removed, so only the
explicit disable_graph_lower() escape hatch gates the graph route
off now. Bridging itself needed no threading -- the trunk already
reads self.bridging_switch directly.
- make_model.call_common (dpmodel, shared by pt_expt) forced any
charge_spin request onto the dense lower via
"if cs is not None: graph_method = None"; removed, and charge_spin
is threaded through _call_common_graph -> call_lower_graph on both
the dpmodel and pt_expt overrides.
has_message_passing_across_ranks() is untouched: bridging models still
fail multi-rank fast (a rank cannot observe a ghost owner's full
outgoing-edge set for the per-node freeze fold).
Tests (source/tests/common/dpmodel/test_dpa4_call_graph.py):
- test_uses_graph_lower_feature_gates flipped to the new gate set.
- charge_spin sensitivity + graph-vs-dense parity at 1e-12 (nf=2,
distinct per-frame conditioning -- pins the nf threading, not just
presence).
- bridging frozen-sphere invariance + gate-disabled ablation, mirroring
pt's TestSourceFreezePropagationGate at the descriptor level.
- model-level: get_model(add_chg_spin_ebd=True) actually reaches
DescrptDPA4.call_graph under neighbor_graph_method="dense" (spied,
not just output-changed, since the old bug was a silent dense
fallback rather than an error).
0 commit comments