结构良好的期货和缓存局部性
Well-Structured Futures and Cache Locality
摘要:
在fork-join并行中,顺序程序被分成由有向依赖边链接的任务的有向非循环图,并且任务可能以与其依赖性一致的顺序并行执行。扩展fork-join并行性的一种流行而有效的方法是允许线程创建future。线程创建一个future来保存计算的结果,这些结果可能是并行执行的,也可能不是。当某个线程触及该future时,将返回该结果,必要时将阻塞该结果,直到结果就绪。最近的研究表明,虽然期货当然可以以结构化的方式增强并行性,但它们可能对缓存局部性产生有害影响。在最坏的情况下,未来可能导致$Ω(P T_\infty + t T_\infty)$偏差,这意味着$Ω(C P T_\infty + C t T_\infty)$额外的高速缓存未命中,其中$C$是高速缓存行的数量,$P$是处理器的数量,$t$是触摸的数量,$T_\infty$是\emph{computation span}。由于高速缓存局部性对现代多核上的软件性能有很大影响,因此这个结果令人不安。然而,在本文中,我们表明,如果期货是在一个简单的,有纪律的方式使用,那么情况要好得多:如果每个未来只接触一次,无论是线程创建它,或由一个线程的未来已经从线程创建它,然后并行执行工作窃取可以招致最多$O(C P T^2_\infty)$额外的缓存未命中,一个实质性的改善。期货的这种结构化使用是许多(但不是所有)并行应用程序的特征。
英文摘要:
In fork-join parallelism, a sequential program is split into a directed acyclic graph of tasks linked by directed dependency edges, and the tasks are executed, possibly in parallel, in an order consistent with their dependencies. A popular and effective way to extend fork-join parallelism is to allow threads to create futures. A thread creates a future to hold the results of a computation, which may or may not be executed in parallel. That result is returned when some thread touches that future, blocking if necessary until the result is ready. Recent research has shown that while futures can, of course, enhance parallelism in a structured way, they can have a deleterious effect on cache locality. In the worst case, futures can incur $Ω(P T_\infty + t T_\infty)$ deviations, which implies $Ω(C P T_\infty + C t T_\infty)$ additional cache misses, where $C$ is the number of cache lines, $P$ is the number of processors, $t$ is the number of touches, and $T_\infty$ is the \emph{computation span}. Since cache locality has a large impact on software performance on modern multicores, this result is troubling. In this paper, however, we show that if futures are used in a simple, disciplined way, then the situation is much better: if each future is touched only once, either by the thread that created it, or by a thread to which the future has been passed from the thread that created it, then parallel executions with work stealing can incur at most $O(C P T^2_\infty)$ additional cache misses, a substantial improvement. This structured use of futures is characteristic of many (but not all) parallel applications.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。