Low latency optical-based mode tracking with machine learning deployed on FPGAs on a tokamak
Yumou Wei, Ryan F. Forelli, Chris Hansen, Jeffrey P. Levesque, Nhan Tran, Joshua C. Agar, Giuseppe Di Guglielmo, Michael E. Mauel, Gerald A. Navratil
TL;DR
This work tackles the challenge of real-time, microsecond-scale tracking of the $n=1$ MHD mode in tokamaks by deploying a CNN directly on an FPGA embedded in a high-speed frame-grabber used with optical cameras. Through a co-design workflow that includes TensorFlow modeling, hls4ml-based hardware synthesis, quantization, pruning, and careful reuse-factor optimization, the authors achieve a total trigger-to-output latency of $17.6~\mu\mathrm{s}$ and throughput up to $120~\mathrm{kfps}$, with CNN inference taking about $7.7~\mu\mathrm{s}$. The Optimized model, using a $32\times32$ input and aggressive hardware optimizations, meets latency targets while dramatically reducing resource usage, enabling real-time ML-based tokamak diagnostics and prospective control applications on the HBT-EP device. The result demonstrates a scalable end-to-end platform for real-time, ML-driven plasma diagnostics with potential cross-domain utility in other fast-imaging contexts.
Abstract
Active feedback control in magnetic confinement fusion devices is desirable to mitigate plasma instabilities and enable robust operation. Optical high-speed cameras provide a powerful, non-invasive diagnostic and can be suitable for these applications. In this study, we process fast camera data, at rates exceeding 100kfps, on $\textit{in situ}$ Field Programmable Gate Array (FPGA) hardware to track magnetohydrodynamic (MHD) mode evolution and generate control signals in real-time. Our system utilizes a convolutional neural network (CNN) model which predicts the $n$=1 MHD mode amplitude and phase using camera images with better accuracy than other tested non-deep-learning-based methods. By implementing this model directly within the standard FPGA readout hardware of the high-speed camera diagnostic, our mode tracking system achieves a total trigger-to-output latency of 17.6$μ$s and a throughput of up to 120kfps. This study at the High Beta Tokamak-Extended Pulse (HBT-EP) experiment demonstrates an FPGA-based high-speed camera data acquisition and processing system, enabling application in real-time machine-learning-based tokamak diagnostic and control as well as potential applications in other scientific domains.
