Skip to content

Commit 4f9935a

Browse files
[SYCL] Ensure correct errc thrown for unassociated placeholder accessor (4.7.6.9) (#5737)
A simple fix for ensuring correct errc is thrown for an unassociated placeholder accessor (4.7.6.9) Note that this fix is not complete. It only addresses the most common cases. There are still cases where an unassociated placeholder accessor could get by undetected and crash in the kernel. Unfortunately, the fix for those cases is not trivial. I have the outlines of a fix, but it would be disruptive, too disruptive for such a low priority fix. I will open a ticket about it and discuss it with various stakeholders. Expanded testing to cover this here: intel/llvm-test-suite#890 Signed-off-by: Chris Perkins [email protected]
1 parent 15c096f commit 4f9935a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sycl/source/detail/scheduler/commands.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,9 +1987,11 @@ static pi_result SetKernelParamsAndLaunch(
19871987
break;
19881988
case kernel_param_kind_t::kind_accessor: {
19891989
Requirement *Req = (Requirement *)(Arg.MPtr);
1990-
assert(getMemAllocationFunc != nullptr &&
1991-
"The function should not be nullptr as we followed the path for "
1992-
"which accessors are used");
1990+
if (getMemAllocationFunc == nullptr)
1991+
throw sycl::exception(make_error_code(errc::kernel_argument),
1992+
"placeholder accessor must be bound by calling "
1993+
"handler::require() before it can be used.");
1994+
19931995
RT::PiMem MemArg = (RT::PiMem)getMemAllocationFunc(Req);
19941996
if (Plugin.getBackend() == backend::opencl) {
19951997
Plugin.call<PiApiKind::piKernelSetArg>(Kernel, NextTrueIndex,

0 commit comments

Comments
 (0)