藉由多面體編譯分析在通用顯示卡實現軟體預取
Software Prefetching for Nvidia GPU based on Polyhedral Model
摘要
當今隨著人工智慧的普及,許多特定架構被設計來加速AI核心執行。其中一個最受
歡迎的架構是Nvidia GPU,它提供了並行執行和並行數據訪問,以提高核心計算。
在平行計算中,即使GPU提供了Warp scheduling來隱藏記憶體延遲,訪問數據仍然成
為瓶頸。然而,一些程式仍然因平行度不足或其他因素而受到記憶體存取的阻礙。
自Ampere 架構問世以來,Nvidia GPU提供了Asynchronous memory copy功能,可以在背
景將數據從global memory複製到shared memory。借助這一硬體加入,可以使用軟體預
取優化來將背景記憶體複製操作與計算重疊,從而隱藏記憶體延遲。為了保證正確
性,我們需要插入額外的控制函數來確保數據在計算前到達。
對於高階迴圈最佳化,loop interchange、peeling和splitting,多面體模型提供了許多
信息,例如記憶體訪問關係和排程,其中PPCG [1] 是一種最先進的多面體編譯器。本
研究擴展了PPCG以提供轉換後的排程和記憶體訪問信息,以生成準確的預取指令和預
取距離。帶有軟體預取的PPCG在Polybench [2]上可以獲得約7%的性能改進。
歡迎的架構是Nvidia GPU,它提供了並行執行和並行數據訪問,以提高核心計算。
在平行計算中,即使GPU提供了Warp scheduling來隱藏記憶體延遲,訪問數據仍然成
為瓶頸。然而,一些程式仍然因平行度不足或其他因素而受到記憶體存取的阻礙。
自Ampere 架構問世以來,Nvidia GPU提供了Asynchronous memory copy功能,可以在背
景將數據從global memory複製到shared memory。借助這一硬體加入,可以使用軟體預
取優化來將背景記憶體複製操作與計算重疊,從而隱藏記憶體延遲。為了保證正確
性,我們需要插入額外的控制函數來確保數據在計算前到達。
對於高階迴圈最佳化,loop interchange、peeling和splitting,多面體模型提供了許多
信息,例如記憶體訪問關係和排程,其中PPCG [1] 是一種最先進的多面體編譯器。本
研究擴展了PPCG以提供轉換後的排程和記憶體訪問信息,以生成準確的預取指令和預
取距離。帶有軟體預取的PPCG在Polybench [2]上可以獲得約7%的性能改進。
Software Prefetching for Nvidia GPU based on Polyhedral Model
Student : Chia-Wei, Wang Advisor: Dr. Wuu Yang
Institute of Data Science and Engineering
National Yang Ming Chiao Tung University
Abstract
With AI becoming more and more popular these days, lots of specific architectures are de-
signed to accelerate AI kernel execution. The specific hardware tried to overcome the bottleneck
of memory traffic on CPU by One of the most popular architectures is the Nvidia GPU, which
provide parallel execution and parallel data access at the same time to boost kernel computation.
In parallel computation, accessing data becomes the bottleneck, despite GPUs provides
Warp scheduling to hide memory latency. Nonetheless, some programs are still blocked by
memory access due to insufficient parallelism or other factors. Since the advent of Ampere ar-
chitecture, Nvidia GPUs have provided Asynchronous memory copy functions, which can copy
data from global memory to shared memory in the background. With this hardware advance-
ment, software prefetch optimizations can be employed to overlap memory copy operations in
the background with computations, which can hide memory latency. To guarantee the correct-
ness, we need to insert extra control functions to make sure data arrived.
For the high level loop transformations, such as loop tiling, peeling and interchange, poly-
hedral model provides lots of information such as memory access relation and schedule where
PPCG [1] is one of the state-of-art polyhedral compiler. This study extends PPCG to provide
transformed schedule and the memory access information to generate accurate prefetch instruc-
tions and prefetch distance. PPCG with software prefetch can gain around 7% of performance
improvement on Polybench [2]
Student : Chia-Wei, Wang Advisor: Dr. Wuu Yang
Institute of Data Science and Engineering
National Yang Ming Chiao Tung University
Abstract
With AI becoming more and more popular these days, lots of specific architectures are de-
signed to accelerate AI kernel execution. The specific hardware tried to overcome the bottleneck
of memory traffic on CPU by One of the most popular architectures is the Nvidia GPU, which
provide parallel execution and parallel data access at the same time to boost kernel computation.
In parallel computation, accessing data becomes the bottleneck, despite GPUs provides
Warp scheduling to hide memory latency. Nonetheless, some programs are still blocked by
memory access due to insufficient parallelism or other factors. Since the advent of Ampere ar-
chitecture, Nvidia GPUs have provided Asynchronous memory copy functions, which can copy
data from global memory to shared memory in the background. With this hardware advance-
ment, software prefetch optimizations can be employed to overlap memory copy operations in
the background with computations, which can hide memory latency. To guarantee the correct-
ness, we need to insert extra control functions to make sure data arrived.
For the high level loop transformations, such as loop tiling, peeling and interchange, poly-
hedral model provides lots of information such as memory access relation and schedule where
PPCG [1] is one of the state-of-art polyhedral compiler. This study extends PPCG to provide
transformed schedule and the memory access information to generate accurate prefetch instruc-
tions and prefetch distance. PPCG with software prefetch can gain around 7% of performance
improvement on Polybench [2]