trntensor 0.26.0__tar.gz → 0.27.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. {trntensor-0.26.0 → trntensor-0.27.0}/CHANGELOG.md +71 -0
  2. {trntensor-0.26.0/trntensor.egg-info → trntensor-0.27.0}/PKG-INFO +4 -1
  3. {trntensor-0.26.0 → trntensor-0.27.0}/README.md +3 -0
  4. {trntensor-0.26.0 → trntensor-0.27.0}/docs/api/index.md +1 -0
  5. trntensor-0.27.0/docs/api/mlip_edge.md +84 -0
  6. {trntensor-0.26.0 → trntensor-0.27.0}/mkdocs.yml +1 -0
  7. {trntensor-0.26.0 → trntensor-0.27.0}/pyproject.toml +1 -1
  8. trntensor-0.27.0/tests/fixtures/mace_mp0b2_edge.pt +0 -0
  9. trntensor-0.27.0/tests/test_edge.py +489 -0
  10. trntensor-0.27.0/tests/test_edge_native.py +313 -0
  11. trntensor-0.27.0/tests/test_edge_neuron.py +457 -0
  12. trntensor-0.27.0/tests/test_edge_nki.py +209 -0
  13. trntensor-0.27.0/tests/test_psum_accumulate_lint.py +188 -0
  14. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/__init__.py +24 -1
  15. trntensor-0.27.0/trntensor/_region.py +108 -0
  16. trntensor-0.27.0/trntensor/edge.py +785 -0
  17. trntensor-0.27.0/trntensor/linear.py +424 -0
  18. trntensor-0.27.0/trntensor/nki/_edge.py +449 -0
  19. trntensor-0.27.0/trntensor/nki/_edge_kernels.py +779 -0
  20. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/nki/_equivariant_kernels.py +18 -10
  21. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/nki/_kernels.py +218 -141
  22. trntensor-0.27.0/trntensor/nki/_native_edge.py +146 -0
  23. {trntensor-0.26.0 → trntensor-0.27.0/trntensor.egg-info}/PKG-INFO +4 -1
  24. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor.egg-info/SOURCES.txt +13 -0
  25. {trntensor-0.26.0 → trntensor-0.27.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  26. {trntensor-0.26.0 → trntensor-0.27.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  27. {trntensor-0.26.0 → trntensor-0.27.0}/.github/workflows/ci.yml +0 -0
  28. {trntensor-0.26.0 → trntensor-0.27.0}/.github/workflows/notify-umbrella.yml +0 -0
  29. {trntensor-0.26.0 → trntensor-0.27.0}/.github/workflows/publish.yml +0 -0
  30. {trntensor-0.26.0 → trntensor-0.27.0}/.gitignore +0 -0
  31. {trntensor-0.26.0 → trntensor-0.27.0}/.pre-commit-config.yaml +0 -0
  32. {trntensor-0.26.0 → trntensor-0.27.0}/CLAUDE.md +0 -0
  33. {trntensor-0.26.0 → trntensor-0.27.0}/CODE_OF_CONDUCT.md +0 -0
  34. {trntensor-0.26.0 → trntensor-0.27.0}/CONTRIBUTING.md +0 -0
  35. {trntensor-0.26.0 → trntensor-0.27.0}/LICENSE +0 -0
  36. {trntensor-0.26.0 → trntensor-0.27.0}/benchmarks/__init__.py +0 -0
  37. {trntensor-0.26.0 → trntensor-0.27.0}/benchmarks/bench_einsum.py +0 -0
  38. {trntensor-0.26.0 → trntensor-0.27.0}/docs/api/decompose.md +0 -0
  39. {trntensor-0.26.0 → trntensor-0.27.0}/docs/api/einsum.md +0 -0
  40. {trntensor-0.26.0 → trntensor-0.27.0}/docs/api/equivariant.md +0 -0
  41. {trntensor-0.26.0 → trntensor-0.27.0}/docs/api/nki.md +0 -0
  42. {trntensor-0.26.0 → trntensor-0.27.0}/docs/api/plan.md +0 -0
  43. {trntensor-0.26.0 → trntensor-0.27.0}/docs/api/quantum.md +0 -0
  44. {trntensor-0.26.0 → trntensor-0.27.0}/docs/api/stream.md +0 -0
  45. {trntensor-0.26.0 → trntensor-0.27.0}/docs/architecture.md +0 -0
  46. {trntensor-0.26.0 → trntensor-0.27.0}/docs/aws_setup.md +0 -0
  47. {trntensor-0.26.0 → trntensor-0.27.0}/docs/benchmarks.md +0 -0
  48. {trntensor-0.26.0 → trntensor-0.27.0}/docs/contraction_patterns.md +0 -0
  49. {trntensor-0.26.0 → trntensor-0.27.0}/docs/design/matmul_dispatch_findings.md +0 -0
  50. {trntensor-0.26.0 → trntensor-0.27.0}/docs/design/matmul_kernel_profile.md +0 -0
  51. {trntensor-0.26.0 → trntensor-0.27.0}/docs/developing_kernels.md +0 -0
  52. {trntensor-0.26.0 → trntensor-0.27.0}/docs/index.md +0 -0
  53. {trntensor-0.26.0 → trntensor-0.27.0}/docs/installation.md +0 -0
  54. {trntensor-0.26.0 → trntensor-0.27.0}/docs/quickstart.md +0 -0
  55. {trntensor-0.26.0 → trntensor-0.27.0}/docs/tutorial_df_mp2.md +0 -0
  56. {trntensor-0.26.0 → trntensor-0.27.0}/examples/df_mp2_einsum.py +0 -0
  57. {trntensor-0.26.0 → trntensor-0.27.0}/infra/terraform/README.md +0 -0
  58. {trntensor-0.26.0 → trntensor-0.27.0}/infra/terraform/main.tf +0 -0
  59. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/autotune_dispatch.py +0 -0
  60. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/bench_ao2mo_nocc.py +0 -0
  61. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/bench_eager_handle.py +0 -0
  62. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/bench_native_einsum.py +0 -0
  63. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/bench_native_kernels.py +0 -0
  64. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/bench_to_md.py +0 -0
  65. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/conformance_expect.py +0 -0
  66. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/run_benchmarks.sh +0 -0
  67. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/run_neuron_profile.sh +0 -0
  68. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/run_neuron_tests.sh +0 -0
  69. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/run_reduce_parallel_multirank.py +0 -0
  70. {trntensor-0.26.0 → trntensor-0.27.0}/scripts/run_simulator_tests.sh +0 -0
  71. {trntensor-0.26.0 → trntensor-0.27.0}/setup.cfg +0 -0
  72. {trntensor-0.26.0 → trntensor-0.27.0}/tests/conftest.py +0 -0
  73. {trntensor-0.26.0 → trntensor-0.27.0}/tests/fixtures/mace_mp0b2_tiny.pt +0 -0
  74. {trntensor-0.26.0 → trntensor-0.27.0}/tests/mlip_reference.py +0 -0
  75. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_conformance.py +0 -0
  76. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_decompose.py +0 -0
  77. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_device_known.py +0 -0
  78. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_einsum.py +0 -0
  79. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_equivariant.py +0 -0
  80. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_equivariant_native.py +0 -0
  81. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_equivariant_neuron.py +0 -0
  82. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_equivariant_nki.py +0 -0
  83. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_host_output.py +0 -0
  84. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_kernel_dtype_guard.py +0 -0
  85. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_native_dispatch.py +0 -0
  86. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_neuron_int_exact.py +0 -0
  87. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_neuron_span.py +0 -0
  88. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_neuron_span_device.py +0 -0
  89. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_nki.py +0 -0
  90. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_nki_compile.py +0 -0
  91. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_nki_kernels.py +0 -0
  92. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_nki_native.py +0 -0
  93. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_nki_sim.py +0 -0
  94. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_nki_tail_audit.py +0 -0
  95. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_parallel.py +0 -0
  96. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_plan.py +0 -0
  97. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_quantum.py +0 -0
  98. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_sr_runtime.py +0 -0
  99. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_stream.py +0 -0
  100. {trntensor-0.26.0 → trntensor-0.27.0}/tests/test_trace_cache_safety.py +0 -0
  101. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/decompose.py +0 -0
  102. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/einsum.py +0 -0
  103. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/equivariant.py +0 -0
  104. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/nki/__init__.py +0 -0
  105. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/nki/_equivariant.py +0 -0
  106. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/nki/_native.py +0 -0
  107. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/nki/_native_equivariant.py +0 -0
  108. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/nki/collectives.py +0 -0
  109. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/nki/dispatch.py +0 -0
  110. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/parallel.py +0 -0
  111. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/plan.py +0 -0
  112. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/py.typed +0 -0
  113. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/quantum.py +0 -0
  114. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor/stream.py +0 -0
  115. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor.egg-info/dependency_links.txt +0 -0
  116. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor.egg-info/requires.txt +0 -0
  117. {trntensor-0.26.0 → trntensor-0.27.0}/trntensor.egg-info/top_level.txt +0 -0
  118. {trntensor-0.26.0 → trntensor-0.27.0}/uv.lock +0 -0
@@ -7,6 +7,77 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.27.0] — 2026-11-28
11
+
12
+ ### Added
13
+
14
+ - **MLIP edge and node ops: the rest of a MACE step as fused ops with
15
+ analytic backwards** (MLIP exemplar trnsci/trnsci#178, item 1). On the
16
+ MACE-MP-0b2 medium step on Trn2 at 216 atoms, about 92 of 118 ms went to
17
+ roughly 1,500 small aten launches outside the equivariant and graph
18
+ blocks.
19
+ - `spherical_harmonics(vectors, lmax=3)`: e3nn's real spherical harmonics
20
+ (basis, order and normalisation of `o3.SphericalHarmonics` for l ≤ 3).
21
+ The forward is one matmul of the degree ≤ 3 monomials against fixed
22
+ coefficients, and the backward is one matmul against their derivative
23
+ tables.
24
+ - `edge_chain(lengths, spec, r0)` with `edge_chain_spec(module=model)`:
25
+ the radial basis (Agnesi transform, Bessel basis, polynomial cutoff) and
26
+ every radial MLP that reads it, fused. It produces both layers'
27
+ `conv_tp` weights and edge densities `tanh(density_fn(·)²)`. The Agnesi
28
+ species constant is an input built once per neighbour list. Edges past
29
+ `r_max` contribute exactly zero, so padded edge buckets are safe.
30
+ - `equivariant_linear(x, spec, species=None)` with
31
+ `equivariant_linear_spec(module)`: an e3nn `o3.Linear` as one matmul per
32
+ irrep type (`W_l ⊗ I_{2l+1}`, probed once and checked exactly). The
33
+ one-hot `FullyConnectedTensorProduct` (MACE's `skip_tp`) becomes a
34
+ per-species map.
35
+ - Each op is one autograd node with an analytic backward, written in
36
+ differentiable aten, so double backward works. Against MACE at the six
37
+ MLIP exemplar captures, outputs match MACE fp32 to ≤ 4.6e-7 relative.
38
+ Input gradients for the real force-step cotangents are no further from
39
+ fp64 than MACE's own fp32 gradients.
40
+ - `set_region_backend("neuron")` (`TRNTENSOR_REGION_BACKEND`) runs the
41
+ forward and backward bodies of these ops as one
42
+ `torch.compile(dynamic=False)` graph per direction and call site.
43
+ `compiled_region(fn)` exposes the same wrapper.
44
+ - NKI kernels for `spherical_harmonics` and `edge_chain`, one launch per
45
+ direction. Edges are laid out partition-major (`[128, M·F]` views). The
46
+ radial MLPs run on the Tensor Engine with the weights resident in SBUF.
47
+ `sin` stays inside the Scalar Engine's accurate `[−π, π]` range. The
48
+ kernels are native `nki_op`s with `register_autograd`, or
49
+ `autograd.Function` on the XLA path and the simulator. They pass MLIR
50
+ verification for trn1 and trn2 (LNC 1 and 2). In `nki.simulate` they
51
+ match the fp64 PyTorch path to ≤ 2e-6 relative, and MACE at the
52
+ committed fixture. They are not yet validated on a device, so `"auto"`
53
+ leaves them off; `set_backend("nki")` or `TRNTENSOR_EDGE_NKI=1` selects
54
+ them. `tests/test_edge_neuron.py` holds the device checks and a timing
55
+ harness.
56
+ - New fixture `tests/fixtures/mace_mp0b2_edge.pt` (341 KiB), written by
57
+ the exemplar's `check_fused.py --trntensor-fixture` from the public
58
+ checkpoint.
59
+
60
+ ### Fixed
61
+
62
+ - **PSUM accumulation groups now open with a matmul write
63
+ (trnsci/trnsci#185).** The NKI kernels zeroed PSUM tiles with
64
+ `nl.zeros(..., buffer=nl.psum)` (a memset) and then accumulated into them
65
+ with `nisa.nc_matmul(..., accumulate=True)`. The `nc_matmul` docs make that
66
+ undefined behaviour on NeuronCore-v3 (Trn2): accumulating onto PSUM that a
67
+ non-matmul instruction initialised is not supported, and the first write
68
+ must use `accumulate=False`. Device results matched the references so far,
69
+ but they relied on that behaviour. All 20 sites now open each group with an
70
+ `accumulate=False` matmul: the matmul / batched-matmul, DF-MP2 energy,
71
+ AO→MO (4-index, Trn2, packed and blocked), DF exchange (half transform and
72
+ SYRK) and DF Coulomb `d` kernels peel the first K step of their
73
+ `nl.affine_range` loops into its own leg (`_psum_legs`), and the MACE
74
+ `conv_tp` backward and `symmetric_contraction` forward/backward kernels pass
75
+ `accumulate=(k > 0)` over their static loops. Those PSUM tiles are plain
76
+ `nl.ndarray`s now, so the redundant memsets are gone. Simulator outputs are
77
+ bitwise equal to 0.26.0 at the test shapes. A new static lint
78
+ (`tests/test_psum_accumulate_lint.py`) fails when a zeroed PSUM tile is a
79
+ matmul accumulation target, or when a tile is only ever accumulated into.
80
+
10
81
  ## [0.26.0] — 2026-11-25
11
82
 
12
83
  Validated on Trn2 (trn2.3xlarge, Neuron SDK 2.33.1, native TorchNeuron) — see trnsci/trnsci#35.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trntensor
3
- Version: 0.26.0
3
+ Version: 0.27.0
4
4
  Summary: Tensor contractions for AWS Trainium via NKI
5
5
  Author-email: Scott Friedman <scttfrdmn@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -146,6 +146,9 @@ core, factors = trntensor.tucker_decompose(tensor, ranks=(5, 5, 5))
146
146
  | Sharding | `ShardedTensor`, `scatter`, `gather` | Output- and reduce-parallel sharded contractions |
147
147
  | Equivariant | `conv_tp` | e3nn "uvu" tensor product (MACE interaction), forward + ∂x/∂y/∂w |
148
148
  | Equivariant | `symmetric_contraction` | MACE product basis (correlation ≤ 3), forward + ∂x |
149
+ | MLIP edge | `spherical_harmonics` | e3nn real spherical harmonics, l ≤ 3, forward + ∂v |
150
+ | MLIP edge | `edge_chain` | Fused radial basis + cutoff + radial MLPs (the `conv_tp` weights), forward + ∂r |
151
+ | MLIP node | `equivariant_linear` | e3nn `Linear` / one-hot skip tensor product as one matmul per irrep, forward + ∂x |
149
152
 
150
153
  ## Status
151
154
 
@@ -108,6 +108,9 @@ core, factors = trntensor.tucker_decompose(tensor, ranks=(5, 5, 5))
108
108
  | Sharding | `ShardedTensor`, `scatter`, `gather` | Output- and reduce-parallel sharded contractions |
109
109
  | Equivariant | `conv_tp` | e3nn "uvu" tensor product (MACE interaction), forward + ∂x/∂y/∂w |
110
110
  | Equivariant | `symmetric_contraction` | MACE product basis (correlation ≤ 3), forward + ∂x |
111
+ | MLIP edge | `spherical_harmonics` | e3nn real spherical harmonics, l ≤ 3, forward + ∂v |
112
+ | MLIP edge | `edge_chain` | Fused radial basis + cutoff + radial MLPs (the `conv_tp` weights), forward + ∂r |
113
+ | MLIP node | `equivariant_linear` | e3nn `Linear` / one-hot skip tensor product as one matmul per irrep, forward + ∂x |
111
114
 
112
115
  ## Status
113
116
 
@@ -7,4 +7,5 @@ trntensor's public API is organized into these modules:
7
7
  - **[decompose](decompose.md)** — `cp_decompose`, `tucker_decompose`, and reconstructors
8
8
  - **[quantum](quantum.md)** — fused chemistry primitives (`mp2_energy`, `ao_to_mo_transform`, `df_exchange`, `df_coulomb`)
9
9
  - **[equivariant](equivariant.md)** — MACE-style equivariant contractions (`conv_tp`, `symmetric_contraction`) with forward and input gradients
10
+ - **[mlip_edge](mlip_edge.md)** — the rest of a MACE step as fused ops with analytic backwards (`spherical_harmonics`, `edge_chain`, `equivariant_linear`) and compiled regions (`set_region_backend`)
10
11
  - **[nki](nki.md)** — backend dispatch (`set_backend`, `get_backend`, `HAS_NKI`)
@@ -0,0 +1,84 @@
1
+ # MLIP edge and node ops
2
+
3
+ The MACE-MP-0b2 medium energy + forces step on Trn2 (216 atoms, 10,392 edges)
4
+ took 118 ms with the equivariant contractions and the graph gather / segment
5
+ sum on trntensor and trnsparse kernels. About 92 ms of that was MACE's
6
+ remaining 1,503 aten ops, each launched separately
7
+ ([trnsci/trnsci#178](https://github.com/trnsci/trnsci/issues/178)). These
8
+ ops replace the largest groups. Each one is one autograd node with an
9
+ analytic backward, so forces (`-dE/dpositions`) still come from autograd.
10
+
11
+ | op | replaces (MACE / e3nn) | gradient |
12
+ |---|---|---|
13
+ | `spherical_harmonics(vectors, lmax=3)` | `o3.SphericalHarmonics(..., normalize=True, normalization="component")` | ∂vectors |
14
+ | `edge_chain(lengths, spec, r0)` | `RadialEmbeddingBlock` (Agnesi, Bessel, polynomial cutoff), every interaction's `conv_tp_weights` and `tanh(density_fn(·)²)` | ∂lengths |
15
+ | `equivariant_linear(x, spec, species=None)` | `o3.Linear`; the one-hot `FullyConnectedTensorProduct` (`skip_tp`) | ∂x |
16
+
17
+ ## `spherical_harmonics(vectors, lmax=3, normalize=True, normalization="component", eps=1e-12)`
18
+
19
+ This uses e3nn 0.4's real basis, component order and normalisation for
20
+ `l ≤ 3`. `normalize=True` divides by `max(|v|, eps)`, as
21
+ `torch.nn.functional.normalize` does. Every component is a polynomial of
22
+ degree `≤ l` in the unit vector, so the forward is one matmul of the
23
+ degree-1…3 monomials against a fixed `[19, 16]` coefficient matrix
24
+ (`sh_coefficients`). The backward is one matmul against the derivative
25
+ tables plus the projection of the normalisation.
26
+
27
+ ## `edge_chain_spec(...)` and `edge_chain(lengths, spec, r0=None)`
28
+
29
+ `edge_chain_spec(module=model)` reads a MACE model. It takes the radial
30
+ embedding and, per interaction, `conv_tp_weights` (head `tp_w{i}`) and
31
+ `density_fn` with `post="tanh_sq"` (head `density{i}`). Explicit
32
+ construction takes `r_max`, `num_basis`, `cutoff_p`, `agnesi=(a, q, p)`,
33
+ `apply_cutoff` and `EdgeMLP` heads. Each head holds effective matrices with
34
+ e3nn's `1/√fan_in` and `normalize2mom` constants folded in.
35
+
36
+ `edge_chain` returns one `[E, d_h]` tensor per head. The Agnesi species
37
+ constant `r0 = (R[z_s] + R[z_r]) / 2` depends only on the neighbour list.
38
+ MACE rebuilds it from integer gathers on every call; here it is an input,
39
+ `spec.agnesi_r0(z_sender, z_receiver)`, built once per neighbour list. An
40
+ edge at or past `r_max` contributes exactly zero, and so does its gradient.
41
+ Pad edge buckets with such edges.
42
+
43
+ ## `equivariant_linear_spec(module=None, *, elements=None, ...)` and `equivariant_linear(x, spec, species=None)`
44
+
45
+ The spec probes the module's dense map once in float64. It splits the map
46
+ per irrep type `(l, p)` into `K_l = W_l ⊗ I_{2l+1}` and checks the split
47
+ exactly. The op is then one matmul per irrep type and a concatenation, where
48
+ e3nn runs 62 aten ops for one 128x0e+…+128x3o linear. For the one-hot skip
49
+ tensor product, `elements` lists the species present; each node keeps its
50
+ own species' block. `mode="dense"` uses one matmul against the full matrix.
51
+
52
+ ## Backends
53
+
54
+ - **PyTorch path** (default everywhere). This is a short chain of aten ops
55
+ per direction. Against MACE-MP-0b2 at the six exemplar captures, outputs
56
+ match MACE fp32 to ≤ 4.6e-7 relative. Input gradients for the real
57
+ force-step cotangents are at most as far from fp64 as MACE's own fp32
58
+ gradients (`examples/mlip/check_fused.py`).
59
+ - **Compiled regions**: `set_region_backend("neuron")` (or
60
+ `TRNTENSOR_REGION_BACKEND`). The forward and the backward bodies each run
61
+ as one `torch.compile(dynamic=False)` graph per call site. Pad edge counts
62
+ to a bucket to avoid a recompile per geometry.
63
+ - **NKI kernels** for `spherical_harmonics` and `edge_chain`
64
+ (`trntensor/nki/_edge_kernels.py`), one launch per direction. Edges are
65
+ laid out partition-major, so each elementwise step is one instruction over
66
+ a `[128, J]` plane of edges. The radial MLPs run on the Tensor Engine with
67
+ the weights resident in SBUF and PSUM accumulation. `sin` runs as
68
+ `sin(π − w x)` to stay in the Scalar Engine's accurate `[−π, π]` range; the
69
+ host routes only specs where `max(w)·x ≤ 2π` (Agnesi transform). The
70
+ kernels pass MLIR verification for trn1 and trn2 (LNC 1 and 2) and match
71
+ the fp64 PyTorch path in `nki.simulate`. They are not yet validated on a
72
+ device, so `"auto"` does not route to them; use `set_backend("nki")` or
73
+ `TRNTENSOR_EDGE_NKI=1`.
74
+
75
+ ## Tests
76
+
77
+ - `tests/test_edge.py` (CPU): the MACE fixture `fixtures/mace_mp0b2_edge.pt`,
78
+ e3nn and MACE modules when installed, fp64 `gradcheck` / `gradgradcheck`,
79
+ equivariance, padding and compiled regions.
80
+ - `tests/test_edge_native.py` (CPU): registered ops, autograd, routing and
81
+ weight packing, with the kernels emulated by their contracts.
82
+ - `tests/test_edge_nki.py` (`nki`): MLIR verification and `nki.simulate`.
83
+ - `tests/test_edge_neuron.py` (device): correctness at 216 and 1728 atoms,
84
+ and a timing harness (`TRNTENSOR_EDGE_BENCH_JSON=…`).
@@ -28,6 +28,7 @@ nav:
28
28
  - Quantum primitives: api/quantum.md
29
29
  - Streaming DF integrals: api/stream.md
30
30
  - Equivariant contractions: api/equivariant.md
31
+ - MLIP edge and node ops: api/mlip_edge.md
31
32
  - NKI dispatch: api/nki.md
32
33
  - Architecture: architecture.md
33
34
  - Benchmarks: benchmarks.md
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "trntensor"
7
- version = "0.26.0"
7
+ version = "0.27.0"
8
8
  description = "Tensor contractions for AWS Trainium via NKI"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"