Skip to content

Commit 1cf697b

Browse files
authored
[SYCL] Align behavior of empty command groups with SYCL2020 (#3822)
Signed-off-by: mdimakov <[email protected]>
1 parent 541e697 commit 1cf697b

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

sycl/source/handler.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,13 @@ event handler::finalize() {
203203
std::move(MRequirements), std::move(MEvents), MCGType, MCodeLoc));
204204
break;
205205
case detail::CG::NONE:
206-
throw runtime_error("Command group submitted without a kernel or a "
207-
"explicit memory operation.",
208-
PI_INVALID_OPERATION);
206+
if (detail::pi::trace(detail::pi::TraceLevel::PI_TRACE_ALL)) {
207+
std::cout << "WARNING: An empty command group is submitted." << std::endl;
208+
}
209+
detail::EventImplPtr Event =
210+
std::make_shared<cl::sycl::detail::event_impl>();
211+
MLastEvent = detail::createSyclObjFromImpl<event>(Event);
212+
return MLastEvent;
209213
}
210214

211215
if (!CommandGroup)

sycl/test/basic_tests/event_async_exception.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ int main() {
2828
queue q(asyncHandler);
2929

3030
try {
31-
// Submit a CG with no kernel or memory operation to trigger an async error
31+
// Check that submitting a CG with no kernel or memory operation doesn't produce
32+
// an async exception
3233
event e = q.submit([&](handler &cgh) {});
3334

3435
e.wait_and_throw();
35-
return 1;
36-
} catch (runtime_error e) {
3736
return 0;
37+
} catch (runtime_error e) {
38+
return 1;
3839
}
3940
}

0 commit comments

Comments
 (0)