AI is now capable of developing its own inference hardware
AI-Driven Hardware: The Emergence of openTPU
The boundary between software and hardware is blurring. openTPU represents a milestone where AI is no longer just the workload running on a chip, but the architect designing it. This project is an open-source AI accelerator created by AI agents, encompassing everything from the raw logic to the high-level compiler.
The Core Hypothesis:
- To what extent can AI agents master the complexities of hardware engineering?
- Is it possible for an AI to design the very silicon (or FPGA logic) required to execute its own inference?
🛠️ Project Scope & Architecture
The project is housed in a streamlined monorepo, allowing developers to trace the entire path from a high-level Python matrix multiplication down to the physical wires.
The openTPU Stack includes:
- RTL: Hardware descriptions written in
SystemVerilog. - ISA: A custom Instruction Set Architecture.
- Simulator: A bit-exact software simulation environment.
- Compiler: A dedicated kernel language and its associated compiler.
- Host Software: Drivers to manage a physical PCIe card.
- Profiler: Tools to analyze performance.
System Data Flow
🚀 Performance Benchmarks
The design was validated using an Inspur YPCB-00338 card, featuring a Xilinx Kintex-7 xc7k480t and dual DDR3 channels. The hardware output matches the simulator's results .
Inference Results Table
| Model Weights | Decode (Device) | Decode (Wall) | Prefill (Device) | DRAM Bandwidth |
|---|---|---|---|---|
| LFM2.5-230M (int8) | 59.0 tok/s | 52.3 tok/s | 295.6 tok/s | 14.5 GB/s (85%) |
| LFM2.5-230M (4-bit, int8 head) | 85.8 tok/s | 82.1 tok/s | 335.4 tok/s | 14.1 GB/s (82%) |
| Qwen3-0.6B (int8) | 21.6 tok/s | 21.3 tok/s | 92.1 tok/s | 14.4 GB/s (84%) |
| Qwen3-0.6B (4-bit, int8 head) | 31.3 tok/s | 30.7 tok/s | 103.4 tok/s | 13.9 GB/s (82%) |
| Qwen3.5-0.8B (int8) | 17.6 tok/s | 16.3 tok/s | 61.4 tok/s | 14.5 GB/s (85%) |
| Qwen3.5-0.8B (4-bit, int8 head) | 24.5 tok/s | 23.3 tok/s | 66.7 tok/s | 14.1 GB/s (83%) |
| Gemma 4 E2B (4-bit, int8 head) | 10.57 tok/s | 10.53 tok/s | 32.1 tok/s | 15.6 GB/s (92%) |
| Gemma 4 E2B (4-bit, 4-bit head) | 12.14 tok/s | 12.09 tok/s | 29.9 tok/s | 15.5 GB/s (91%) |
| LFM2-2.6B (int8) | 6.05 tok/s | 6.03 tok/s | 21.4 tok/s | 16.1 GB/s (94%) |
| LFM2-2.6B (4-bit, int8 head) | 10.96 tok/s | 10.93 tok/s | 20.6 tok/s | 15.8 GB/s (93%) |
| SmolLM3-3B (int8) | 5.00 tok/s | 4.99 tok/s | 21.1 tok/s | 16.0 GB/s (94%) |
| SmolLM3-3B (4-bit, int8 head) | 8.74 tok/s | 8.72 tok/s | 22.8 tok/s | 15.7 GB/s (92%) |
| Phi-4-mini (3.8B) (int8) | 3.99 tok/s | 3.98 tok/s | 13.8 tok/s | 16.0 GB/s (94%) |
| Phi-4-mini (3.8B) (4-bit, int8 head) | 6.56 tok/s | 6.55 tok/s | 15.0 tok/s | 15.8 GB/s (92%) |
| Qwen3.5-2B (int8) | 8.02 tok/s | 8.00 tok/s | 38.2 tok/s | 16.0 GB/s (94%) |
| Qwen3.5-2B (4-bit, int8 head) | 12.09 tok/s | 12.03 tok/s | 41.7 tok/s | 15.8 GB/s (92%) |
| Qwen3.5-4B (4-bit, int8 head) | 5.88 tok/s | 5.87 tok/s | 12.9 tok/s | 15.7 GB/s (92%) |
| Gemma 4 E4B (int8, 4-bit head/down) | 3.78 tok/s | 3.75 tok/s | 14.8 tok/s | 16.0 GB/s (94%) |
🔍 Technical Deep Dive
Hardware Implementation
The current production image runs at 133.33 MHz and utilizes a single bitstream for all supported models. Key components include:
- LiteDRAM Controllers: These are calibrated by an internal CPU within the memory core, taking approximately 12 seconds upon startup without requiring host intervention.
- Systolic Matrix Unit: A four-column design optimized for tensor operations.
- Stream Engine: Detailed in
docs/stream.md.
Measurement Methodology
Performance was measured using tools/qual/perf.py with the following parameters:
- Prompt: 512 tokens.
- Decode: 64 greedy tokens.
- Logic: The host handles the
argmaxin the loop.
The distinction between timing metrics is as follows:
Memory Management (Gemma 4)
The handling of embedding tables varies by model size:
- Gemma 4 E2B: Tables are stored on-card (). Note: int8 is too large to fit.
- Gemma 4 E4B: Tables () reside on the host; the host copies a single row per token. The total image size is .
📈 Evolution & Iteration
The project has moved through several iterations to optimize DRAM utilization and speed.
se-cand3deploy_champ_e698dcd7 deploy_fused133c_79c5707a (Build B)
Key Improvements in Build B:
- Speed: 8-10% faster decoding for LFM2-2.6B, SmolLM3, Phi-4-mini, and Gemma 4 E2B.
- Efficiency: DRAM utilization increased to (up from ).
Compared to the older se-cand3 (which used the Xilinx MIG, a two-column matrix unit, and a 120.755 MHz clock), the new image's decode performance is within across all configurations, as decode is primarily bound by DRAM bandwidth.
Example Configuration Snippet
# Mock representation of a model config in openTPU
model_config = {
"name": "LFM2-2.6B",
"precision": "int4",
"head_precision": "int8",
"clock_speed": "133.33MHz",
"dram_peak_util": 0.94
}
For further details on board specifications, refer to docs/board.md (Section 5).