Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/adapters/cuda/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ ur_event_handle_t_::ur_event_handle_t_(ur_context_handle_t Context,
CUevent EventNative)
: CommandType{UR_COMMAND_EVENTS_WAIT}, RefCount{1}, HasOwnership{false},
HasBeenWaitedOn{false}, IsRecorded{false}, IsStarted{false},
StreamToken{std::numeric_limits<uint32_t>::max()}, EventID{0},
EvEnd{EventNative}, EvStart{nullptr}, EvQueued{nullptr}, Queue{nullptr},
Stream{nullptr}, Context{Context} {
IsInterop{true}, StreamToken{std::numeric_limits<uint32_t>::max()},
EventID{0}, EvEnd{EventNative}, EvStart{nullptr}, EvQueued{nullptr},
Queue{nullptr}, Stream{nullptr}, Context{Context} {
urContextRetain(Context);
}

Expand Down
7 changes: 6 additions & 1 deletion source/adapters/cuda/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct ur_event_handle_t_ {

bool isCompleted() const noexcept;

bool isInterop() const noexcept { return IsInterop; };

uint32_t getExecutionStatus() const noexcept {

if (!isRecorded()) {
Expand Down Expand Up @@ -141,6 +143,8 @@ struct ur_event_handle_t_ {
bool IsStarted; // Signifies wether the operation associated with the
// UR event has started or not

const bool IsInterop{false}; // Made with urEventCreateWithNativeHandle

uint32_t StreamToken;
uint32_t EventID; // Queue identifier of the event.

Expand Down Expand Up @@ -195,7 +199,8 @@ ur_result_t forLatestEvents(const ur_event_handle_t *EventWaitList,
CUstream LastSeenStream = 0;
for (size_t i = 0; i < Events.size(); i++) {
auto Event = Events[i];
if (!Event || (i != 0 && Event->getStream() == LastSeenStream)) {
if (!Event || (i != 0 && !Event->isInterop() &&
Event->getStream() == LastSeenStream)) {
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions source/adapters/hip/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ ur_event_handle_t_::ur_event_handle_t_(ur_context_handle_t Context,
hipEvent_t EventNative)
: CommandType{UR_COMMAND_EVENTS_WAIT}, RefCount{1}, HasOwnership{false},
HasBeenWaitedOn{false}, IsRecorded{false}, IsStarted{false},
StreamToken{std::numeric_limits<uint32_t>::max()}, EventId{0},
EvEnd{EventNative}, EvStart{nullptr}, EvQueued{nullptr}, Queue{nullptr},
Stream{nullptr}, Context{Context} {
IsInterop{true}, StreamToken{std::numeric_limits<uint32_t>::max()},
EventId{0}, EvEnd{EventNative}, EvStart{nullptr}, EvQueued{nullptr},
Queue{nullptr}, Stream{nullptr}, Context{Context} {
urContextRetain(Context);
}

Expand Down
8 changes: 6 additions & 2 deletions source/adapters/hip/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ struct ur_event_handle_t_ {

bool isCompleted() const;

bool isInterop() const noexcept { return IsInterop; };

uint32_t getExecutionStatus() const {
if (!isRecorded()) {
return UR_EVENT_STATUS_SUBMITTED;
Expand Down Expand Up @@ -134,7 +136,8 @@ struct ur_event_handle_t_ {
// yet.
bool IsStarted; // Signifies wether the operation associated with the
// UR event has started or not
//

const bool IsInterop{false}; // Made with urEventCreateWithNativeHandle

uint32_t StreamToken;
uint32_t EventId; // Queue identifier of the event.
Expand Down Expand Up @@ -190,7 +193,8 @@ ur_result_t forLatestEvents(const ur_event_handle_t *EventWaitList,
hipStream_t LastSeenStream = 0;
for (size_t i = 0; i < Events.size(); i++) {
auto Event = Events[i];
if (!Event || (i != 0 && Event->getStream() == LastSeenStream)) {
if (!Event || (i != 0 && !Event->isInterop() &&
Event->getStream() == LastSeenStream)) {
continue;
}

Expand Down