arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.05555cs.PLcs.OScs.SE
收藏

消除竞赛检测的开销

Instrumentation Optimization for Practical Dynamic Race Detection

National University of Singapore(新加坡国立大学);Saint Petersburg Electrotechnical University "LETI"(圣彼得堡电气大学)

Alexey Paznikov, Michael Schwarz, Andrey Kogutenko, Yaroslav Osipov, Umang Mathur

AI总结:

通过静态分析消除冗余仪器化,显著降低动态数据竞赛检测器的运行时开销,提升性能。

摘要:

动态数据竞赛检测器对于标记软件中的并发错误至关重要,但其高运行时开销限制了其应用。这种开销主要来自内存访问的广泛仪器化 - 其中相当大的一部分是冗余的。我们通过一种静态、编译器集成的方法来解决这种低效性,该方法识别并消除冗余的仪器化,从而大幅减少动态数据竞赛检测器的运行时成本。我们引入了一套跨过程静态分析,这些分析关注内存访问模式、同步和线程创建,以消除可以证明无竞赛的访问的仪器化,并展示数据竞赛检测器的完整性属性得以保持。我们进一步发现,许多插入的检查在标记竞赛时,当且仅当先前的检查已经为同一内存位置标记了等价的竞赛 - 尽管可能在不同的访问中。我们刻画了这种等价性的概念,并证明当限制报告至少为每个等价类提供一个代表时,可以进一步消除一类冗余的检查。我们通过一种新的基于支配的消除分析来识别这些访问。基于这两个见解,我们在LLVM中实现了五种静态分析,与竞赛检测器ThreadSanitizer的仪器化传递集成。我们对各种真实世界应用程序的实验评估表明,我们的方法显著减少了竞赛检测的开销,实现了1.34倍的几何平均加速,高线程竞争下峰值加速达到2.5倍。这种性能在编译时间上仅有所增加,并且由于是全自动的,对开发人员没有额外负担。我们的优化已被ThreadSanitizer维护者接受,并正在被上游化。

英文摘要:

Dynamic data race detectors are successful at flagging concurrency bugs, but their high runtime overhead limits adoption. This overhead stems primarily from pervasive instrumentation of memory accesses -- a significant fraction of which is for safe accesses. We address this inefficiency through a compiler-integrated approach that identifies safe accesses using static analysis and eliminates instrumentation for these. We strike a careful balance between analysis precision and cost, to ensure applicability to real-world applications. We show that our optimizations never cause ThreadSanitizer to miss races it would otherwise detect. We further observe that many checks are redundant: They only flag a race if a preceding check has already flagged an equivalent race for the same memory location. We show that, when reporting one representative per class is sufficient, even more instrumentation can be eliminated. Lastly, we introduce a dynamic technique that skips instrumentation when there is only one thread at runtime, even when this could not be determined statically. We integrate these static analyses and program transformations into the ThreadSanitizer race detector based on LLVM. Our experiments on a diverse suite of real-world applications, including Memcached, Redis, SQLite, MySQL, and Chromium, demonstrate that our optimizations reduce the number of instrumentation calls at runtime by up to 91% and yield application-level speedups of up to 1.91x, a geometric-mean Chromium speedup of 1.25x on Blink and 1.14x on Speedometer 3.0, and peak speedups reaching 2.28x on Memcached with two server threads. Our optimizations are in the process of being upstreamed into ThreadSanitizer.

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

↑