Skip to content

trnsci blog

Three tracks: monthly suite digests, bylined technical deep-dives from sub-project maintainers when non-trivial work ships, and occasional thinking pieces about Trainium's place in the accelerator landscape.

trntensor: a batched MACE step on Trn2, and the hand kernels the compiler made redundant

Batched eight structures at a time, the MACE-MP-0b2 energy-plus-forces step takes 21.05 ms per 216-atom structure on one Trn2 logical core, 31× unmodified MACE on all 12 of the same box's host CPUs, with forces within 1.21e-5 of CPU MACE up to 1728 atoms. For the rest of the step, trntensor 0.27.0 shipped two hand-written NKI kernels and a way to run the same PyTorch bodies as compiled graphs, and the compiled graphs won: as fast as the kernels (39.8 against 41.9 ms per step), with a backward 4.6× closer to fp64. So "auto" leaves the kernels off. This post is for anyone deciding where hand-written kernels pay on Trainium. The answer here was the equivariant and graph blocks, and not the elementwise chains between them.

trnsci: the PSUM bug that never showed

Five trnsci libraries opened their matmul accumulation groups in a way the NKI documentation calls undefined behaviour on NeuronCore-v3, the core in Trn2. Device conformance in Trn2 windows 3 to 7 had passed with it. The fix, validated in Trn2 window 8, changed no output bit the suite measured and no timing beyond run-to-run noise. This post explains why that was still worth a suite-wide fix, what PSUM's accumulation groups are, and why the NKI simulator in CI never warned. It is for NKI kernel authors and for anyone who relies on the suite's bitwise-reproducibility promise.

trnblas: moving fp64-class GEMM onto the device, where the combine paid and the split didn't

trnblas's gemm_fp64 now runs its last host step, the (hi, lo) combine, on the device. It is bitwise equal to the host combine and 9–34% faster end to end on Trn2. A second change in the same window went further and was slower. It runs Ozaki scheme II entirely on the device, with integer residues and a Chinese-remainder rebuild, and reaches host-fp64 accuracy. But it loses to Ozaki I by 10–38%, because building 17 residues per element on VectorE costs more than the shorter GEMM saves. This post follows the 2026-11-10 Ozaki post. It is for anyone weighing the integer-residue route to fp64 emulation on hardware without an INT8 matrix path, and for anyone who wants to know where the bytes and launches of an emulated GEMM go.

trnfft: an fp64-class FFT from fp32 arithmetic, and where it loses

trnfft 0.30.0 adds precision="dw", a complex FFT that gets 47.4–49.9 correct bits on a Trn2 chip whose engines have no fp64. It is a double-word Stockham FFT, one launch, entirely in SBUF on the Vector engine, and it works because that engine's fp32 arithmetic rounds to nearest even, so error-free transformations are exact there. The concession comes first: host fp64 on 6 threads is faster per point, and the kernel wins only for large batches already on the device. This post is for anyone with an fp64 FFT inside a Trainium pipeline who wants to know when the host round trip can go.

trntensor and trnsparse: a MACE force step on Trainium, from 14 s to 40 ms

One energy-plus-forces step of the open MACE-MP-0b2 potential on a 216-atom slab takes 14.2 s on a Trn2 logical core when the model runs unmodified, 118 ms with its contractions on trntensor kernels and its graph sums on trnsparse kernels, and 39.3 ms once the rest of the model is fused and the edge count padded to a bucket. The kernels looked like the work, but at 118 ms they were a quarter of the step. And the size guard the suite added for safety was wrong: at 4096 atoms the kernel was exact, and the aten fallback it routed to broke. This post is for anyone running machine-learned interatomic potentials who wants to know what Trainium asks of a model, and what it gives back: bitwise-reproducible forces.

trnsci: what Trainium's arithmetic actually does

The suite's next precision step, fp64-class sums and dot products on the device, depends on how each NeuronCore engine rounds, and the Neuron documentation doesn't say. So one Trn2 window measured it: VectorE and GpSimd are textbook IEEE fp32, ScalarE has a fused multiply-add the docs don't mention, the fp32 TensorE path isn't correctly rounded, and stochastic rounding is deterministic per process. The same window also produced an accuracy table that mistook the worst corner of a range for the whole range, filed it upstream, and corrected it in public that night. This post is for anyone writing NKI kernels that need more than ML accuracy, and for anyone porting double-word or compensated algorithms to Trainium.

trnblas: fp64-accurate GEMM on a Tensor Engine with no fp64, and the end-to-end number that lost first

trnblas now has gemm_fp64, a GEMM that matches host fp64 BLAS to 1.8–3.8e-16 on a Trn2 chip whose engines have no fp64 arithmetic. The arithmetic works because fp32 PSUM, fed 7-bit integers, is an exact integer accumulator. The first end-to-end measurement still lost to the host CPU: the time went into cutting fp64 numbers into those integers on the host, until that moved to the device as bit manipulation. This post is for anyone with an fp64 step stuck on the host of a Trainium job, and for anyone who assumed double-double was the obvious way to get it off.

trntensor and trnsolver: 3508-AO DF-MP2 on one Trn2 core, and what "accurate" means at the fp32 floor

The 3508-AO DF-RHF plus DF-MP2 run now goes end to end on one logical core of a Trn2 chip: SCF, AO→MO and MP2, with no host driver patches. It also failed its own accuracy gate. The device and host fp32 routes disagreed by 4.46e-7 Eh against a 1e-7 Eh target, and the fault turned out to be the gate. 1e-7 Eh is below what any fp32 route can resolve at this size, and comparing two fp32 routes with each other measures the wrong thing. This post is for chemists deciding what to trust from an fp32 accelerator, and for anyone who writes tolerance checks for one.

trnsci: rows of 32 MiB, partitions 64–127, and the 4 GiB point that was right by luck

On Trn2, a device matmul or copy whose operand has rows of 32 MiB or more can return wrong numbers with no error, and trnblas 0.12.1 and trntensor 0.25.1 now block every such product into pieces the hardware gets right. Getting there meant retracting a data point the suite had published: "a right operand of exactly 2³² bytes is correct" was true only because the wrong addresses happened to hold an identical copy of the right data. AWS maintainers traced the fault to how a DMA spreads rows over the 128 SBUF partitions, and that model, not the suite's first guess, is what the guards now encode. This post continues the suite's silent wrong answers, and it is for anyone moving tensors of more than 4 GiB through a NeuronCore.

trnsolver and trntensor: DF-RHF and DF-MP2 from 500 to 3508 AOs on one Trn2 chip, and what bounds each rung

Density-fitted RHF plus MP2 now runs end to end on one trn2.3xlarge from about 500 to 3508 basis functions, including three systems whose integrals exceed the chip's 96 GiB of HBM, two of them the host's 124 GB of RAM as well. The largest rung is the least flattering: at 3508 AOs an SCF iteration took about 8 minutes, bound by the NVMe, and its AO→MO transform and eigensolve ran on the host through driver patches. The finding is that each step up the ladder moved the bound to a different resource: Tensor Engine compute, the host link, the page cache, the disk, SBUF, and twice the compiler. It's for chemists sizing a Trainium run, and anyone streaming more data than fits on the device.