diff --git a/rocclr/runtime/device/rocm/rocmemory.cpp b/rocclr/runtime/device/rocm/rocmemory.cpp index 78dce676a6..ae7d45eb02 100644 --- a/rocclr/runtime/device/rocm/rocmemory.cpp +++ b/rocclr/runtime/device/rocm/rocmemory.cpp @@ -972,6 +972,15 @@ bool Image::createView(const Memory& parent) { return false; } + // Explicitly set the host memory location, + // because the parent location could change after reallocation + if (nullptr != parent.owner()->getHostMem()) { + owner()->setHostMem(reinterpret_cast(parent.owner()->getHostMem()) + owner()->getOrigin()); + } + else { + owner()->setHostMem(nullptr); + } + return true; }