File tree Expand file tree Collapse file tree 3 files changed +20
-39
lines changed Expand file tree Collapse file tree 3 files changed +20
-39
lines changed Original file line number Diff line number Diff line change @@ -3592,10 +3592,21 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
35923592
35933593 return UR_RESULT_SUCCESS;
35943594 }
3595- case CGType::None:
3596- throw sycl::exception (sycl::make_error_code (sycl::errc::runtime),
3597- " CG type not implemented. " +
3598- codeToString (UR_RESULT_ERROR_INVALID_OPERATION));
3595+ case CGType::None: {
3596+ if (RawEvents.empty ()) {
3597+ // urEnqueueEventsWait with zero events acts like a barrier which is NOT
3598+ // what we want here. On the other hand, there is nothing to wait for, so
3599+ // we don't need to enqueue anything.
3600+ return UR_RESULT_SUCCESS;
3601+ }
3602+ const detail::AdapterPtr &Adapter = MQueue->getAdapter ();
3603+ ur_event_handle_t Event;
3604+ ur_result_t Result = Adapter->call_nocheck <UrApiKind::urEnqueueEventsWait>(
3605+ MQueue->getHandleRef (), RawEvents.size (),
3606+ RawEvents.size () ? &RawEvents[0 ] : nullptr , &Event);
3607+ MEvent->setHandle (Event);
3608+ return Result;
3609+ }
35993610 }
36003611 return UR_RESULT_ERROR_INVALID_OPERATION;
36013612}
Original file line number Diff line number Diff line change @@ -496,21 +496,8 @@ event handler::finalize() {
496496 MCodeLoc));
497497 break ;
498498 case detail::CGType::None:
499- if (detail::ur::trace (detail::ur::TraceLevel::TRACE_ALL)) {
500- std::cout << " WARNING: An empty command group is submitted." << std::endl;
501- }
502-
503- // Empty nodes are handled by Graph like standard nodes
504- // For Standard mode (non-graph),
505- // empty nodes are not sent to the scheduler to save time
506- if (impl->MGraph || (MQueue && MQueue->getCommandGraph ())) {
507- CommandGroup.reset (new detail::CG (detail::CGType::None,
508- std::move (impl->CGData ), MCodeLoc));
509- } else {
510- detail::EventImplPtr Event = std::make_shared<sycl::detail::event_impl>();
511- MLastEvent = detail::createSyclObjFromImpl<event>(Event);
512- return MLastEvent;
513- }
499+ CommandGroup.reset (new detail::CG (detail::CGType::None,
500+ std::move (impl->CGData ), MCodeLoc));
514501 break ;
515502 }
516503
Original file line number Diff line number Diff line change @@ -26,18 +26,11 @@ void test_host_task_dep() {
2626 auto empty_cg_event =
2727 q.submit ([&](handler &cgh) { cgh.depends_on (host_event); });
2828
29- // FIXME: This should deadlock, but the dependency is ignored currently.
30- empty_cg_event.wait ();
31-
3229 assert (x == 0 );
3330 start_execution.count_down ();
3431
3532 empty_cg_event.wait ();
36- // FIXME: uncomment once the bug mentioned above is fixed.
37- // assert(x == 42);
38-
39- // I'm seeing some weird hang without this:
40- host_event.wait ();
33+ assert (x == 42 );
4134}
4235
4336void test_device_event_dep () {
@@ -53,17 +46,12 @@ void test_device_event_dep() {
5346 auto empty_cg_event =
5447 q.submit ([&](handler &cgh) { cgh.depends_on (device_event); });
5548
56- // FIXME: This should deadlock, but the dependency is ignored currently.
57- empty_cg_event.wait ();
58-
5949 assert (*p == 0 );
6050 start_execution.count_down ();
6151
6252 empty_cg_event.wait ();
63- // FIXME: uncomment once the bug mentioned above is fixed.
64- // assert(*p == 42);
53+ assert (*p == 42 );
6554
66- q.wait ();
6755 sycl::free (p, q);
6856}
6957
@@ -90,17 +78,12 @@ void test_accessor_dep() {
9078 auto empty_cg_event =
9179 q.submit ([&](handler &cgh) { sycl::accessor a{b, cgh}; });
9280
93- // FIXME: This should deadlock, but the dependency is ignored currently.
94- empty_cg_event.wait ();
95-
9681 assert (*p == 0 );
9782 start_execution.count_down ();
9883
9984 empty_cg_event.wait ();
100- // FIXME: uncomment once the bug mentioned above is fixed.
101- // assert(*p == 42);
85+ assert (*p == 42 );
10286
103- q.wait ();
10487 sycl::free (p, q);
10588}
10689
You can’t perform that action at this time.
0 commit comments