Repository navigation
perf(pt): add opt-in SO2 edge-cohort inference backward 【hnu】 - #2
Draft
macqueen09 wants to merge 3 commits into
Draft
macqueen09 wants to merge 3 commits into
macqueen09 wants to merge 3 commits into
Conversation
Use a compiled single-cohort branch for small edge sets and retain a streamed runtime path for larger frozen Neo input gradients. Keep native fallback and explicit stride defaults, add 60 CUDA checks and cold-first-peak evidence. The switch remains disabled by default; multi-model and AOT deployment are not validated. N64 cold allocated peak falls 3.62%; no speedup is claimed.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add a default-off experimental first-order SO(2) input-gradient path for frozen DPA4-Neo inference. Bound temporary gradient storage without changing weights, representation, precision or GEMM scheduling.
本PR是湖南大学提交的。
This Draft targets personal master at
668b60cc2a9559f79abb9c33acd959833376344f, not an upstream merge request or validation against subsequent upstream commits.Implementation and scope
DP_SO2_EDGE_COHORT_INFER=1; default zero. Checked contiguous FP32 Neo layout only (F2/Cf32/lmax3/ROW320, three layers/two gated/apply_alpha). Weight gradients, higher-order and extra saved-output gradients retain the existing path.Primary capacity: includes the first peak
RTX 5090 GPU0; driver595.91.07, PyTorch2.11.0+cu128/Triton3.6.0. Strict level2 mixing FP32, TF32/AMP off.
Neo checkpoint DPA4-Neo-OMat24-v20260627.pt SHA256
8d8b2b02b9575cb9e0af420cc1e8b1d9ffcbc04752c2203d29f48ccd0cd5f07d.Normal ASE energy/force/virial/stress API; N64 diamond, E~10114, seed0/0.02 Angstrom perturbations.
Retain the earlier three independent cold processes per arm, empty explicit compiler caches, counters covering model load/first JIT/warmup/timed inference. System/driver caches not purged. Worst-of-three, decimal MB; first and full-window peaks coincide. These are not the dual-model timing experiment's memory.
No new cold-memory rerun is implied. Same production source hashes; no use of warm reset peaks to replace first capacity.
Controlled latency follow-up: no arbitrary 3% noise rule
The previous independent-cold P50 12.157611→12.313776ms (+1.2845%) remains in the raw history, but cannot be attributed entirely to ECS. Cache audit found 41/109 common non-SO2 autotune programs with different actual launch selections in the first candidate; baseline self-runs also changed selections. max_autotune=False does not disable all generic pointwise/reduction autotuning.
New main test: same GPU/context and normal full API, frozen cache/autotune choices, four independent processes counterbalancing BASE/ECS initialization order and PYTHONHASHSEED0/1. Each has24 ABBA blocks, each round8 warmups/50 samples: 96 blocks, 9600 samples per arm. Monitor foreign processes/clocks/power/temperature; no global settings or clocks changed.
Actual Neo energy inference uses make_fx→aot_module_simplified→compile_fx_inner, bypassing Dynamo; no claim that inference Dynamo guards caused the difference.
Accuracy and regression
Elementwise atol1e-5/rtol1e-4; relative denominator max(abs(reference),1e-8), never relaxed; finite required.
Earlier cold matrix: BASE self3 pairs, ECS self3, all9 cross-pairs, all6 processes versus fresh pure PyTorch passed; worst error/tolerance0.352841. Pure PyTorch has three self-repeats in one GPU1 process, not a new multi-process Torch matrix.
New four-process main test: three frames each, energy/force/virial/stress versus paired BASE and the fresh Torch reference all pass; worst error/tolerance 0.376674.
Full model tolerance equivalence is not promised bitwise equality.
60 focused CUDA tests re-passed (14warnings,50.53s), including tails/zero/tiny-alpha, caller ownership, native static/dynamic compilation and threshold guards. Training/higher-order guards are not complete training acceptance. Full-tree Ruff check/format and diff-check passed; no new native build/full backend suite claimed.
Multi-model and N4096 update (2026-10-19)
Snapshot: 95 process results, 91 complete, 4 OOM; 117 planned. Neo/Nano/Mini matrices and 9 true-runtime Neo diagnostics complete; Pro is in progress, so pending/partial cells are not acceptance. Production kernels unchanged. Three independent processes per model/size/mode, three identical perturbed-carbon frames, three repeats/frame. TORCH = compiled pure PyTorch level0, not eager/exact truth. All modes of each model/size use the same physical GPU. Fixed atol1e-5/rtol1e-4, all outputs finite required; values below are worst error/tolerance, <=1 within criterion, not a percentage. BASE self-failure never excuses candidate failure.
模型与尺寸总表
真正8192边运行时分批:与PR单批路径分开
4096原子位力最大绝对误差范围(eV)
范围是各对输出max_abs的min~max,非置信区间;所有比较仅对同一帧进行。
Nano/Mini/Pro are native fallbacks, not demonstrated ECS acceleration/support. Pro is official Pro-MPtrj v2026.06.05, not OMat24-Pro; original checkpoint MD5/SHA256 verified. All three Pro modes use the disclosed legacy metadata-only fitting alias, with strict tensor loading; original weights unchanged. Neo4096 TORCH OOMed in all3 processes. The 9-call accuracy samples include compilation and are not latency/P50 evidence. This matrix is pinned to PR base668b60cc, not latest upstream master.
Historical N4096 speed/capacity observation — not accepted current-PR performance
2026-10-18 runtime prototype, GPU0, one process/arm, 8 warmups/30 synchronized wall samples, same normal ASE energy/force/virial/stress API. GB=1e9 bytes. Includes the first call in the full-window memory high-water mark, excludes compile from timing. Different experiment from the controlled N64 study above.
P90: 156.614295→153.179559ms. Candidate first-call-only peak22.255608GB; full-window22.256657GB is the primary capacity metric. Historical virial error/tolerance1.394 failed, TORCH OOM; only one process/arm. These observations are not validated stable speedup or production acceptance. Current PR single-path precision, true-runtime diagnostics, and old prototype performance must not be interchanged.
Complete original matrix NPZ arrays and its orchestration harness are not included in this documentation update; published aggregate/route evidence is not a claim of an end-to-end independently auditable matrix archive. Existing public benchmark commands are linked in the supplement. No model weights, compiler caches or private reports committed.
Mega-kernel extent
This borrows bounded-workset/dependency scheduling ideas; it is not a persistent cross-layer mega-kernel and does not integrate HazyResearch's device taskqueue/loader/consumer/storer/controller runtime. Representative traces show 657 GPU launches/frame in both arms, including32 SO2 stack launches. Lifetime reduction can reduce peak storage without reducing launch count or latency. No automatic speedup claim.
Reproduction and raw evidence
Existing work and outstanding gates
Internal residual reuse overlaps deepmodeling#6058; gains are not additive or wholly novel. Loop tiling/lifetime scheduling are established ideas; no general compiler novelty claim.
Latest full-model acceptance covers Neo N64 only. Keep default-off Draft status.