Skip to content

Commit

Permalink
Merge pull request #1403 from JackAKirk/fix-events-wait-context
Browse files Browse the repository at this point in the history
[cuda][hip] Removed bad event wait constraint / use scopedContext correctly.
  • Loading branch information
kbenzie authored Mar 18, 2024
2 parents 94af6e3 + f2573e8 commit db4b0c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
7 changes: 2 additions & 5 deletions source/adapters/cuda/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventSetCallback(ur_event_handle_t,
UR_APIEXPORT ur_result_t UR_APICALL
urEventWait(uint32_t numEvents, const ur_event_handle_t *phEventWaitList) {
try {
auto Context = phEventWaitList[0]->getContext();
ScopedContext Active(Context);
ScopedContext Active(phEventWaitList[0]->getContext());

auto WaitFunc = [Context](ur_event_handle_t Event) -> ur_result_t {
auto WaitFunc = [](ur_event_handle_t Event) -> ur_result_t {
UR_ASSERT(Event, UR_RESULT_ERROR_INVALID_EVENT);
UR_ASSERT(Event->getContext() == Context,
UR_RESULT_ERROR_INVALID_CONTEXT);

return Event->wait();
};
Expand Down
7 changes: 1 addition & 6 deletions source/adapters/hip/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,9 @@ urEventWait(uint32_t numEvents, const ur_event_handle_t *phEventWaitList) {
UR_ASSERT(numEvents > 0, UR_RESULT_ERROR_INVALID_VALUE);

try {

auto Context = phEventWaitList[0]->getContext();
ScopedContext Active(phEventWaitList[0]->getDevice());

auto WaitFunc = [Context](ur_event_handle_t Event) -> ur_result_t {
auto WaitFunc = [](ur_event_handle_t Event) -> ur_result_t {
UR_ASSERT(Event, UR_RESULT_ERROR_INVALID_EVENT);
UR_ASSERT(Event->getContext() == Context,
UR_RESULT_ERROR_INVALID_CONTEXT);

return Event->wait();
};
Expand Down

0 comments on commit db4b0c1

Please sign in to comment.