Skip to content

Unsupported device info queries throw runtime_error instead of feature_not_supported #15485

Open
@Pennycook

Description

@Pennycook

Describe the bug

Trying to query sycl::ext::intel::info::device::gpu_slices on an NVIDIA GPU causes the program to abort with the message:

terminate called after throwing an instance of 'sycl::_V1::runtime_error'
  what():  Native API failed. Native API returns: -30 (PI_ERROR_INVALID_VALUE) -30 (PI_ERROR_INVALID_VALUE)
Aborted (core dumped)

...which doesn't provide any useful information about what went wrong or how to fix it.

The extension specification says that the implementation should throw errc::feature_not_supported, so we should produce a message like:

terminate called after throwing an instance of 'sycl::_V1::feature_not_supported'
  what():  Device does not support sycl::ext::intel::info::device::gpu_slices. -59 (PI_ERROR_INVALID_OPERATION)
Aborted (core dumped)

To reproduce

test.cpp:

#include <sycl/sycl.hpp>

int main(int argc, char* argv[])
{
  sycl::queue q;
  q.get_device().get_info<sycl::ext::intel::info::device::gpu_slices>();
}

To build and run:

icpx -O3 -g -fsycl -fsycl-targets=nvptx64-nvidia-cuda test.cpp
./a.out

Output:

terminate called after throwing an instance of 'sycl::_V1::runtime_error'
  what():  Native API failed. Native API returns: -30 (PI_ERROR_INVALID_VALUE) -30 (PI_ERROR_INVALID_VALUE)
Aborted (core dumped)

Environment

  • OS: Linux
  • Target device and vendor: NVIDIA H100
  • DPC++ version: Intel(R) oneAPI DPC++/C++ Compiler 2024.2.1 (2024.2.1.20240711) + Codeplay plugin
  • Dependencies version: CUDA version 12.4, driver 550.90.07

Additional context

I've filed this as a CUDA bug because that's where I've seen the issue. It may be that the issue is broader than this, but I have no way to test unsupported queries on other backends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcudaCUDA back-end

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions