ComputeCpp with PTX for NVIDIA® Devices
Support for PTX with ComputeCpp was added in 2017 and enabled SYCL developers to target Nvidia devices using OpenCL and the PTX instruction set. See our blog for more background on this.
In November 2020 Codeplay has marked this feature as "unsupported" which means that it may work but we are not actively maintaining it. This is because we are focused on our work to add Nvidia device support to DPC++, you can find out more about this work here.
Note that this is limited, although the code generation is ready, the builtin support is limited. OpenCL builtins still need to be mapped to their PTX counterparts.
Usage
The computecpp_info tool will list Nvidia devices, just call the computecpp_info tool as you would normally. Note they will be listed as unsupported devices but it is still possible to target them using ptx.
computecpp_info
It's possible to build the ComputeCpp SDK samples for ptx however some of the samples will fail to execute properly. Clone the repository, create a "build" folder and from that folder use the following command.
cmake -DComputeCpp_DIR=/path/to/ComputeCpp/ -DCOMPUTECPP_BITCODE=ptx64 ..
make
It's now possible to execute the samples, e.g.
./samples/hello-world/hello-world
Note: The following ComputeCpp SDK samples fail, and this is a known issue: images, gaussian-blur, tiled-convolution, custom-device-selector.
If you want to try out this experimental support without using CMake, there is a compiler flag that is used when compiling your SYCL source code:
For example:
compute++ -sycl -sycl-target ptx64