Hardware That Follows the Hot Code: Runtime Offload to TokenProcessor

LENZO develops adaptable AI computing platforms built on TokenProcessor™ technology. In this post, we let a running program decide for itself which of its functions should move onto TokenProcessor, without changing a line of the application.
A Different Way to Use an Accelerator
The usual way to use an accelerator is to decide in advance. A developer profiles the application, picks the hot loops, rewrites them for the accelerator, and ships a new build. If the workload changes, the decision has to be made again.
Recently, a different idea has drawn attention in high-performance computing: let the hardware follow the code. Some new architectures watch the program while it runs, find the parts that take the most time, and reconfigure themselves to run those parts, without the application being rewritten.
TokenProcessor is a CPU-Grounded Linear Array (CGLA) : a CPU drives a linear array of function units, and the array is reconfigured for each kernel it runs. That made us curious. Can a CGLA do something similar? We built a small demo on a VPK180 board to find out.
1. The Demo in 25 Seconds
The demo running in the VPK180 remote environment. The terminal shows the application and the runtime's decisions. The panel at the top shows TokenProcessor's throughput and power, projected to an ASIC. It stays idle while everything runs on the Arm CPU and comes alive the moment the matrix multiply moves to TokenProcessor.
In the video, one program runs from start to finish:
It starts on the Arm CPU. The first matrix multiplies take about 690 ms each.
After about one second, the runtime notices that one function takes 99.6% of the time and moves it to TokenProcessor. From then on, each call takes 17.9 ms, about 40× faster.
The workload changes. The program moves on to signal analysis, and a different function, an FFT, becomes the hot spot. The runtime moves it to TokenProcessor as well, with a different configuration.
The FFT turns out to be slower on TokenProcessor, so the runtime moves it back. After one second of measurement, it sees 10.6 ms per call against 3.2 ms on the CPU, and returns the FFT to the Arm CPU for good.
The last step matters as much as the first. A runtime that only ever moves code onto the accelerator is easy to build. A useful one also has to notice when the move doesn't pay off.
2. The Application Doesn't Know
The application is ordinary C. It knows nothing about TokenProcessor. It runs in two phases:
Layers: a matrix multiply (480 × 480 × 480, FP32) followed by a row normalization, repeated like the layers of a small neural network.
Signal analysis: it builds a 32,768-point signal, applies a window, runs an FFT, and finds the strongest frequency.
It simply calls sgemm() , rownorm() and fft() . We build the same compiled application two ways, and only the linking differs:
Build |
|
|---|---|
CPU only | plain C implementations on the Arm CPU |
Offload | a small runtime that measures each call and decides where to run it |
The application code is identical in both builds. Nothing in it mentions the accelerator.
3. What the Runtime Does
The runtime is a few hundred lines of C. It does four things:
Measure. It counts the calls and the time spent in each function. Everything starts on the Arm CPU.
Find the hot spot. Every second, it computes each function's share of the elapsed time. A function above 50% is "hot".
Switch. If a hot function has a TokenProcessor configuration and the arguments have the right shape, the next call runs on TokenProcessor. On that first call, it also runs the same computation on the CPU and compares the results. Only if they match does it keep using TokenProcessor.
Verify the gain. After one more second, it compares the time per call on TokenProcessor with the time per call it measured on the CPU. If TokenProcessor isn't faster, the function goes back to the CPU and is never moved again.
Here is the runtime's own log from one run:
[offload] t= 1.4s sgemm is hot (99.6% of the time) -> offload to IMAX on the next call
[offload] t= 1.6s IMAX opened (2 lanes) in 152.4 ms
[offload] t= 2.3s sgemm: first call on IMAX 21.11 ms (ARM 687.94 ms); check against ARM: max |diff| 3.81e-06 (max |value| 2.65) -> switched to IMAX
[offload] t= 2.4s sgemm on IMAX 17.87 ms/call vs ARM 719.03 ms/call (40.2x faster) -> stays on IMAX
[offload] t= 3.4s fft is hot (57.8% of the time) -> offload to IMAX on the next call
[offload] t= 3.5s fft: first call on IMAX 12.36 ms (ARM 3.52 ms); check against ARM: max |diff| 6.71e-04 (max |value| 653) -> switched to IMAX
[offload] t= 4.5s fft on IMAX 10.58 ms/call vs ARM 3.21 ms/call (3.3x slower) -> back to ARM
IMAX is the internal name of the TokenProcessor array on our FPGA prototype.
The two TokenProcessor configurations come from our sample programs: the FP32 matrix multiply (running on two lanes, each computing half of the rows) and the 32,768-point FFT. We wrapped them as functions that take the arrays as arguments; the computation and the configurations themselves are unchanged.
4. Results
All numbers were measured on a VPK180 board (TokenProcessor FPGA prototype, Arm Cortex-A72 host), with 30 layers and 600 FFTs.
CPU only | Offload | |
|---|---|---|
Matrix multiply, per call | 680–720 ms (Arm) | 17.8 ms (TokenProcessor, 2 lanes) |
FFT, per call | 3.2 ms (Arm) | 10.6 ms on TokenProcessor → moved back to Arm after 1 s |
Layer phase (30 layers) | 20.5 s | 2.8 s |
Signal phase (600 FFTs) | 2.1 s | 2.7 s |
Results | reference | matrix: within 2×10⁻⁶ relative; FFT peaks: identical in all 600 frames |
The layer phase becomes 7× faster overall, including the first two calls on the CPU and the one-time switch. The signal phase becomes slightly slower, because the runtime spent one second trying the FFT on TokenProcessor before deciding to move it back. That is the price of measuring rather than guessing, and it is paid once.
Why does one function gain 40× while the other loses? The matrix multiply does N³ work on N² data. TokenProcessor keeps the data in the local memory next to each function unit and reuses it many times, so arithmetic dominates. A 32,768-point FFT does only N log N work. The Arm CPU finishes it in about 3 ms, and on TokenProcessor the time to move data between stages and main memory outweighs the arithmetic. Neither result is surprising, but it would be easy to assume that "accelerator" means "faster" for everything. The runtime doesn't assume; it measures.
5. What Reconfiguration Costs
A natural worry about switching hardware configurations at runtime is the cost of the switch itself. On TokenProcessor, this turned out to be the smallest number in the whole demo.
Step | Time |
|---|---|
Loading the matrix-multiply configuration into the array (per launch) | 0.01 ms |
Opening TokenProcessor (once per program) | about 150 ms |
Checking the first result against the CPU (once per function) | about 700 ms (the CPU computation) |
Copying the matrices to and from TokenProcessor's memory (per call) | 0.7 ms |
TokenProcessor loads a kernel's configuration every time it launches the kernel; there is no FPGA bitstream to change. Moving a function to TokenProcessor is therefore not a heavyweight "reconfiguration" event; it is simply calling a different implementation. Almost all of the one-time cost in this demo is the safety check, which we chose to do on the CPU. A production runtime could check a smaller sample, or skip the check for kernels that are already validated.
For the matrix multiply, one call on two lanes breaks down as follows: 6.5 ms loading data into the local memories, 9.1 ms computing, and about 2 ms for everything else.
6. What the ASIC Estimate Shows
The panel at the top of the video is part of our remote environment. While a program runs on TokenProcessor, it shows the throughput and power the same work would have on a TokenProcessor ASIC, together with the power measured on the FPGA board ( how it works ).
Matrix multiply | FFT | |
|---|---|---|
Function units used | 63 of 64 | 64 of 64 |
Operations per iteration | 970 | 746 |
Throughput, ASIC estimate | 485 GOPS | 187 GOPS |
Power, ASIC estimate | 14.3 W | 7.2 W |
Throughput measured on the FPGA | 12.3 GOPS | 24.6 GOPS |
The two kernels leave different fingerprints on the array: different numbers of function units and operations per iteration. That is the reconfiguration, visible from outside.
These ASIC figures are projections from our internal model, not measurements of silicon. They are useful for comparing kernels with each other, not as a final product specification.
7. What This Demo Is, and What It Isn't
We want to be precise about the scope:
The CPU baseline is plain C. Both CPU versions are straightforward loops, the same as in our sample programs. A hand-tuned NEON matrix multiply on the Arm CPU would narrow the 40× gap considerably. The point of the demo is that the code as written moves to TokenProcessor, not that TokenProcessor beats the best possible CPU code.
The configurations were written in advance. The runtime decides which function to move and when , and whether the move pays off. It does not compile arbitrary code into a TokenProcessor configuration. Today it knows two configurations for fixed shapes; other shapes stay on the CPU, and the runtime says so.
It runs on an FPGA prototype. Absolute times on the VPK180 are far from what an ASIC would deliver; the ASIC estimate above gives a rough idea of the difference.
The next step is to close the gap between "a library of configurations" and "any hot loop". Our MLIR-based compiler for TokenProcessor already turns tensor programs into TokenProcessor code. Connecting it to a runtime like this one would let the configuration be generated for the shape the program actually uses, instead of being picked from a fixed list.
8. Try It Yourself
The demo uses only the standard TokenProcessor toolchain ( conv-mark , cpp and conv-c2d ) and runs in the VPK180 remote environment with tp-run . These pages are a good place to start:
The Bottom Line
A running program can move its own hot spots onto TokenProcessor. With an unmodified C application and a small runtime, the matrix multiply that dominated the first phase moved to TokenProcessor after about a second and ran 40× faster than the same C code on the Arm CPU. When the workload changed, the runtime tried the new hot spot, an FFT, measured that it was 3.3× slower on TokenProcessor, and moved it back. Switching configurations costs 0.01 ms per launch; the larger one-time cost is the correctness check we chose to run on the CPU. The configurations are still hand-written and fixed in shape, and connecting the runtime to our MLIR compiler is the natural next step. The demo shows what a CGLA makes possible: the hardware follows the code, and it only stays where it helps.
Let's Build What's Next
If your application has hot spots that move with the workload, or code you would rather not rewrite for an accelerator, we'd love to learn more about it.

