GSoC 2026 final report: ML Inference on Heterogeneous Architectures using SOFIE Harsh Chauhan completed a Google Summer of Code 2026 project with CERN-HSF, ML4EP and the University of Manchester extending SOFIE, ROOT's TMVA inference code generator, so its generated C++ runs on NVIDIA GPUs, AMD GPUs and CPUs from one source. The work uses alpaka for kernels and buffers and sofieBLAS as a single GEMM interface routing to cuBLASLt, hipBLASLt or CPU BLAS, closing gaps in operator coverage, support for input sizes not fixed at generation time, and portability beyond NVIDIA hardware. | Name | Harsh Chauhan https://github.com/harz05 | | Organisation | CERN-HSF https://hepsoftwarefoundation.org/activities/gsoc.html , ML4EP https://github.com/ML4EP and the University of Manchester https://www.manchester.ac.uk/ | | Project | ML Inference on heterogeneous architectures using SOFIE https://hepsoftwarefoundation.org/gsoc/2026/proposal ML4EP SOFIE ALPAKA.html | | Mentors | Sanjiban Sengupta https://github.com/sanjibansg , Dr. Lorenzo Moneta https://github.com/lmoneta | | GSoC project page | https://summerofcode.withgoogle.com/programs/2026/projects/NE74dwRu https://summerofcode.withgoogle.com/programs/2026/projects/NE74dwRu | | Repositories | ML4EP/SOFIE https://github.com/ML4EP/SOFIE , ML4EP/sofieBLAS https://github.com/ML4EP/sofieBLAS , root-project/root https://github.com/root-project/root/tree/master/tmva/sofie | | Period | Community bonding from 1 May 2026, coding 25 May to 26 October 2026 22 weeks | Machine learning models are now part of how the LHC experiments process data, including in trigger systems with high throughput, low latency and tight memory limits, where deploying PyTorch or TensorFlow inside a C++ framework brings heavy dependencies and clashes with the framework's own threading. SOFIE System for Optimized Fast Inference code Emit , part of ROOT's TMVA, takes a trained model and generates C++ code for its inference, with BLAS as the only dependency. The generated code is small, has no model interpreter at run time, and on CPUs it matches or beats ONNX Runtime on several LHC models. The High-Luminosity LHC pushes more of this work onto GPUs, and each vendor brings its own programming model, memory layout and BLAS library. "Heterogeneous architectures" in the title means that the same generated inference code should run on NVIDIA GPUs, AMD GPUs and CPUs. SOFIE gets there in two layers: the generated code uses alpaka for its kernels and buffers, so one source compiles for every backend, and matrix products go through sofieBLAS, which gives the generated code one BLAS interface and picks the vendor library underneath. When this project started, that GPU path covered part of the operator set, worked only for input sizes fixed at generation time, and had only ever run on NVIDIA. The aim was to close those three gaps. Figure: the SOFIE pipeline, from S. Sengupta and L. Moneta, EuCAIFCon 2026. The figure above is the whole pipeline. A trained model ONNX, Keras or PyTorch is parsed into SOFIE's model object, which knows every operator, its attributes and its tensor shapes. Code generation then writes a header with a Session class: the constructor loads the weights and allocates every intermediate tensor once, and infer runs the operators in order. For GPUs the same generator emits alpaka code. Every operator becomes a kernel launched on a device queue, the tensors live in alpaka device buffers, and the Session takes the backend as a template argument: Session