计算机科学2024,Vol.51Issue(12) :100-109.DOI:10.11896/jsjkx.231100060

基于数据局部性的循环分块选择算法

Tile Selection Algorithm Based on Data Locality

廖启华 聂凯 韩林 陈梦尧 谢汶兵
计算机科学2024,Vol.51Issue(12) :100-109.DOI:10.11896/jsjkx.231100060

基于数据局部性的循环分块选择算法

Tile Selection Algorithm Based on Data Locality

廖启华 1聂凯 2韩林 2陈梦尧 1谢汶兵3
扫码查看

作者信息

  • 1. 郑州大学计算机与人工智能学院 郑州 450000
  • 2. 郑州大学国家超级计算郑州中心 郑州 450000
  • 3. 无锡先进技术研究院 江苏无锡 214000
  • 折叠

摘要

现有的多面体编译框架(如Pluto,LLVM/Polly和GCC/Graphite)在进行循环分块时,都采用了固定分块大小,无法充分发挥不同硬件的缓存特性,导致存在较大的性能差异.针对这一问题,涌现了许多基于多级缓存和数据局部性的循环分块算法,但这些算法往往只能优化特定循环程序或者缺乏综合考虑,不适合移植到通用编译器中.文中提出了一种基于数据局部性的循环分块选择算法,该算法不仅考虑了缓存替换策略的影响,还考虑了多核环境下的负载均衡问题.算法基于LLVM中的Polly模块实现,并选用Pluto和PolyBench中的部分测试用例进行单核和多核测试.实验结果表明,单核环境下,相比LLVM/Polly的默认分块方法,该算法在两种硬件平台下分别获得了平均2.03和2.05的加速比,且在多核环境下具有良好的并行可扩展性.

Abstract

The existing polyhedral compilation frameworks(such as Pluto,LLVM/Poly and GCC/Graphite)use fixed block sizes when performing loop tiling,which cannot fully utilize the caching characteristics of different hardware,resulting in significant performance differences.In response to this issue,many loop tiling algorithms based on multi-level caching and data locality have emerged,but these algorithms often only optimize specific loop programs or lack comprehensive consideration,and are not suitable for transplantation into general compilers.This paper proposes a tile size selection algorithm based on data locality,which not on-ly considers the impact of cache replacement strategy,but also considers the load balancing problem in multi-core environments.The algorithm is implemented based on the Polly module in LLVM,and some test cases from Pluto and PolyBench are selected for single core and multi-core testing.The experimental results show that compared to the default partitioning method of LLVM/Polly,the proposed algorithm achieves an average acceleration ratio of 2.03 and 2.05 on two hardware platforms in a single core environment,and has good parallel scalability in a multi-core environment.

关键词

数据局部性/多面体模型/循环分块/分块大小/负载均衡

Key words

Data locality/Polyhedral model/Loop tiling/Tile size/Load balancing

引用本文复制引用

出版年

2024
计算机科学
重庆西南信息有限公司(原科技部西南信息中心)

计算机科学

CSTPCD北大核心
影响因子:0.944
ISSN:1002-137X
段落导航相关论文