-
Notifications
You must be signed in to change notification settings - Fork 807
Open
Labels
Description
Describe the bug
sycl::device_malloc
, per the spec v2020 r7, should throw when the device does not support USM:
Throws a synchronous exception with the
errc::feature_not_supported
error code if thesyclDevice
does not haveaspect::usm_device_allocations
.
However, when used with Mesa Rusticl backend, which does not support USM, it calmly returns 0 instead.
This seems to also affect other sycl:malloc_X
functions.
To Reproduce
#include <iostream>
#include <sycl/sycl.hpp>
int main(int, char **) {
for (const auto &device : sycl::device::get_devices()) {
sycl::queue queue(device);
std::cout << "Running on " << device.get_info<sycl::info::device::name>()
<< "\n";
std::cout << "usm_device_allocations: "
<< device.has(sycl::aspect::usm_device_allocations) << std::endl;
float *d_buf = sycl::malloc_device<float>(1, queue);
std::cout << "malloc_device returned: " << d_buf << std::endl;
}
return 0;
}
$ clang++ -fsycl hello_sycl_usm.cpp -o hello_sycl_usm
# Running on AMD GPU via Mesa OpenCL, usm_device_allocations not supported:
$ ONEAPI_DEVICE_SELECTOR=opencl:2 RUSTICL_ENABLE=radeonsi ./hello_sycl_usm
Running on AMD Radeon RX 6400 (navi24, LLVM 15.0.7, DRM 3.49, 6.2.8-060208-generic)
usm_device_allocations: 0
malloc_device returned: 0
Environment (please complete the following information):
- OS: Ubuntu 22.04
- Target device and vendor: Intel GPU, AMD GPU
- DPC++ version: 6581bc0
- Dependencies version: Mesa 23.1.0 from https://launchpad.net/~kisak/+archive/ubuntu/kisak-mesa
biergaizi