SWDEV-356569 - check for mempool device

- mem pool should be from same device

Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: Id06a7f070c019548462c235bff3c0cd972e6eb8a
Bu işleme şunda yer alıyor:
sdashmiz
2022-09-19 09:55:03 -04:00
işlemeyi yapan: Shadi Dashmiz
ebeveyn e7a34f9efe
işleme 33f02abc41
+6
Dosyayı Görüntüle
@@ -44,6 +44,12 @@ hipError_t hipDeviceSetMemPool(int device, hipMemPool_t mem_pool) {
if ((mem_pool == nullptr) || (device >= g_devices.size())) {
HIP_RETURN(hipErrorInvalidValue);
}
auto poolDevice = reinterpret_cast<hip::MemoryPool*>(mem_pool)->Device();
if (poolDevice->deviceId() != device) {
HIP_RETURN(hipErrorInvalidDevice);
}
g_devices[device]->SetCurrentMemoryPool(reinterpret_cast<hip::MemoryPool*>(mem_pool));
HIP_RETURN(hipSuccess);
}