diff --git a/rocclr/device/device.hpp b/rocclr/device/device.hpp index c474d07e30..1a3cc4744f 100644 --- a/rocclr/device/device.hpp +++ b/rocclr/device/device.hpp @@ -1404,7 +1404,7 @@ class Device : public RuntimeObject { return nullptr; } - virtual void IpcDetach(amd::Memory& memory) const { ShouldNotReachHere(); } + virtual bool IpcDetach(amd::Memory& memory) const { ShouldNotReachHere(); } //! Return private global device context for P2P allocations amd::Context& GlbCtx() const { return *glb_ctx_; } diff --git a/rocclr/device/rocm/rocdevice.cpp b/rocclr/device/rocm/rocdevice.cpp index 1f867fecbb..519c68f072 100644 --- a/rocclr/device/rocm/rocdevice.cpp +++ b/rocclr/device/rocm/rocdevice.cpp @@ -1817,7 +1817,7 @@ amd::Memory *Device::IpcAttach(const void* handle, size_t mem_size, unsigned int return amd_mem_obj; } -void Device::IpcDetach (amd::Memory& memory) const { +bool Device::IpcDetach (amd::Memory& memory) const { void* dev_ptr = nullptr; hsa_status_t hsa_status = HSA_STATUS_SUCCESS; @@ -1833,10 +1833,11 @@ void Device::IpcDetach (amd::Memory& memory) const { hsa_status = hsa_amd_ipc_memory_detach(dev_ptr); if (hsa_status != HSA_STATUS_SUCCESS) { LogPrintfError("HSA failed to detach memory with status: %d \n", hsa_status); - return; + return false; } memory.release(); + return true; } void* Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_svm_mem_flags flags, diff --git a/rocclr/device/rocm/rocdevice.hpp b/rocclr/device/rocm/rocdevice.hpp index dd623a2d28..33d55162d5 100644 --- a/rocclr/device/rocm/rocdevice.hpp +++ b/rocclr/device/rocm/rocdevice.hpp @@ -411,7 +411,7 @@ class Device : public NullDevice { void updateFreeMemory(size_t size, bool free); virtual amd::Memory* IpcAttach(const void* handle, size_t mem_size, unsigned int flags, void** dev_ptr) const; - virtual void IpcDetach (amd::Memory& memory) const; + virtual bool IpcDetach (amd::Memory& memory) const; bool AcquireExclusiveGpuAccess(); void ReleaseExclusiveGpuAccess(VirtualGPU& vgpu) const;