Porting NVIDIA Aerial 5G L1 to AWS Trainium
A clean-room re-implementation of the Aerial cuPHY approach to 5G physical-layer signal processing as Neuron Kernel Interface kernels — built with AI agents driving a compile-verify-fix loop on real Trainium2 silicon, and verified CRC-exact end to end.
Nokia and NVIDIA have shown that the 5G physical layer runs on a programmable AI accelerator. Nokia's AI-RAN work takes it from concept to commercialization on NVIDIA's Aerial. This playbook builds on that. If L1 belongs on an AI accelerator, can it also run on AWS AI silicon like Trainium? This is a question of customer choice: more places to run the workload serves operators better than fewer. The tooling that made targeting a new accelerator tractable was AWS's neuron-agentic-development NKI skills driving Claude Code, hand-building verified custom kernels in days, not quarters.
NVIDIA Aerial (Apache-2.0) was read for algorithm understanding only. No CUDA/C++ was copied. Every kernel is an independent implementation validated against a NumPy golden reference. This is a methodology demonstration, not a product.
Section 1
What this pipeline actually does
A phone sends data over the air. It arrives at the tower distorted and noisy — smeared by the channel, faded, phase-rotated, buried in noise. The 5G uplink physical layer (PUSCH) is the base station's job: turn that messy radio signal back into the exact bits the phone sent. Noisy radio in → correct data bits out.
Section 2
Watch a slot flow through the pipeline
Press play. A received slot moves stage by stage; each box lights up as its NKI kernel fires, showing the Neuron engine and the measured latency accumulating, ending in a CRC check.
Section 3
The build method: reference-first, hardware-in-the-loop
One rule: never write a device kernel before its plain-NumPy reference passes conformance. Order, every time: golden NumPy reference → simulator equivalence → device run. And a conformance policy — hard outputs (decoded bits, CRC) bit-exact; soft outputs (LLRs, channel estimates) within a documented tolerance, never loosened to pass a test.
I drove the build with an AI agent (Claude Code) using the AWS Neuron NKI agents and skills, with a real Trainium2 instance in the loop. The agent did not write correct kernels — it closed the loop fast: draft, verify against the reference in the simulator, hit a real compiler error on-device, fix, re-verify, dozens of times.
AWS researchers argued this statistically in NKI-Agent (arXiv:2607.04395): single-shot NKI solve rates are low, but the same model inside a compile-verify-fix loop on real Trainium compiles/verifies far more often. I used a general model and a different toolkit — not their fine-tuned model — so these results independently corroborate that claim.
"Verify against the reference" is one call. Each NKI kernel runs under
nki.simulate_kernel and its output is asserted equal to the NumPy golden reference
(hard outputs bit-exact, soft outputs within tolerance):
out = nki.simulate_kernel(demapper_tile_kernel, syms.real.astype(np.float32).reshape(P, 1), syms.imag.astype(np.float32).reshape(P, 1), n0, pts_re, pts_im, mask0, mask1) ref = demap_llr_float(syms, m, n0) # NumPy golden reference np.testing.assert_allclose(out, ref, rtol=1e-3, atol=1e-3)
From kernels/demapper/test_nki_demapper.py. The device test is
marked @pytest.mark.device, so the hardware-free CI gate skips it while the on-box
run executes it.
Section 4
The finding that justifies the whole approach
OFDM DFT: combined two matmul results with subtract(a,b) —
reading two PSUM (accumulator) inputs in one instruction, which the compiler forbids. Fix:
copy PSUM→SBUF before combining.
QAM demapper: sliced an SBUF tile off a non-32-partition-bank boundary. Fix: load the row from HBM so it lands at partition 0.
Both invisible in nki.simulate_kernel; both caught by nki.benchmark
(full device compile). This is the case for keeping real hardware in the loop.
Here is the OFDM DFT fix. The illegal version combines two matmul results directly. Each
matmul writes to PSUM, so the subtract reads two non-scalar PSUM inputs in one
instruction. The compiler rejects it. The fix copies each matmul result from PSUM to SBUF
first, then combines and accumulates in SBUF:
# FAILS on device: subtract reads two PSUM operands in one instruction acc_r[...] += nl.subtract(nl.matmul(tr, wr, transpose_x=True), nl.matmul(ti, wi, transpose_x=True)) # COMPILES: copy each matmul PSUM->SBUF, then combine in SBUF mrr = nl.copy(nl.matmul(tr, wr, transpose_x=True)) # Tr@Wr mii = nl.copy(nl.matmul(ti, wi, transpose_x=True)) # Ti@Wi acc_r[...] += nl.subtract(mrr, mii)
From kernels/ofdm_demod/nki_ofdm_demod.py. The simulator ran
the top version fine; neuronx-cc rejected it with "instruction can only read one of
its non-scalar inputs from PSUM."
The reference-first rule caught two more before silicon. Single-limb BF16 DFT twiddles missed
the accuracy budget (1.3e-3 against a 1e-3 target), fixed with a two-limb representation at
1.9e-6. A 1 - 2*x sign map wrapped for unsigned bytes, where 1 - 2
equals 255, caught as a unit-test failure long before silicon.
Section 5
The same pipeline on GPU and Trainium
The stages are identical either way. Top: the familiar GPU path (Aerial cuPHY). Bottom: the Trainium path in NKI. This isn't a race — it's a recognition.
Section 6
Reference architecture at runtime
At deployment, Trainium sits as an inline L1 accelerator behind a fronthaul gateway. The DU terminates the O-RAN 7.2x eCPRI fronthaul — the hard-real-time, PTP-synced transport — and hands IQ samples / soft bits to the Neuron device for the compute-heavy PHY, reading results back. Trainium does compute, not fronthaul transport.
| Stage | Trainium mapping | Engine |
|---|---|---|
| OFDM demod | DFT as matmul, twiddles in SBUF, contraction tiled over 128 partitions, PSUM-accumulated | Tensor |
| Channel est | LS at pilots + interpolation as matmul (linear or MMSE — swap the matrix) | Vec+Tensor |
| MMSE equalize | Closed-form analytic inverse, branch-free; subcarriers batched on partitions | Vector |
| QAM demap | Max-log-MAP LLRs via masked-min over the constellation (compile-time masks) | Vec/Scalar |
| Rate dematch | Circular-buffer combining as a scatter matmul (no gather/scatter) | Tensor |
| LDPC decode | Layered min-sum, parity unrolled at trace time, code blocks batched on partitions | Vector |
What does an NKI kernel look like? Here is the QAM demapper, the warm-up kernel. Symbols sit on the 128-partition axis, the constellation points sit on the free axis, and the per-bit log-likelihood ratio comes from a masked minimum over the constellation. Control flow is static: no data-dependent branching.
@nki.jit def demapper_tile_kernel(sym_re, sym_im, n0, pts_re, pts_im, mask0, mask1): P, m_bits = sym_re.shape[0], mask0.shape[0] out = nl.ndarray((P, m_bits), dtype=nl.float32, buffer=nl.shared_hbm) sr, si = nl.load(sym_re), nl.load(sym_im) # (P,1) symbols on partitions inv = nl.load(n0) pr, pi = nl.load(pts_re), nl.load(pts_im) # (1,M) constellation on free axis dr, di = nl.subtract(sr, pr), nl.subtract(si, pi) # broadcast to (P,M) dist2 = nl.add(nl.multiply(dr, dr), nl.multiply(di, di)) # |y - s|^2 for b in range(m_bits): # unrolled at trace time (static) d0 = nl.min(nl.add(dist2, nl.load(mask0[b:b+1])), axis=1, keepdims=True) d1 = nl.min(nl.add(dist2, nl.load(mask1[b:b+1])), axis=1, keepdims=True) nl.store(out[:, b:b+1], nl.divide(nl.subtract(d1, d0), inv)) # LLR = (d1-d0)/N0 return out
From kernels/demapper/nki_demapper.py. The additive masks
(0 where the bit matches, +1e9 otherwise) are compile-time constants, so the minimum selects the
right hypothesis subset with no branching.
Almost everything wants to be a matmul or an elementwise op with the batch dim on partitions, and control flow must be static. That's not a Trainium quirk — it's what makes any accelerator port predictable, and what makes latency deterministic (p99 ≈ p50).
Section 7
Measured on silicon
Section 8
A neural receiver on the same accelerator
To close the loop with AI-native RAN: a small MLP demapper compiled to Trainium with
torch_neuronx.trace tracks the classical max-log-MAP demapper within ~1% BER
across the SNR sweep — 100% bit-agreement at high SNR. Classical DSP kernels and a learned
neural PHY, side by side on one engine. That's the AI-native RAN thesis in miniature.
Section 9
Where this fits in Nokia's AI-RAN framework
Mapping this builder's PoC onto Nokia's published vision (not a claim of affiliation). Nokia's AI-RAN white papers frame the space through the AI-RAN Alliance's three pillars — and two of them are exactly what this touches:
| Nokia AI-RAN pillar | What it means | This project's contribution |
|---|---|---|
| AI-and-RAN | RAN and AI workloads share tensor-optimized computing infrastructure (Nokia: general-purpose accelerators, spare AI compute beyond RAN) | A full 5G L1 receive chain as NKI kernels on Trainium — a concrete demonstration that the shared "tensor-optimized" substrate can be AWS AI silicon |
| AI-for-RAN | AI enhancing the radio, culminating in the AI-native air interface (AI-AI): traditional chain → Neural Demapper → Neural Receiver (Nokia Fig 5) | The traditional NKI chain plus a neural demapper on the same device — the first two rungs of Nokia's roadmap; their CNN mapper reports ~2 dB BER gain, ours tracks classical within ~1% BER on Trainium |
The two building blocks Nokia's roadmap calls for — L1 on a tensor-optimized accelerator and a neural receiver block — both run on AWS Trainium in this PoC. Not delivering AI-RAN; showing its published architecture has a viable path on a second family of AI chips.
Section 10
What this is — and isn't
- Not real-time-validated. Benchmarks are component-scale, not a full 273-PRB / 4096-FFT / Z=384-LDPC slot. At real dimensions a single-core fp32 chain will likely exceed a 0.5 ms slot (LDPC is the pole). The path is known — INT8 LDPC, fused graph, multi-core, BF16 — but not done.
- Validated vs a NumPy reference, not yet NVIDIA's HDF5 test vectors; sign and bit-ordering confirmed by round-trip.
- No GPU head-to-head on identical vectors; any Aerial comparison is cross-published and labeled as such.
- No affiliation or endorsement. Mapping this work onto Nokia's and NVIDIA's published visions is illustrative, not a claim of partnership with either company or the AI-RAN Alliance. The framing is the author's; the vision is theirs.
- Clean-room. Aerial read for understanding, never copied.
Section 11
Why it matters
Nokia and NVIDIA proved the demand: AI-native RAN, with L1 on a programmable AI accelerator, is the direction. The healthiest version of that future is one where L1 acceleration isn't single-sourced — where a vendor can target the accelerator that fits their power, cost, and supply constraints because the PHY is written portably against a clean reference. This project is one data point toward it: a full 5G receive chain, clean-room, on a non-GPU AI accelerator, built in days because AI agents closed the verification loop against real silicon. The demand has been proven by the leaders. The optionality is what the rest of us get to build.
Write-up: Running 5G L1 signal processing on AWS Trainium (AWS Builder Center).
Source: full kernels, references, and conformance tests at github.com/gubaruch/neuron-aerial.
Credit: the compile-verify-fix-on-Trainium method is the AWS Neuron team's work — NKI-Agent (Tang, Huan, Zhou, Zhang, Wang) and the neuron-agentic-development NKI skills. The method is theirs; the clean-room 5G port is mine.
Format inspired by Hugging Face's Ultra-Scale Playbook (nanotron, Apache-2.0). This is an independent build; not affiliated with or endorsed by Hugging Face, NVIDIA, or Nokia. The views and opinions expressed here are the author's own and do not represent the official positions of Amazon Web Services (AWS).