arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2106.04284cs.PF
收藏

LLAMA:存储器访问的低级抽象

LLAMA: The Low-Level Abstraction For Memory Access

Bernhard Manfred Gruber, Guilherme Amadio, Jakob Blomer, Alexander Matthes, René Widera, Michael Bussmann

摘要:

CPU和内存之间的性能差距不断扩大。随着越来越多的程序变得内存受限,为每个硬件架构选择最佳内存布局变得越来越重要。对于跨异构硬件架构运行的可移植代码,数据结构的存储器布局的选择理想地与程序的其余部分解耦。这可以通过一个零运行时开销的抽象层来实现,在该抽象层下可以自由地交换内存布局。我们提出了内存访问的低级抽象(LLAMA),一个C++库,它提供了这样一个数据结构抽象层的嵌套,结构化数据的多维数组的示例实现。LLAMA提供完全符合C++的方法,用于为用户定义的数据类型定义和切换自定义内存布局。该库可通过第三方分配器进行扩展。提供两个接近生活的例子,我们表明,LLAMA生成的AoS(数组的结构)和SoA(数组的结构)布局产生相同的代码与手动编写的数据结构相同的性能特征。集成到SPEC CPU \textsuperscript{\textregistered} lbm基准测试和粒子模拟PIConGPU中,展示了LLAMA在实际应用中的能力。LLAMA的布局感知复制例程可以显着加快传输和布局之间的数据重组相比,天真的元素明智的复制。LLAMA为在异构环境中开发高性能C++应用程序提供了一种新的工具。

英文摘要:

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 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 Low-Level Abstraction of Memory Access (LLAMA), a C++ library that 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. The library is extensible with third-party allocators. Providing two close-to-life examples, we show that the LLAMA-generated AoS (Array of Structs) and SoA (Struct of Arrays) layouts produce identical code with the same performance characteristics as manually written data structures. Integrations into the SPEC CPU\textsuperscript{\textregistered} lbm benchmark and the particle-in-cell simulation PIConGPU demonstrate LLAMA's abilities in real-world applications. LLAMA's layout-aware copy routines can significantly speed up transfer and reshuffling of data between layouts compared with naive element-wise copying. LLAMA provides a novel tool for the development of high-performance C++ applications in a heterogeneous environment.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑