High-Performance GPU-to-CPU Transpilation and Optimization via High-Level Parallel Constructs
Massachusetts Institute of Technology, USA
arXiv:2207.00257 [cs.PL], (1 Jul 2022)
@misc{https://doi.org/10.48550/arxiv.2207.00257,
doi={10.48550/ARXIV.2207.00257},
url={https://arxiv.org/abs/2207.00257},
author={Moses, William S. and Ivanov, Ivan R. and Domke, Jens and Endo, Toshio and Doerfert, Johannes and Zinenko, Oleksandr},
keywords={Programming Languages (cs.PL), Distributed, Parallel, and Cluster Computing (cs.DC), FOS: Computer and information sciences, FOS: Computer and information sciences},
title={High-Performance GPU-to-CPU Transpilation and Optimization via High-Level Parallel Constructs},
publisher={arXiv},
year={2022},
copyright={arXiv.org perpetual, non-exclusive license}
}
While parallelism remains the main source of performance, architectural implementations and programming models change with each new hardware generation, often leading to costly application re-engineering. Most tools for performance portability require manual and costly application porting to yet another programming model. We propose an alternative approach that automatically translates programs written in one programming model (CUDA), into another (CPU threads) based on Polygeist/MLIR. Our approach includes a representation of parallel constructs that allows conventional compiler transformations to apply transparently and without modification and enables parallelism-specific optimizations. We evaluate our framework by transpiling and optimizing the CUDA Rodinia benchmark suite for a multi-core CPU and achieve a 76% geomean speedup over handwritten OpenMP code. Further, we show how CUDA kernels from PyTorch can efficiently run and scale on the CPU-only Supercomputer Fugaku without user intervention. Our PyTorch compatibility layer making use of transpiled CUDA PyTorch kernels outperforms the PyTorch CPU native backend by 2.7x.
July 10, 2022 by hgpu