File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -1091,6 +1091,14 @@ void AllocaCommand::emitInstrumentationData() {
10911091#endif
10921092}
10931093
1094+ bool AllocaCommand::producesPiEvent () const {
1095+ // for reference see enqueueImp()
1096+ auto TypedSyclMemObj = static_cast <detail::SYCLMemObjT *>(getSYCLMemObj ());
1097+ // Event presence implies interop context esistence
1098+ return (TypedSyclMemObj->hasInteropEvent () &&
1099+ (getContext (MQueue) == TypedSyclMemObj->getInteropContext ()));
1100+ }
1101+
10941102ur_result_t AllocaCommand::enqueueImp () {
10951103 waitForPreparedHostEvents ();
10961104 std::vector<EventImplPtr> EventImpls = MPreparedDepsEvents;
@@ -1119,9 +1127,9 @@ ur_result_t AllocaCommand::enqueueImp() {
11191127 Result != UR_RESULT_SUCCESS)
11201128 return Result;
11211129
1122- // MemoryManager::allocate doesn't always provide native event, it is returned
1123- // only for interop case with presence of host pointer and interop event. Not
1124- // feasible to check it from command.
1130+ assert ((!!UREvent == producesPiEvent ()) &&
1131+ " AllocaCommand: native event is expected only when it is for interop "
1132+ " memory object with native event provided. " );
11251133
11261134 MEvent->setHandle (UREvent);
11271135 return UR_RESULT_SUCCESS;
Original file line number Diff line number Diff line change @@ -501,6 +501,7 @@ class AllocaCommand : public AllocaCommandBase {
501501 void *getMemAllocation () const final { return MMemAllocation; }
502502 void printDot (std::ostream &Stream) const final ;
503503 void emitInstrumentationData () override ;
504+ bool producesPiEvent () const final ;
504505
505506private:
506507 ur_result_t enqueueImp () final ;
Original file line number Diff line number Diff line change @@ -244,6 +244,10 @@ void SYCLMemObjT::handleWriteAccessorCreation() {
244244 }
245245}
246246
247+ bool SYCLMemObjT::hasInteropEvent () const {
248+ return MInteropEvent && MInteropEvent->getHandle ();
249+ }
250+
247251} // namespace detail
248252} // namespace _V1
249253} // namespace sycl
Original file line number Diff line number Diff line change @@ -159,6 +159,8 @@ class SYCLMemObjT : public SYCLMemObjI {
159159 MHostPtrProvided = true ;
160160 }
161161
162+ bool hasInteropEvent () const ;
163+
162164protected:
163165 void updateHostMemory (void *const Ptr);
164166
You can’t perform that action at this time.
0 commit comments