当前位置: X-MOL 学术arXiv.cs.PF › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
LLAMA: The Low Level Abstraction For Memory Access
arXiv - CS - Performance Pub Date : 2021-06-08 , DOI: arxiv-2106.04284
Bernhard Manfred Gruber, Guilherme Amadio, Jakob Blomer, Alexander Matthes, René Widera, Michael Bussmann

The performance gap between CPU and memory widens continuously. Choosing the best memory layout for each hardware architecture is increasingly important as more and more programs become memory bound. For portable codes that run across heterogeneous hardware architectures, the choice of the memory layout for data structures is therefore ideally decoupled from the rest of a program. This can be accomplished via a zero-runtime-overhead abstraction layer, underneath which memory layouts can be freely exchanged. We present the C++ library LLAMA, which provides such a data structure abstraction layer with example implementations for multidimensional arrays of nested, structured data. LLAMA provides fully C++ compliant methods for defining and switching custom memory layouts for user-defined data types. Providing two close-to-life examples, we show that the LLAMA-generated AoS (Array of Struct) and SoA (Struct of Array) layouts produce identical code with the same performance characteristics as manually written data structures. LLAMA's layout-aware copy routines can significantly speed up transfer and reshuffling of data between layouts compared with naive element-wise copying. The library is fully extensible with third-party allocators and allows users to support their own memory layouts with custom mappings.

中文翻译:

LLAMA:内存访问的低级抽象

CPU 和内存之间的性能差距不断扩大。随着越来越多的程序变得受内存限制,为每个硬件架构选择最佳内存布局变得越来越重要。对于跨异构硬件架构运行的可移植代码,数据结构的内存布局选择因此理想地与程序的其余部分分离。这可以通过零运行时开销抽象层来实现,在该层下可以自由交换内存布局。我们介绍了 C++ 库 LLAMA,它提供了这样一个数据结构抽象层,其中包含嵌套结构化数据的多维数组的示例实现。LLAMA 提供完全符合 C++ 的方法,用于为用户定义的数据类型定义和切换自定义内存布局。提供两个贴近生活的例子,我们展示了 LLAMA 生成的 AoS(结构数组)和 SoA(数组结构)布局生成的代码与手动编写的数据结构具有相同的性能特征。与朴素的逐元素复制相比,LLAMA 的布局感知复制例程可以显着加快布局之间数据的传输和重新排列。该库可通过第三方分配器完全扩展,并允许用户通过自定义映射支持自己的内存布局。
更新日期:2021-06-09
down
wechat
bug