8–12 Sept 2025
Hamburg, Germany
Europe/Berlin timezone

A Unified Interface for Different Memory Layouts

11 Sept 2025, 15:30
20m
ESA M

ESA M

Oral Track 1: Computing Technology for Physics Research Track 1: Computing Technology for Physics Research

Speakers

Jolly Chen (CERN & University of Twente (NL)) Leonardo Beltrame (Politecnico di Milano (IT))Dr Oliver Gregor Rietmann (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.

Significance

This presentation presents a novel method for creating C++ data structures with automatic data layout transformations.

References

E. Cano. Data layout: our reality. Technical report, Nov. 2023. URL https://indico.cern.ch/event/1347968/contributions/5674250/attachments/2763185/4812420/ata%20layout%20our%20reality.pdf

E. Cano. Implementation of generic SoA data structure in the CMS software. Technical report, Mar. 2023. Presented at ACAT2022. URL https://cds.cern.ch/record/2872252

H. Homann and F. Laenen. SoAx: A generic C++ Structure of Arrays for handling particles in HPC codes. Computer Physics Communications, 224:325–332, Mar. 2018. ISSN 0010-4655. doi:10.1016/j.cpc.2017.11.015. URL www.sciencedirect.com/science/article/pii/S0010465517303983.

Event and data persistency models for the LHCb Real Time Analysis System, Michel De Cian, Sevda Esen, Arthur Hennequin, Xavier Vilasís-Cardona, EPJ Web of Conf. 295 01026 (2024), CHEP 2023, DOI: https://doi.org/10.1051/epjconf/202429501026

Task 1.7: Common software developments for heterogeneous architectures. Nov 25, 2024, Next Generation Triggers 1st Technical Workshop, https://indico.cern.ch/event/1421629/contributions/6136773/attachments/2973836/5234329/NGT-Workshop-25-11-2024-Task-1-7.pdf

Experiment context, if any NextGen Triggers Task 1.7: Common software developments for heterogeneous architectures

Authors

Jolly Chen (CERN & University of Twente (NL)) Leonardo Beltrame (Politecnico di Milano (IT)) Dr Oliver Gregor Rietmann (CERN)

Presentation materials