Single binary with -sycl-target ptx64 and host cpu?

Is it possible to build a binary that supports both the native cpu target (intel opencl) and nVIDIA ptx64?

When I build with -sycl-target ptx64 I can run on nVIDIA but not on the host cpu?

Running on Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz  - Intel(R) Corporation
Error: [ComputeCpp:RT0107] Failed to create program from binary

Hi Jan, this isn’t currently possible but is something we are looking into.

1 Like

Hi Jan,
I think you can build for the PTX backend, and still run on the host CPU if you explicitly select the host “device”.

For example:

  cl::sycl::device device;
  try {
    // try to select a SPIR or PTX backend
    device = cl::sycl::device(cl::sycl::default_selector());
  } catch(cl::sycl::exception const&) {
    // fall back to the host device
    device = cl::sycl::device(cl::sycl::host_selector());
  }

Hope this helps,
.Andrea