How to generate C/C++ device code from ComputeCPP

Hi all,

I am developing HPC application using SYCL. But I want to know how device code will be outlined and lowered as OpenCL kernel. And we knew device code can be built as SPIRV module using ComputeCPP with target=spir. Are there any methods to generate C/C++ device code instead SPIRV?

Thanks,
Roger Lai

Hi,

slight typo, -sycl-target=spir will generate SPIR, not SPIR-V. For SPIR-V you’d need spirv, or preferably also include the bitness, e.g. spirv64.

To answer your question, no, compute++ does not support outputting C or C++ device code. We only support SPIR, SPIR-V, experimentally PTX, and the Professional Edition of ComputeCpp supports offline (AOT) compilation to X86 or ARM code.

May I ask, what is your interest in seeing generated C or C++ code? Would SPIR or SPIR-V not be sufficient for that?

Hi Peter,

First of all, thanks for your response.

For code generation to C/C++, I’m just curious to know how device code is extracted from single-source and what the device kernel will be transformed to. C/C++ is more readable to me.

May I ask another question about migration tool from Cuda to SYCL? Do you know if the codeplay company provides migration tools (like oneAPI migration tool) whether it is free or paid?

Thanks,
Roger

Hi Roger, Codeplay doesn’t have their own tool for CUDA to SYCL migration, you would be best using the DPC++ Compatibility tool. We do have some guides that might help you here.

Hi Rod,

Appreciate your response. There is another question about sycl math libray.

Does Codeplay have their own math library for sycl such as oneMKL?

Thanks,

Roger

Hi Roger,
I think the thing to bear in mind is that there should be compatibility with something like oneMKL and any SYCL implementation, since the kernels are mostly standard SYCL code. So while it might not work out of the box at the moment using ComputeCpp it should not be too difficult to get it working. The closest equivalent would be SYCL BLAS, what math operations are you looking for?