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() {
3592
3592
3593
3593
return UR_RESULT_SUCCESS;
3594
3594
}
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
+ }
3599
3610
}
3600
3611
return UR_RESULT_ERROR_INVALID_OPERATION;
3601
3612
}
Original file line number Diff line number Diff line change @@ -496,21 +496,8 @@ event handler::finalize() {
496
496
MCodeLoc));
497
497
break ;
498
498
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));
514
501
break ;
515
502
}
516
503
Original file line number Diff line number Diff line change @@ -26,18 +26,11 @@ void test_host_task_dep() {
26
26
auto empty_cg_event =
27
27
q.submit ([&](handler &cgh) { cgh.depends_on (host_event); });
28
28
29
- // FIXME: This should deadlock, but the dependency is ignored currently.
30
- empty_cg_event.wait ();
31
-
32
29
assert (x == 0 );
33
30
start_execution.count_down ();
34
31
35
32
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 );
41
34
}
42
35
43
36
void test_device_event_dep () {
@@ -53,17 +46,12 @@ void test_device_event_dep() {
53
46
auto empty_cg_event =
54
47
q.submit ([&](handler &cgh) { cgh.depends_on (device_event); });
55
48
56
- // FIXME: This should deadlock, but the dependency is ignored currently.
57
- empty_cg_event.wait ();
58
-
59
49
assert (*p == 0 );
60
50
start_execution.count_down ();
61
51
62
52
empty_cg_event.wait ();
63
- // FIXME: uncomment once the bug mentioned above is fixed.
64
- // assert(*p == 42);
53
+ assert (*p == 42 );
65
54
66
- q.wait ();
67
55
sycl::free (p, q);
68
56
}
69
57
@@ -90,17 +78,12 @@ void test_accessor_dep() {
90
78
auto empty_cg_event =
91
79
q.submit ([&](handler &cgh) { sycl::accessor a{b, cgh}; });
92
80
93
- // FIXME: This should deadlock, but the dependency is ignored currently.
94
- empty_cg_event.wait ();
95
-
96
81
assert (*p == 0 );
97
82
start_execution.count_down ();
98
83
99
84
empty_cg_event.wait ();
100
- // FIXME: uncomment once the bug mentioned above is fixed.
101
- // assert(*p == 42);
85
+ assert (*p == 42 );
102
86
103
- q.wait ();
104
87
sycl::free (p, q);
105
88
}
106
89
You can’t perform that action at this time.
0 commit comments