A Unified Interface for Different Memory Layouts
Authors/Creators
- 1. Universiteit Twente (NL)
- 2. Politecnico di Milano (IT)
- 3. CERN
Description
Based on previous experience with parallel event data processing, a Structure-of-Arrays (SoA) layout for objects frequently performs better than Array-of-Structures (AoS), especially on GPUs. However, AoS is widespread in existing code, and in C++, changing the data layout from AoS to SoA requires changing the data structure declarations and the access syntax. This work is repetitive, time consuming, and leads to less intuitive code. For example, with AoS, we can have an array of particles and access the third particle’s momentum with the syntax particles[2].x. In contrast, SoA requires the syntax particles.x[2].
This addresses a common problem: some LHC experiments have independently implemented an automatic AoS to SoA converter; CMS uses C++ preprocessor macros, while ATLAS developed a template meta-programming-based solution in ACTS R&D. Both implementations are challenging to maintain due to the code complexity, and they require the programmer to adopt an unfamiliar API.
We present a generic solution for the abstraction of the data layout, enabling algorithm-specific memory layout optimization. Given a user-defined AoS data structure, the solution automatically generates an analogous SoA structure while keeping the access syntax identical to the C++ AoS style. This allows the programmer to change data layouts quickly without affecting the surrounding code because the interface is decoupled from the memory layout. Using modern C++ features (e.g., reflection), we offer an intuitive user interface while facilitating readability and maintainability of the code.
Files
soas_acat2025.pdf
Files
(749.4 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:9d9a5b70c94a75d7a1d223f74dc6c8d6
|
749.4 kB | Preview Download |
Additional details
Conference
- Acronym
- ACAT2025
- Dates
- 8-12 September 2025
- Place
- Hamburg, Germany