SWDEV-256126 - Linux pro Nuke app crash with "Out of memory "while running Rip plugin test

We unmap a memory with a different pointer.
ROCr runtime might be confused and silently ignore the unmap request

Change-Id: Ic5a1387a426cf02a985a4ef8ff8ff05e6a870cbf
Этот коммит содержится в:
Alex Xie
2020-10-15 16:06:25 -04:00
коммит произвёл AlexBin Xie
родитель cb9684ab0b
Коммит e5588f188c
2 изменённых файлов: 8 добавлений и 5 удалений
+5 -5
Просмотреть файл
@@ -258,13 +258,13 @@ bool Memory::createInteropBuffer(GLenum targetType, int miplevel) {
size_t metadata_size = 0;
void* metadata;
hsa_status_t status = hsa_amd_interop_map_buffer(
1, &agent, out.dmabuf_fd, 0, &size, &deviceMemory_, &metadata_size, (const void**)&metadata);
1, &agent, out.dmabuf_fd, 0, &size, &interop_deviceMemory_,
&metadata_size, (const void**)&metadata);
close(out.dmabuf_fd);
ClPrint(amd::LOG_DEBUG, amd::LOG_MEM, "Map GL memory %p, size 0x%zx, offset=0x%llx",
deviceMemory_, size, out.buf_offset);
deviceMemory_ = static_cast<char*>(deviceMemory_) + out.buf_offset;
interop_deviceMemory_, size, out.buf_offset);
deviceMemory_ = static_cast<char*>(interop_deviceMemory_) + out.buf_offset;
if (status != HSA_STATUS_SUCCESS) return false;
@@ -285,7 +285,7 @@ bool Memory::createInteropBuffer(GLenum targetType, int miplevel) {
void Memory::destroyInteropBuffer() {
assert(kind_ == MEMORY_KIND_INTEROP && "Memory must be interop type.");
hsa_amd_interop_unmap_buffer(deviceMemory_);
hsa_amd_interop_unmap_buffer(interop_deviceMemory_);
ClPrint(amd::LOG_DEBUG, amd::LOG_MEM, "Unmap GL memory %p", deviceMemory_);
deviceMemory_ = nullptr;
}
+3
Просмотреть файл
@@ -132,6 +132,9 @@ class Memory : public device::Memory {
// Pointer to the device memory. This could be in system or device local mem.
void* deviceMemory_;
// Pointer to the interop device memory, which has an offset from deviceMemory_
void* interop_deviceMemory_;
// Track if this memory is interop, lock, gart, or normal.
MEMORY_KIND kind_;