Skip to content

Bad error message when SYCL app is not built for the device #21627

@Maetveis

Description

@Maetveis

Describe the bug

If an application for example is built for NVIDIA GPUs with -fsycl-targets=nvptx64 but then run on a device with an Intel GPU only, an error like this is reported:

icpx -fsycl -fsycl-targets=nvptx64-nvidia-cuda main.cpp./a.out
terminate called after throwing an instance of 'sycl::_V1::exception'
  what():  No kernel named _ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_EUlvE_ was found
[1]    415163 IOT instruction (core dumped)  ./a.out

Probably the other way around the same happens, but I don't have access to machine with an NVIDIA GPU to test.

To reproduce

  1. Include a code snippet that is as short as possible
#include <sycl/sycl.hpp>

int main() {
    sycl::queue q;

    int *d_result = sycl::malloc_device<int>(1, q);
    q.submit([&](sycl::handler &cgh) {
      cgh.single_task([=]() { *d_result = 1; });
    });

    return 0;
}
  1. Specify the command which should be used to compile the program
clang -fsycl -fsycl-targets=nvptx64-nvidia-cuda main.cpp
  1. Specify the command which should be used to launch the program
./a.out
  1. Indicate what is wrong and what was expected
    The error message from the SYCL runtime looks like this:
No kernel named _ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_EUlvE_ was found

this is pretty bad, we get a mangled name for the kernel lambda that's very intimidating, but is just noise, but no actual indication that the problem could be with how the application was built.

Environment

  • OS: Linux
  • Target device and vendor: Mixed
  • DPC++ version:
  • Dependencies version:

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestruntimeRuntime library related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions