A source-to-source CUDA to SYCL code migration tool: Intel® DPC++ Compatibility Tool

oneAPI [1] is an industry initiative creating an open, standards-based, cross-architecture programming model to simplify development for a wide range of data-centric workloads across a variety of architectures including CPU, GPU, FPGA, and other accelerators. It includes a cross-architecture compiler, Data Parallel C++ (DPC++), [2] to support ISO C++ and Khronos Group's SYCL [3] and advanced libraries. Intel has created a product implementation of oneAPI with the Intel oneAPI Toolkits. These help developers efficiently build, analyze, and optimize high-performance, cross-architecture applications for CPUs, GPUs, and FPGAs. SYCL [3] is an open standard from Khronos for a portable, architecture-neutral language for expressing parallelism. The SYCL specification can be implemented by anybody for any platform. To take advantage of oneAPI and SYCL, for applications written in another language e.g., CUDA, developers seek to migrate existing code to SYCL. Once a customer migrates their code to SYCL, they are no longer tied to a single platform and can run the code on any platform that has SYCL compiler support. Intel® DPC++ Compatibility Tool is included in the Intel® oneAPI Base Toolkit, it is a tool that assists developers to do source-to-source migration, e.g., migrate code written in CUDA to SYCL code [3] to enable their code to run on multiple platforms. The tool generates human readable and maintainable code whenever possible and provides inline comments to help developers complete their code. Typically, about 90-95% of CUDA code in applications can be migrated by this tool.1 Completion of the code and verification of the final code is expected to be a manual process done by the developers. The goal of the compatibility tool is to make it as easy as possible for developers to migrate their existing CUDA codebase to SYCL to facilitate more hardware choices and access to the advantages of oneAPI and SYCL. The compatibility tool is based on LLVM/Clang [4]. It mainly contains 3 functional components: • The intercept-build tool: It is used to collect compilation options of the user input project by intercepting build process of user input project, like build option, macro definitions, include folders and so on information. During source-to-source migration, those compilation options are used to identify the active code path, header files dependencies to build a right abstract syntax tree for the user input project. • The ‘dpct’ binary tool: The tool is the main migration tool, which does source-to-source migration based on compiler front end technology. It implements a set of migration rules to migrate source language elements like types, APIs, macros to functionally compatible elements in target language. If some C/C++ code is the same between source and target language, then the tool keeps this C/C++ code unchanged. Also, the tool provides a way to let users define migration rules by themselves in migration rule description file to guide a customized migration. • Helper header library: It provides helper functions and macros to assist the migration of input source code. These header files written in C/C++/SYCL are intended to become part of migrated code generated by the compatibility tool. User can copy these header files if needed and include them with the generated code. The compatibility tool can assist developers to migrate code written in CUDA to code written in SYCL with proper performance, minimizing developer's efforts. The tool can enrich the oneAPI ecosystem by assisting developers in migration of more applications to SYCL running on oneAPI. Notices & Disclaimers Intel technologies may require enabled hardware, software or service activation. No product or component can be absolutely secure. Your costs and results may vary. © Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.