%A CHEN Yuqiao,SUN Yufei,CHENG Daguo,ZHANG Yuzhi,ZHOU Jianyu,SUI Yicheng,SHI Changqing %T Design and Implementation of Testing and Verification Method for OpenCL Kernels in TensorFlow %0 Journal Article %D 2022 %J Frontiers of Data and Computing %R 10.11871/jfdc.issn.2096-742X.2022.02.002 %P 17-28 %V 4 %N 2 %U {http://www.jfdc.cnic.cn/CN/abstract/article_194.shtml} %8 2022-04-20 %X

[Objective] TensorFlow is the most representative deep learning framework in the field of artificial intelligence. The domestic acceleration device needs a version of TensorFlow with OpenCL support to take advantage of its acceleration performance, for which the CUDA code in TensorFlow needs to be converted to OpenCL code. How to verify the correctness of the OpenCL kernels is an important problem in the development task. [Methods] Based on the TensorFlow raw ops test interface and TensorFlow custom op implemented by the dynamic link library, this paper proposes a test scheme for OpenCL kernels, including the source code design rules of the custom op, test code rules, code review methods, and test process. [Results] This paper implements the review and testing of 135 OpenCL kernel function codes, tests and compares them under various data types and data scales, and completes the verification of the correctness of the OpenCL kernels and their performance comparison with the CUDA kernels. [Conclusions] This paper provides a reliable and effective approach for testing OpenCL kernels based on TensorFlow.