Li Wang: AI-Assisted Porting and Performance Optimization of LFRic Kernels

Li Wang: AI-Assisted Porting and Performance Optimization of LFRic Kernels

Modern models such as LFRic face increasing computational demands and growing pressure to efficiently exploit GPU-based heterogeneous HPC systems. However, porting and optimizing large legacy Fortran codebases for GPUs remains time-consuming and highly dependent on expert knowledge. To address this challenge, we developed a workflow that combines large language model (LLM)-driven code transformation with automated kernel extraction, compilation, validation, profiling, and iterative optimization. The framework automatically generates GPU-oriented implementations from existing CPU kernels and uses compiler feedback to refine optimization strategies.

The approach was applied to hotspot kernels from LFRic, focusing on OpenACC-based GPU parallelization, loop restructuring, vectorization, and memory-access optimization. Generated kernels were validated against reference CPU implementations to ensure numerical correctness.

Our results demonstrate that AI-assisted code evolution can significantly reduce the manual effort required for GPU porting while producing functional and portable accelerated kernels. The study highlights how machine learning techniques can support the future development of scalable Earth system models on emerging exascale architectures.

Audience: Earth system model developers, HPC researchers, and AI-for-science communities.