一句话:提出 cleAR,用 cacheline 锁将有冲突的原子区域推测执行限制为单次重试,降低回退与执行时间。
互斥是并行编程的基本构造,但锁操作在很大程度上主导并行程序性能。Speculative Lock Elision 与硬件事务内存允许原子区域并发推测执行,并通过冲突检测保证正确性;然而实际实现是尽力而为的,冲突后需重试预定次数,再回退到互斥。本文提出 cleAR:若原子区域在重执行时访问完全相同的地址集合,可在首次执行中学习该集合,并在下一次通过有序 cacheline locking 非推测执行,从而把推测执行限制为单次重试。该方法在首次 abort 时强制重执行进入 cacheline 锁定模式,且检测与转换对软件透明。基于 gem5、数据结构基准与 STAMP 的评估显示,首次重试成功比例从 35.4% 升至 64.4%,回退执行从 37.2% 降至 15.4%,平均执行时间较基线降低 35.0%,较 PowerTM 降低 23.3%。
Mutual exclusion has long served as a fundamental construct in parallel programs. Despite a long history of optimizing the lower-level lock and unlock operations used to enforce mutual exclusion, such operations largely dictate performance in parallel programs. Speculative Lock Elision, and more generally Hardware Transactional Memory, allow executing atomic regions (ARs) concurrently and speculatively, and ensure correctness by using conflict detection. However, practical implementations of these ideas are best-effort and, in case of conflicts, the execution of ARs is retried a predetermined number of times before falling back to mutual exclusion. This work explores the opportunities of using cacheline locking to bound the number of retries of speculative solutions. Our key insight is that ARs that access exactly the same set of addresses when re-executing can learn that set in the first execution and execute non-speculatively in the next one by performing an ordered cacheline locking. This way the speculative execution is bounded to a single retry. We first establish the conditions for ARs to be able to re-execute under a cacheline-locked mode. Based on these conditions, we propose cleAR, cacheline-locked executed AR, a novel technique that on the first abort, forces the re-execution to use cacheline locking. The detection and conversion to cacheline-locking mode is transparent to software. Using gem5 running data-structure benchmarks and the STAMP benchmark suite, we show that the average number of ARs that succeed on the first retry grows from 35.4% in our baseline to 64.4% with cleAR, reducing the percentage of fallback (coarse-grain mutual exclusion) execution from 37.2% to 15.4%. These improvements reduce average execution time by 35.0% over a baseline configuration and by 23.3% over more elaborated approaches like PowerTM.
@inproceedings{Gomez-Hernandez24,
title = {Bounding Speculative Execution of Atomic Regions to a Single Retry},
author = {Eduardo José Gómez-Hernández and Juan M. Cebrian and Stefanos Kaxiras and Alberto Ros},
booktitle = {ASPLOS},
year = {2024},
doi = {10.1145/3622781.3674176}
}