Frontiers of Data and Computing ›› 2022, Vol. 4 ›› Issue (2): 17-28.

doi: 10.11871/jfdc.issn.2096-742X.2022.02.002

• Special Issue: Advanced Intelliget Computing Platform and Application • Previous Articles     Next Articles

Design and Implementation of Testing and Verification Method for OpenCL Kernels in TensorFlow

CHEN Yuqiao(),SUN Yufei*(),CHENG Daguo(),ZHANG Yuzhi(),ZHOU Jianyu(),SUI Yicheng(),SHI Changqing()   

  1. College of Software, Nankai University, Tianjin 300350, China
  • Received:2022-02-16 Online:2022-04-20 Published:2022-04-30
  • Contact: SUN Yufei E-mail:ujoenk@mail.nankai.edu.cn;yufei_sun@sina.com;chengdaguo@mail.nankai.edu.cn;zyz@nankai.edu.cn;jyzhou@nankai.edu.cn;suiyicheng@mail.nankai.edu.cn;shichangqing@mail.nankai.edu.cn

Abstract:

[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.

Key words: TensorFlow, CUDA, OpenCL, code review, code testing