Optimising Stencil Code on FPGAs by Trading Data Movement for Compute using Compiler Rewrite Rules

Abstract FPGAs are promising accelerators for scientific computing tasks because of their potential for delivering high performance-per-Watt. However, programming for optimal performance remains a complex task. Our goal is to bring FPGAs within the reach of domain scientists by developing compilers targeting scientific Fortran code. In this paper, we present a novel approach to aggressively reduce memory utilisation of stencil-based finite-difference Fortran code through a compiler-based automatic program transformation that trades memory accesses for computation. The key contribution of this work is a set of type-driven rewrite rules that identify and eliminate the intermediate arrays in stencil computations and replace them with re-computation, thus reducing the number of memory accesses. The main novelty lies in the transformations to move stencil operations out of maps and folds and to fuse stencils. We demonstrate the effectiveness of our approach using a set of five 3-D and 2-D stencil benchmarks evaluated on an Intel Arria 10 FPGA board. Our transformation result on average in a $$2.5\times$$ reduction in DRAM usage, a $$3.4\times$$ increase in DSP usage, and a $$25\times$$ improvement in throughput. We show on a real-world exemplar, the Large Eddy Simulator for Urban Flows, that our algorithm successfully removes all intermediate arrays (18 in total), reducing the memory footprint by a factor of $$4.5\times$$ . The memory-reduced FPGA code, automatically transpiled from the original Fortran source, is $$9.7\times$$ faster than the original Fortran code, and performance competitive with a hand optimised FPGA version while supporting a four times larger domain size.

Authors

Institutions

Publication Details

Journal
International Journal of Parallel Programming
Published
2026-03-02
DOI
https://doi.org/10.1007/s10766-025-00809-z
Primary Topic
Parallel Computing and Optimization Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Optimising Stencil Code on FPGAs by Trading Data Movement for Compute using Compiler Rewrite Rules

Robert Szafarczyk, Syed Waqar Nabi, Wim Vanderbauwhede
International Journal of Parallel Programming
Parallel Computing and Optimization Techniques
article

Optimising Stencil Code on FPGAs by Trading Data Movement for Compute using Compiler Rewrite Rules

Robert Szafarczyk, Syed Waqar Nabi, Wim Vanderbauwhede
article en

Abstract

Abstract FPGAs are promising accelerators for scientific computing tasks because of their potential for delivering high performance-per-Watt. However, programming for optimal performance remains a complex task. Our goal is to bring FPGAs within the reach of domain scientists by developing compilers targeting scientific Fortran code. In this paper, we present a novel approach to aggressively reduce memory utilisation of stencil-based finite-difference Fortran code through a compiler-based automatic program transformation that trades memory accesses for computation. The key contribution of this work is a set of type-driven rewrite rules that identify and eliminate the intermediate arrays in stencil computations and replace them with re-computation, thus reducing the number of memory accesses. The main novelty lies in the transformations to move stencil operations out of maps and folds and to fuse stencils. We demonstrate the effectiveness of our approach using a set of five 3-D and 2-D stencil benchmarks evaluated on an Intel Arria 10 FPGA board. Our transformation result on average in a $$2.5\times$$ reduction in DRAM usage, a $$3.4\times$$ increase in DSP usage, and a $$25\times$$ improvement in throughput. We show on a real-world exemplar, the Large Eddy Simulator for Urban Flows, that our algorithm successfully removes all intermediate arrays (18 in total), reducing the memory footprint by a factor of $$4.5\times$$ . The memory-reduced FPGA code, automatically transpiled from the original Fortran source, is $$9.7\times$$ faster than the original Fortran code, and performance competitive with a hand optimised FPGA version while supporting a four times larger domain size.

International Journal of Parallel ProgrammingVol. 54(1-2)
University of Glasgow (GB)
Sustainable cities and communities
Openalex Percentile: Top 58%
Parallel Computing and Optimization Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Optimising Stencil Code on FPGAs by Trading Data Movement for Compute using Compiler Rewrite Rules — Robert Szafarczyk, Syed Waqar Nabi, et al. · International Journal of Parallel Programming (2026) | TGRS Research Map | TGRS