@@ -269,7 +269,10 @@ XgmiBackend::~XgmiBackend() {
269269 std::unique_lock<std::shared_mutex> lock (ipcMutex);
270270 for (auto & entry : remoteIpcHandles) {
271271 if (entry.second .remappedAddr != nullptr ) {
272- hipIpcCloseMemHandle (entry.second .remappedAddr );
272+ hipError_t closeErr = hipIpcCloseMemHandle (entry.second .remappedAddr );
273+ if (closeErr != hipSuccess) {
274+ MORI_IO_WARN (" XGMI: Failed to close IPC mem handle: {}" , hipGetErrorString (closeErr));
275+ }
273276 }
274277 }
275278 remoteIpcHandles.clear ();
@@ -309,7 +312,10 @@ void XgmiBackend::InitializeP2PAccess() {
309312 if (canAccess) {
310313 hipError_t enableErr = hipDeviceEnablePeerAccess (j, 0 );
311314 if (enableErr == hipErrorPeerAccessAlreadyEnabled) {
312- hipGetLastError ();
315+ hipError_t clearErr = hipGetLastError ();
316+ if (clearErr != hipSuccess) {
317+ MORI_IO_WARN (" XGMI: Failed to clear peer access error: {}" , hipGetErrorString (clearErr));
318+ }
313319 p2pMatrix[i][j] = true ;
314320 MORI_IO_TRACE (" XGMI: P2P access already enabled from device {} to {}" , i, j);
315321 } else if (enableErr != hipSuccess) {
@@ -401,7 +407,10 @@ void* XgmiBackend::GetRemappedAddress(const MemoryDesc& desc, int localDeviceId)
401407 void * remappedAddr = nullptr ;
402408 err = hipIpcOpenMemHandle (&remappedAddr, handle, hipIpcMemLazyEnablePeerAccess);
403409 if (err != hipSuccess) {
404- hipGetLastError ();
410+ hipError_t clearErr = hipGetLastError ();
411+ if (clearErr != hipSuccess) {
412+ MORI_IO_WARN (" XGMI: Failed to clear IPC open error: {}" , hipGetErrorString (clearErr));
413+ }
405414 if (IsP2PAccessible (localDeviceId, desc.deviceId )) {
406415 MORI_IO_TRACE (" XGMI: IPC failed, using direct P2P pointer for id={}" , desc.id );
407416 return reinterpret_cast <void *>(desc.data );
0 commit comments