标题: | 转换OpenACC到LLVM中间转换码同Metadata在Clang上 Translating OpenACC to LLVM IR with Metadata on Clang |
作者: | 朱靖宇 Chu, Ching-Yu 单智君 Shann, Jyh-Jiun 资讯科学与工程研究所 |
关键字: | 异质性多处理器平台;OpenACC 编译器;OpenCL;LLVM;Clang;LLVM metadata;heterogeneous multiprocessor platforms;OpenACC compiler;OpenCL;LLVM;Clang;LLVM metadata |
公开日期: | 2015 |
摘要: | 近年来,多处理器平台(Multiprocessor Platform)已经成为加速程式的一种趋势。多处理器平台一般可以分为两种形式: 同质(homogeneous)和异质(heterogeneous)。对于某些可以平行化的程式而言,异质多处理器平台通常可以得到比同质多处理器平台更高的效能和能源效率。然而,由于资料的管理和各个处理器之间的沟通,撰写异质多核心程式会比同质多核心程式来的更加困难。虽然 Knronos Group 新释出了 OpenCL 标准,改善了异质多核心程式的可携性,但使用 OpenCL 来撰写异质多核心程式依然是复杂且容易出错的。因此,我们打算设计一个基于 LLVM 的 OpenACC 编译器来自动转换 OpenACC 的程式成 OpenCL 的程式。在本篇论文中,我们设计并且实作 LLVM 的其中一个前端 Clang 的一个延伸版本,藉由 LLVM metadata 来保留关于 OpenACC directives 和 clauses 的资讯,因为这些资讯将会被原本的 Clang 忽略。我们修改后的 Clang 将会把一个 OpenACC 的程式转换成 LLVM IR 附上 metadata 。而后,透过本实验室之前设计的 OCLHKIR generator 和 LLVM OpenCL Backend 将会分析这些 metadata ,进而产生 host LLVM IR 和 OpenCL核心函数(kernel function),再利用 LLVM 之即时编译器(Just-in-time Compiler, JIT Compiler)执行 host LLVM IR。实验结果显示出,我们的 OpenACC 编译器可以产生出效能接近 PGI OpenACC 编译器与手写 OpenCL 程式的程式码。因此,我们提出的 OpenACC 编译器不仅可以降低撰写 OpenCL 程式的难度,也同时转换出具有高效能的 OpenCL 程式。 Recently, multiprocessor platforms has become trends for accelerating programs. It generally can be divided into two types: homogeneous and heterogeneous. Heterogeneous multiprocessor platforms usually get higher performance and energy efficiency than homogeneous ones on the programs which can be parallelized. However, it is more difficult to write programs for heterogeneous multiprocessor platforms than for homogeneous ones due to data management and communication between various processors. Although newly-released OpenCL standard from Khronos Group offers improves portability among heterogeneous multiprocessor platforms, programming on such platforms using OpenCL is still complex and error-prone. Therefore, we intend to design an OpenACC compiler based on LLVM for automatically translating the OpenACC program into OpenCL program. In this thesis, we design and implement an extension version of Clang, one of the front-ends of LLVM, to preserve the information of OpenACC directives and clauses as LLVM metadata, since these information will be ignored by the original Clang. Our modified Clang will translate an OpenACC program into LLVM IR with metadata. After that, the OCLHKIR generator and the OpenCL Back-end, designed by our previous researches, will analyze the metadata and then generate the host LLVM IR and the OpenCL kernel functions. Then we execute the host LLVM IR by LLVM JIT-compiler. The experiment result shows that our OpenACC compiler can generate the codes with competitive performance to PGI OpenACC compiler and the manual OpenCL programs. Therefore, our proposed OpenACC compiler not only reduce the difficulty of writing OpenCL programs, but also translate the high performance OpenCL programs. |
URI: | http://140.113.39.130/cdrfb3/record/nctu/#GT070256127 http://hdl.handle.net/11536/127408 |
显示于类别: | Thesis |