SWDEV-445576 - Return error when hipMemPoolDestroy is invoked on the default mempool

Change-Id: I7a7ab499f781cf7e92cad1ae39a40b4f37f62653
This commit is contained in:
Ioannis Assiouras
2024-02-12 12:48:21 +00:00
parent 5e6ad190ff
commit 4d61237a6f
+4 -1
View File
@@ -252,9 +252,12 @@ hipError_t hipMemPoolDestroy(hipMemPool_t mem_pool) {
HIP_RETURN(hipErrorInvalidValue);
}
hip::MemoryPool* hip_mem_pool = reinterpret_cast<hip::MemoryPool*>(mem_pool);
hip_mem_pool->ReleaseFreedMemory();
auto device = hip_mem_pool->Device();
if (hip_mem_pool == device->GetDefaultMemoryPool()) {
HIP_RETURN(hipErrorInvalidValue);
}
hip_mem_pool->ReleaseFreedMemory();
// Force default pool if the current one is destroyed
if (hip_mem_pool == device->GetCurrentMemoryPool()) {