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 @@ -1090,6 +1090,14 @@ void AllocaCommand::emitInstrumentationData() {
10901090#endif
10911091}
10921092
1093+ bool AllocaCommand::producesPiEvent () const {
1094+ // for reference see enqueueImp()
1095+ auto TypedSyclMemObj = static_cast <detail::SYCLMemObjT *>(getSYCLMemObj ());
1096+ // Event presence implies interop context esistence
1097+ return TypedSyclMemObj->hasInteropEvent () && !MIsLeaderAlloca &&
1098+ (MLinkedAllocaCmd->getMemAllocation () != nullptr );
1099+ }
1100+
10931101ur_result_t AllocaCommand::enqueueImp () {
10941102 waitForPreparedHostEvents ();
10951103 std::vector<EventImplPtr> EventImpls = MPreparedDepsEvents;
@@ -1118,9 +1126,9 @@ ur_result_t AllocaCommand::enqueueImp() {
11181126 Result != UR_RESULT_SUCCESS)
11191127 return Result;
11201128
1121- // MemoryManager::allocate doesn't always provide native event, it is returned
1122- // only for interop case with presence of host pointer and interop event. Not
1123- // feasible to check it from command.
1129+ assert ((!!UREvent == producesPiEvent ()) &&
1130+ " AllocaCommand: native event is expected only when it is for interop "
1131+ " memory object with native event provided. " );
11241132
11251133 MEvent->setHandle (UREvent);
11261134 return UR_RESULT_SUCCESS;
Original file line number Diff line number Diff line change @@ -499,6 +499,7 @@ class AllocaCommand : public AllocaCommandBase {
499499 void *getMemAllocation () const final { return MMemAllocation; }
500500 void printDot (std::ostream &Stream) const final ;
501501 void emitInstrumentationData () override ;
502+ bool producesPiEvent () const final ;
502503
503504private:
504505 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