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

利用多跨步访问模式提升硬件预取

Multi-Strided Access Patterns to Boost Hardware Prefetching

Miguel O. Blom, Kristian F. D. Rietveld, Rob V. van Nieuwpoort

AI总结:

本文提出将单跨步访存模式转换为同时访问多跨步模式以提升硬件预取器利用率,在不使用软件预取指令的情况下显著提高了缓存命中率和内存带宽,使多个访存受限内核在不同微架构上取得了最高达12.55倍的加速。

摘要:

重要的访存受限内核,如线性代数、卷积和模板计算,依赖 SIMD 指令以及旨在改进向量化数据遍历和数据重用的优化,以获得令人满意的性能。在当代 CPU 架构上,硬件预取器对于高效利用内存层次结构至关重要。在本文中,我们证明将包含单跨步的访存模式转换为同时访问多个跨步的模式,可以提升硬件预取器的利用率,进而显著提升访存受限内核的性能。使用一组微基准测试,我们确立以多跨步方式访问内存能够使更多缓存行同时被引入缓存,从而在不引入高成本软件预取指令的情况下,带来缓存命中率提高和有效内存带宽增加。随后,我们展示了包含六个访存受限密集计算内核的集合的多跨步变体在三种不同微架构上优于最先进的同类内核。更具体地说,对于包括矩阵向量乘法、卷积模板以及来自 PolyBench 的内核,我们取得了显著的加速,分别比 Polly 高达 12.55 倍,比 MKL 高达 2.99 倍,比 OpenBLAS 高达 1.98 倍,比 Halide 高达 1.08 倍,以及比 OpenCV 高达 1.87 倍。利用多跨步访存的代码转换是循环展开和循环交换技术的自然扩展,允许该方法在未来被集成到编译器流水线中。

英文摘要:

Important memory-bound kernels, such as linear algebra, convolutions, and stencils, rely on SIMD instructions as well as optimizations targeting improved vectorized data traversal and data re-use to attain satisfactory performance. On on temporary CPU architectures, the hardware prefetcher is of key importance for efficient utilization of the memory hierarchy. In this paper, we demonstrate that transforming a memory access pattern consisting of a single stride to one that concurrently accesses multiple strides, can boost the utilization of the hardware prefetcher, and in turn improves the performance of memory-bound kernels significantly. Using a set of micro-benchmarks, we establish that accessing memory in a multi-strided manner enables more cache lines to be concurrently brought into the cache, resulting in improved cache hit ratios and higher effective memory bandwidth without the introduction of costly software prefetch instructions. Subsequently, we show that multi-strided variants of a collection of six memory-bound dense compute kernels outperform state-of-the-art counterparts on three different micro-architectures. More specifically, for kernels among which Matrix Vector Multiplication, Convolution Stencil and kernels from PolyBench, we achieve significant speedups of up to 12.55x over Polly, 2.99x over MKL, 1.98x over OpenBLAS, 1.08x over Halide and 1.87x over OpenCV. The code transformation to take advantage of multi-strided memory access is a natural extension of the loop unroll and loop interchange techniques, allowing this method to be incorporated into compiler pipelines in the future.

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

↑