-
Notifications
You must be signed in to change notification settings - Fork 73
Closed
Labels
clarificationSomething is unclearSomething is unclear
Description
The specification says:
This function may only be called from within a command.
...but it doesn't say what should happen if either function is called from outside of a command. An implementation is free to return any pointer (including a NULL pointer) which may result in bugs that are difficult to track down or understand. I've seen code like the below hang or segfault across different devices:
q.submit([&](sycl::handler &h) {
// This is an (undiagnosed) error, because get_multi_ptr is called on the host
ptr = buf.get_access<sycl::access::mode::read_write, sycl::access::target::device>(h)
.get_multi_ptr<sycl::access::decorated::no>();
h.parallel_for(..., [=](sycl::nd_item<1> it) {
foo(ptr); // The pointer passed to the device code is undefined
});
});Is there a reason that we cannot define get_multi_ptr() to throw an error when called on the host?
If this is intended to be undefined behavior, I think the specification should state that explicitly. But an error would be more useful to developers.
Metadata
Metadata
Assignees
Labels
clarificationSomething is unclearSomething is unclear