intel / intel/llvm

Unsupported device info queries throw runtime_error instead of feature_not_supported

Open
#15,485 0 comments 0 reactions 0 assignees View on GitHub
bug cuda
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

### 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](https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_intel_device_info.md#intel-gpu-number-of-slices) 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:
```c++
#include

int main(int argc, char* argv[])
{
sycl::queue q;
q.get_device().get_info();
}
```
To build and run:
```sh
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.