TransCL: An Automatic CUDA-to-OpenCL Programs Transformation Framework
With the rising demand for computational power and the increasing variety of computational scenarios, considerable interest has emerged in transforming existing CUDA programs into more general-purpose OpenCL programs, enabling them to run across diverse hardware platforms. However, manual methods, typically designed for specific applications, lack flexibility. Current automated conversion techniques also face considerable challenges, particularly in handling diverse programming interfaces, memory management, and so on, and are insufficient for converting large-scale, complex CUDA projects. In this article, we propose a novel source-to-source program transformation framework, TransCL, which automates the conversion of CUDA programs in four key aspects: source code, execution model, programming model, and memory model. To achieve this, we abstract a set of conversion rules aligned with the latest CUDA standards, develop a transcoder, implement an OpenCL-compatible programming interface library, and establish a memory mapping mechanism between CUDA and OpenCL. Experiments demonstrate that TransCL provides a high level of automation in converting CUDA-based applications and is effective in handling large, complex projects such as TensorFlow. Moreover, the converted AI framework successfully conducted model training for the first time. The experiment also validates that the converted program can execute correctly across multiple platforms and demonstrate good performance.
Authors
- Ya Li Jin
- Yicheng Sui (ORCID: https://orcid.org/0000-0001-9763-7435)
- Changqing Shi (ORCID: https://orcid.org/0009-0009-5732-2207)
- Chunye Gong (ORCID: https://orcid.org/0000-0003-0349-1100)
- Jiahao Wang (ORCID: https://orcid.org/0009-0005-9125-2629)
- Rui Chen (ORCID: https://orcid.org/0009-0008-1786-2519)
- Yuzhi Zhang (ORCID: https://orcid.org/0000-0002-6729-925X)
- Qiang Guo (ORCID: https://orcid.org/0009-0001-0995-755X)
- Yufei Sun
Institutions
- National University of Defense Technology (CN)
- Nankai University (CN)
- Tianjin haihe hospital (CN)
Publication Details
- Journal
- ACM Transactions on Architecture and Code Optimization
- Published
- 2025-02-20
- DOI
- https://doi.org/10.1145/3718987
- Citations
- 1
- Primary Topic
- Parallel Computing and Optimization Techniques
- Type
- article
- Field-Weighted Citation Impact
- 2.27