Warp inference backend of NeIO: review and move to newton-neural

Review of the Warp backend on the port branch (commits e812de1cb, 2aff9356f), and its first version as shared inference infrastructure in newton-neural. NVIDIA L40, Warp 1.17.0, PyTorch 2.11.0+cu128. 2026-12-02.

Fits if narrowed
Fit verdict for a shared inference layer
4e-7
largest difference to PyTorch in IEEE float32 (direction, 1 to 5,000 nodes, CUDA and CPU)
2.93 vs 3.03 ms
captured step, chain of 6 bodies: Warp network against the default PyTorch path
54.3 vs 39.0 ms
captured step, cloth of 100,489 particles: Warp network against the default PyTorch path

Main result. The matrix kernels are correct and are true float32. But the network in Warp alone does not make the step faster. The port's 3 times faster step came from the kernels around the network: the node inputs, the update and the history. Those kernels implement the rigid method that was removed, so they must be written again before they can move.

1. What was reviewed

Method: I read the complete range, traced the data through each mode, wrote down candidate findings, and then ran probes on the port and measurements on the moved code. The port branch has no pull request and no earlier review, so the commit messages and the README are the stated intent. I did not rerun the port's own test file.

2. How the backend works

3. Findings

P0 blocks the move. P1 should be handled before a merge. P2 is an observation or a question. "Shown" means a probe or a measurement confirms it. "Read" means it follows from the code and was not run.

#PriorityWhereProblemImpactEvidence
1P0 for the movewarp_optimizer.py: _rigid_gradient, _rigid_features, _rigid_features_small, _rigid_update, _prepare_commit The rigid kernels implement the rigid method that newton-neural removed: lever, arc unit, six step scales, one gradient RMS over six columns, the update as history, no turn of the history with the body. They cannot be carried. The retrained method needs new kernels: force and torque RMS per articulation, two step scales, the direction as history, history transport, carry bound.Read, against newton_neural/_src/neio/rigid.py.
2P1README.md, acceleration_results.json, benchmark.py The speed claim is about the whole Warp path. The network kernels give a small part of it. The benchmark has 6 bodies and 1,089 particles only, and compares with PyTorch float32, not with TF32. A reader takes the matrix kernels for the source of the gain. At scale they are not faster than PyTorch. Shown. Port's own phase times, chain: network 0.054 to 0.037 ms; inputs with network 0.144 to 0.048 ms; history 0.061 to 0.008 ms. Section 5 has the measurement on the moved code.
3P1solver.py, six places The solver tests inference == "warp" and calls private members of the optimizer (_warp.filter_update, _warp.select_truncated, _warp.add_displacement). Two code paths in every phase of the step. An own optimizer cannot use the fast path through iterate and commit.Read.
4P1warp_network.py:137-203 The structure of the network is written a second time. Nothing at run time compares it with NeIONetwork.forward. A change to one of the two gives a wrong result without an error.Read. Only the tests compare the two.
5P1warp_network.py:126, :118-121 On the CPU the kernel build fails: an argument of _controller is named new. There is no check and no message for the CPU. Past that, _pool steps by the number 32 while a tiled launch has one thread per block on the CPU. inference="warp" on a CPU model ends with "CPU kernel build failed". With the name fixed, the group mean would sum one node in 32.Build failure shown by probe. The wrong sum is read, not run.
6P1_linear_kernel with tile_matmul The first use with an empty kernel cache is slow. The result files report times with a warm cache only. About 100 s before the first step of a cloth-size network on a new machine or after a Warp update. Shown on the moved code: 100.1 s for the deformable network with 1,089 nodes, 1.7 s for the rigid network with 6 bodies, under 1 s with a warm cache.
7P2warp_network.py: view wp.from_torch gives each parameter that trains a gradient array. None in the port, whose loader turns the gradients off. A shared layer would double the parameter memory of a model that trains.Shown: 24 of 24 parameters had a .grad tensor after the build.
8P2warp_network.py:83, :145-175 The layer norm uses 1e-5 and not the value of the layer. A layer without bias, another activation or another GELU form is not refused.Wrong numbers for a network other than the two of NeIO.Read.
9P2warp_network.py:160-168 The tile sizes are numbers measured for the widths 96 and 384 on one L40. The rigid width 192 uses a default. No evidence for other widths or other GPUs.Read.
10P2tests/test_warp.py The tests need CUDA and are skipped without it. The largest cases have 33 bodies and 257 particles. No coverage on a CPU-only CI runner, none for large models.Read.
11P2_LaunchCache, solver.py When one optimizer uses Warp, all force launches of the solver go through the cache, also for the other optimizer. The cache key is the kernel, so two call sites of one kernel bind their arguments again on every call. A question on scope, not a defect. The port measured its effect on a captured step as 8 % and 4 %.Read.

What holds

Fit

Fits if narrowed. The layer is small, has no new dependency, and gives newton-neural a network path without PyTorch operators. But the layer alone brings no speed, and the part that brings speed is bound to one optimizer. The narrow form: an opt-in backend, checked against PyTorch on its first call, with the kernels around the network as the next step.

4. What moved to newton-neural

Portnewton-neural, branch ankac/neio-warp-inference
PlaceWarpNetwork, built for NeIONetwork only WarpInference in newton_neural/_src/core/warp_inference.py, public in newton_neural.models. Methods: linear, layer_norm, sequential, segment_mean, launch, run.
Network structureSecond copy inside the Warp class record_warp_inference next to NeIONetwork.forward
Switchinference="warp" per optimizer, six branches in the solver SolverNeIO(backend="warp") beside precision and compile. No branch in the step.
Check at run timenoneThe first network call is compared with the eager PyTorch network (limit 1e-4)
CPUbuild failsworks, tested
Parameters that trainget a gradient arrayno gradient array, tested
Layer it does not havenot checkedraises at build time, tested
Other modelsnoneA test runs the layers of BackboneMLP through sequential. NeRDStepper is not wired.
Kernels around the network, launch cachepresentnot carried (findings 1 and 11)

5. Measured on the moved code

One captured step with 10 iterations, median of 7 samples of 10 replays, one run, GPU otherwise idle. The node inputs, the update and the history are PyTorch code in all four columns.

ScenePyTorch fp32PyTorch tf32PyTorch tf32 compiled (default)Warp fp32
Chain, 6 bodies3.09 ms3.27 ms3.03 ms2.93 ms
Cloth, 1,089 particles2.55 ms2.36 ms2.18 ms2.47 ms
Cloth, 10,201 particles6.27 ms5.13 ms4.88 ms6.83 ms
Cloth, 100,489 particles53.2 ms43.0 ms39.0 ms54.3 ms

For comparison, the port with all kernels (its own numbers, same GPU type): chain of 6 bodies 2.30 ms to 0.69 ms, cloth of 1,089 particles 2.55 ms to 1.41 ms.

6. Decisions for you

  1. Kernels around the network. They are where the speed is. For NeIO deformable the port's kernels fit. For NeIO rigid they must be written again for the retrained method. Is that the next step?
  2. The switch. backend on the solver with the values "torch" and "warp". Or per optimizer, as in the port?
  3. NeRDStepper. Its network has attention, a normalizer and an integration step, which the layer does not have. Wire BackboneMLP first, in this branch or later?
  4. First use. Is 100 s of compile time acceptable for an option that is off by default?
  5. Tile sizes. Keep the port's measured numbers, or one default for all layer shapes?
  6. 16-bit matrix products. Warp documents tile_matmul for 16-bit floats. I did not measure it. Do you want that measured against PyTorch fp16?

7. Links