@@ -971,13 +971,13 @@ struct GenericDeviceTy : public DeviceAllocatorTy {
971971 bool useAutoZeroCopy ();
972972 virtual bool useAutoZeroCopyImpl () { return false ; }
973973
974- virtual omp_interop_val_t *createInterop (int32_t InteropType,
974+ virtual Expected< omp_interop_val_t *> createInterop (int32_t InteropType,
975975 interop_spec_t &InteropSpec) {
976976 return nullptr ;
977977 }
978978
979- virtual int32_t releaseInterop (omp_interop_val_t *Interop) {
980- return OFFLOAD_SUCCESS ;
979+ virtual Error releaseInterop (omp_interop_val_t *Interop) {
980+ return Plugin::success () ;
981981 }
982982
983983 virtual interop_spec_t selectInteropPreference (int32_t InteropType,
@@ -1419,15 +1419,27 @@ struct GenericPluginTy {
14191419 interop_spec_t *InteropSpec) {
14201420 assert (InteropSpec && " Interop spec is null" );
14211421 auto &Device = getDevice (ID);
1422- return Device.createInterop (InteropContext, *InteropSpec);
1422+ auto InteropOrErr = Device.createInterop (InteropContext, *InteropSpec);
1423+ if (!InteropOrErr) {
1424+ REPORT (" Failure to create interop object for device " DPxMOD " : %s\n " ,
1425+ DPxPTR (InteropSpec), toString (InteropOrErr.takeError ()).c_str ());
1426+ return nullptr ;
1427+ }
1428+ return *InteropOrErr;
14231429 }
14241430
14251431 // / Release OpenMP interop object
14261432 int32_t release_interop (int32_t ID, omp_interop_val_t *Interop) {
14271433 assert (Interop && " Interop is null" );
14281434 assert (Interop->DeviceId == ID && " Interop does not match device id" );
14291435 auto &Device = getDevice (ID);
1430- return Device.releaseInterop (Interop);
1436+ auto Err = Device.releaseInterop (Interop);
1437+ if (Err) {
1438+ REPORT (" Failure to release interop object " DPxMOD " : %s\n " ,
1439+ DPxPTR (Interop), toString (std::move (Err)).c_str ());
1440+ return OFFLOAD_FAIL;
1441+ }
1442+ return OFFLOAD_SUCCESS;
14311443 }
14321444
14331445 // / Flush the queue associated with the interop object if necessary
0 commit comments