roseNNa
Abstract
roseNNa is now a code generator. A model is lowered to Fortran 2008 or C11 with literal loop bounds, no runtime shape logic, no allocation and no mutable global state, so infer inlines into a solver's own compute kernel -- including a device kernel. The previous runtime library (fLibrary/) is retired. It parsed a model description at startup and interpreted it; the generated code has no parser and nothing to interpret. Operators Gemm, MatMul, Conv (1-D and 2-D, grouped and depthwise), MaxPool, AveragePool, LSTM, GRU, Add, Concat, Pad (constant/edge/reflect), Softmax, Relu, Sigmoid, Tanh, and the shape ops (Reshape, Transpose, Squeeze, Unsqueeze, Flatten, Identity). An inference BatchNormalization is folded into the Conv/Gemm that feeds it, so it costs nothing at runtime. A model the generator cannot lower is refused by name at generation time, never silently mis-computed. That rule is why validate.py exists and why most of its lines are refusals. GPUs The same generated infer runs from an OpenMP-target region, an OpenACC region, or inside your own CUDA/HIP kernel. infer_batch is a native CUDA or HIP kernel, or an OpenMP/OpenACC fallback. Nothing in the loop path allocates, transfers or synchronizes. One archive serves both call paths: .c is built by your host compiler with its offload flags and _kernel.cu by nvcc/hipcc. Weights are per-device, so a multi-GPU host can hold them on several cards at once. Validated by rosenna gpu-gate, which writes a report of every command and its output: A100 (NVIDIA HPC SDK 25.11, CUDA 13.0) and MI210 (ROCm 7.2.0, AFAR 23.2.1), both PASS. Verification 25 golden models, each compiled in both languages and compared against onnxruntime rather than against recorded output -- a recorded file pins whatever the library did the day it was recorded. 506 tests; coverage floored at 97% and enforced in CI. CI builds the C backend with gcc and clang and the Fortran backend with gfortran, flang and ifx; the last two run every golden model against onnxruntime. ASan/UBSan over all of it. nvcc and hipcc compile-check the device path. Fuzzing over random small graphs with recorded seeds. Examples Five runnable solvers with a network inside the time-step loop, in C and Fortran: a Burgers closure, a FitzHugh-Nagumo patch stepper, a bubble-population LSTM, a Poisson initial guess, and a 3-D compressible Navier-Stokes solver with a learned per-cell closure. Each prints an error and exits non-zero if the surrogate did not do what its README claims. Notes Spatial ops are 1-D or 2-D; 3-D would need the global rank cap raised. GRU implements both values of linear_before_reset (the ONNX default is 0, PyTorch exports 1, and they compute different things). Intel GPUs use the OpenMP fallback; there is no SYCL backend yet.