arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.02183cs.PL
收藏

用于控制 C++ 中对象空间局部性的集体分配器抽象

Collective Allocator Abstraction to Control Object Spatial Locality in C++

Takato Hideshima, Shigeyuki Sato, Tomoharu Ugawa

AI总结:

针对 C++ 在解聚内存上难以模块化控制对象放置的问题,本文提出 collective allocator 抽象以感知地址子空间并优化空间局部性,实验表明其能以少量代码修改让 B 树和跳表抑制交换。

摘要:

解聚内存有望提高计算机集群中的内存利用率,在这些集群中,各计算机节点在低利用率情况下的内存需求差异显著。它允许具有高内存需求的应用程序使用其他计算机节点中的内存。然而,解聚内存并不容易用于在 C++ 中实现数据结构,因为 C++ 标准没有提供适当的抽象,以便以高级、模块化的方式高效使用它。由于访问远程内存涉及高延迟,解聚内存通常被用作远端内存系统,这形成了一种交换内存,其中本地内存的一部分被用作缓存区域,而其余内存不受交换影响。为了追求性能,程序员必须意识到这种非均匀内存视图,并适当地放置数据以最小化交换。在本工作中,我们将内存解聚系统的地址空间建模为远端内存模型,提出了集体分配器抽象,使我们能够指定感知内存地址子空间的对象放置,并将其应用于感知远端内存模型的编程。远端内存模型在隐藏细节的同时提供了非均匀内存空间的视图。在该模型中,虚拟地址空间被划分为两个子空间;一个受交换影响,另一个不受交换影响。交换子空间进一步被划分为大小相等的页,页是交换的单位。集体分配器抽象将分配器构造为子分配器的集合,每个子分配器拥有一个不同的子空间,其中每次分配都通过子分配器完成。它使我们能够在分配时根据不同标准(例如子空间特征和对象并置)选择适当的子分配器,从而控制对象放置。这极大地促进了实现感知远端内存模型的容器数据结构。我们通过扩展用于远端内存模型上容器数据结构的 C++ 标准分配器,开发了一个基于集体分配器抽象的分配器,并通过实验证明它有助于以高级、模块化的方式实现在远端内存模型下具备感知空间局部性的对象放置策略的容器。更具体地说,我们通过结合使用两种放置策略成功实现了 B 树和跳表。其中对原始实现的修改相当少:增加主要来自指定对象放置;删除和修改分别至多占原始代码行数的 1.2% 和 3.2%。我们通过实验确认,修改后的实现成功获得了抑制交换的数据布局。我们预测,集体分配器抽象将成为与不同内存硬件技术进行高级集成的关键,因为它可以直接容纳新的子空间接口。

英文摘要:

Disaggregated memory is promising for improving memory utilization in computer clusters in which memory demands significantly vary across computer nodes under utilization. It allows applications with high memory demands to use memory in other computer nodes. However, disaggregated memory is not easy to use for implementing data structures in C++ because the C++ standard does not provide an adequate abstraction to use it efficiently in a high-level, modular manner. Because accessing remote memory involves high latency, disaggregated memory is often used as a far-memory system, which forms a kind of swap memory where part of local memory is used as a cache area, while the remaining memory is not subject to swapping. To pursue performance, programmers have to be aware of this nonuniform memory view and place data appropriately to minimize swapping. In this work, we model the address space of memory-disaggregated systems as the far-memory model, present the collective allocator abstraction, which enables us to specify object placement aware of memory address subspaces, and apply it to programming aware of the far-memory model. The far-memory model provides a view of the nonuniform memory space while hiding the details. In the model, the virtual address space is divided into two subspaces; one is subject to swapping and the other is not. The swapping subspace is further divided into even-sized pages, which are units of swapping. The collective allocator abstraction forms an allocator as a collection of sub-allocators, each of which owns a distinct subspace, where every allocation is done via sub-allocators. It enables us to control object placement at allocation time by selecting an appropriate sub-allocator according to different criteria, such as subspace characteristics and object collocation. It greatly facilitates implementing container data structures aware of the far-memory model. We develop an allocator based on the collective allocator abstraction by extending the C++ standard allocator for container data structures on the far-memory model and experimentally demonstrate that it facilitates implementing containers equipped with object placement strategies aware of spatial locality under the far-memory model in a high-level, modular manner. More specifically, we have successfully implemented B-trees and skip lists with the combined use of two placement strategies. The modifications therein for the original implementations are fairly modest: addition is mostly due to specifying object placement; deletion and modification are at most 1.2 % and 3.2 % of lines of the original code, respectively. We have experimentally confirmed that the modified implementations successfully have data layouts suppressing swapping. We forecast that the collective allocator abstraction would be a key to high-level integration with different memory hardware technologies because it straightforwardly accommodates new interfaces for subspaces.

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

↑