Physical Sciences - Article 2026-04-23 posted v1

Automated Code Generation for Recurrence Relations Systematically Exceeds Expert Optimisation

R
Ruben Dario Guerrero NeuroTechNet SAS

Abstract

Recurrence relations are computational primitives across scientific computing, from orthogonal polynomials to molecular integral evaluation. Traditional implementations face a dual expertise barrier: domain scientists lack C++ optimisation skills, whilst software engineers lack domain knowledge. We present RECURSUM, a Python-based domain-specific language automatically generating optimised C++ code for arbitrary recurrence relations. Our LayeredCodegen backend achieves 9.8× speedup over expert hand-written implementations and 1.9× over template metaprogramming for McMurchie-Davidson Hermite coefficients--inverting the conventional hierarchy where manual optimisation defines the ceiling. Three systematic optimisations explain this: zero-copy output parameters (23× bandwidth reduction), guaranteed function inlining, and exact-sized stack buffers (100\% vs 27\% cache efficiency). Validated across 24 recurrence types spanning quantum chemistry, numerical analysis, and special functions on CPU backends (x86-64, ARM64), RECURSUM demonstrates automated generation can serve as the performance ceiling. The single-source specification architecture enables hardware portability, with GPU/FPGA/TPU backends planned. This paradigm shift democratises high-performance computing by eliminating the expertise barrier whilst systematically exceeding manual optimisation.

Citation Information

@article{rubendarioguerrero2026,
  title={Automated Code Generation for Recurrence Relations Systematically Exceeds Expert Optimisation},
  author={Ruben Dario Guerrero},
  journal={Research Square},
  year={2026},
  doi={https://doi.org/10.21203/rs.3.rs-8773066/v1}
}
Back to Top
Home
Paper List
Submit
0.023101s