From 617538074c7f39af1ef11f826a42485b08298ba4 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Wed, 10 Jun 2020 07:23:02 +0000 Subject: [PATCH] Fix IPC create memory failure ROCr expects granular size in hsa_amd_ipc_memory_create Change-Id: I7c266aa2eef8304f105298a7a668f4c4b3fb5f5a --- rocclr/device/rocm/rocmemory.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rocclr/device/rocm/rocmemory.cpp b/rocclr/device/rocm/rocmemory.cpp index 6b1923e175..6db9379004 100755 --- a/rocclr/device/rocm/rocmemory.cpp +++ b/rocclr/device/rocm/rocmemory.cpp @@ -200,7 +200,6 @@ bool Memory::IpcCreate(size_t offset, size_t* mem_size, void* handle) const { /* Get the memory size from starting pointer */ *mem_size = owner()->getSize() - offset; - /* Get the starting pointer from the amd::Memory object */ if (owner()->getSvmPtr() != nullptr) { dev_ptr = reinterpret_cast
(owner()->getSvmPtr()) + offset; @@ -211,7 +210,7 @@ bool Memory::IpcCreate(size_t offset, size_t* mem_size, void* handle) const { } /* Pass the pointer and memory size to retrieve the handle */ - hsa_status = hsa_amd_ipc_memory_create(dev_ptr, *mem_size, + hsa_status = hsa_amd_ipc_memory_create(dev_ptr, amd::alignUp(*mem_size, dev().alloc_granularity()), reinterpret_cast(handle)); if (hsa_status != HSA_STATUS_SUCCESS) {