Description
Describe the bug
The sycl::plarform()
constructor return a platform with no device. This is forbidden by the spec. But maybe I do something wronrg...
To Reproduce
$cat foo.cpp
#include <CL/sycl.hpp>
namespace sycl = cl::sycl;
int main() {
#ifdef DEFAULT
sycl::platform P = sycl::platform(sycl::default_selector{});
#else
sycl::platform P = sycl::platform();
#endif
assert(!P.get_devices().empty());
}
$dpcpp foo.cpp
$./a.out
a.out: foo.cpp:10: int main(): Assertion `!P.get_devices().empty()' failed.
Aborted
Environment (please complete the following information):
- OS: Linux
- Target device and vendor: Intel GPU / OpenCL / Level 0
- DPC++ version: 2021.x.0.20210819
Additional context
https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:platform-class
said for the platform()
constructor:
Constructs a SYCL platform instance that is a copy of the platform which contains the device returned by default_selector_v.
This doesn't seem to be the case here. As the spec said for default_selector_v
:
Since all implementations must support at least one device, this selector must always return a device.
But our platform is empty. Also, Compiling the code with -DDEFAULT
behaves as expected and returns a platform with at least one device.
Don't hesitate if you have any questions,