A DCU code generation and optimization method based on polyhedral model
Jingyu Niu, Wei Gao, Lin Han, Jianan Li, Bing Chai · 2023
The domestic processor DCU(Deep Computing Unit) is a GPU-like accelerator. To address the problem that DCU lacks more effective compilation and optimization tools, a DCU code generation and optimization method based on polyhedral model is proposed. First, a source-to-source compiler C2HIPC is implemented based on the polyhedral model. The input of C2HIPC is a serial C program, and the output is a HIP (Heterogeneous-compute Interface for Portability) executable on the DCU; secondly, to further improve the heterogeneous performance of the program, a kernel partitioning method based on computing unit occupancy is proposed, which completes the kernel partitioning by limiting loop merging in the polyhedral schedule calculation; at the same time, a global memory access optimization method based on data reuse is proposed, By modeling the two kinds of data reuse and global memory access costs existing in the DCU kernel, the global memory access costs in different loop orders are calculated. Using the PolyBench test set to verify the effectiveness of C2HIPC, the performance of the automatically generated HIP code after C2HIPC optimization reaches 92.4% of that of PolyBench-GPU.