rocr: Fix several rocrtst memory errors

Change-Id: I9049a3905fb26cf9b8ad0839684a70771a49f616
Αυτή η υποβολή περιλαμβάνεται σε:
Chris Freehill
2024-10-24 17:03:40 -05:00
υποβλήθηκε από Chris Freehill
γονέας 7f8676e177
υποβολή 4256630fd0
3 αρχεία άλλαξαν με 16 προσθήκες και 16 διαγραφές
@@ -515,7 +515,7 @@ void IPCTest::PrintVerboseMesg(void) {
FORK_ASSERT_EQ(HSA_STATUS_SUCCESS, err, "hsa_agent_get_info() failed\n");
// Collect BDF information of GPU's
uint16_t loc1, loc2;
uint32_t loc1, loc2;
err = hsa_agent_get_info(*cpu_device(), (hsa_agent_info_t)HSA_AMD_AGENT_INFO_BDFID, &loc1);
FORK_ASSERT_EQ(HSA_STATUS_SUCCESS, err);
err = hsa_agent_get_info(*gpu_device1(), (hsa_agent_info_t)HSA_AMD_AGENT_INFO_BDFID, &loc2);
@@ -215,17 +215,17 @@ void MemoryAccessTest::GPUAccessToCPUMemoryTest(hsa_agent_t cpuAgent,
int *gpuResult = NULL;
err = hsa_amd_memory_pool_allocate(global_pool,
kMemoryAllocSize, 0,
kMemoryAllocSize*sizeof(int), 0,
reinterpret_cast<void **>(&cpuResult));
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
err = hsa_amd_memory_pool_allocate(global_pool,
kMemoryAllocSize, 0,
kMemoryAllocSize*sizeof(int), 0,
reinterpret_cast<void **>(&sys_data));
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
err = hsa_amd_memory_pool_allocate(global_pool,
kMemoryAllocSize, 0,
kMemoryAllocSize*sizeof(int), 0,
reinterpret_cast<void **>(&dup_sys_data));
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
@@ -249,8 +249,8 @@ void MemoryAccessTest::GPUAccessToCPUMemoryTest(hsa_agent_t cpuAgent,
// Get local memory of GPU to allocate device side buffers
err = hsa_amd_memory_pool_allocate(gpu_pool, kMemoryAllocSize, 0,
reinterpret_cast<void **>(&gpuResult));
err = hsa_amd_memory_pool_allocate(gpu_pool,
kMemoryAllocSize*sizeof(int), 0, reinterpret_cast<void **>(&gpuResult));
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
@@ -352,11 +352,11 @@ void MemoryAccessTest::GPUAccessToCPUMemoryTest(hsa_agent_t cpuAgent,
std::cout<< "gpu has written to system memory successfully"<< std::endl;
}
if (sys_data) { hsa_memory_free(sys_data); }
if (dup_sys_data) { hsa_memory_free(dup_sys_data); }
if (cpuResult) {hsa_memory_free(cpuResult); }
if (gpuResult) {hsa_memory_free(gpuResult); }
if (kernArgs) { hsa_memory_free(kernArgs); }
if (sys_data) { hsa_amd_memory_pool_free(sys_data); }
if (dup_sys_data) { hsa_amd_memory_pool_free(dup_sys_data); }
if (cpuResult) {hsa_amd_memory_pool_free(cpuResult); }
if (gpuResult) {hsa_amd_memory_pool_free(gpuResult); }
if (kernArgs) { hsa_amd_memory_pool_free(kernArgs); }
if (signal.handle) { hsa_signal_destroy(signal); }
if (queue) { hsa_queue_destroy(queue); }
} else {
@@ -219,7 +219,7 @@ void MemoryAllocationTest::GroupMemoryDynamicAllocation(hsa_agent_t cpuAgent,
args *kernArgs = NULL;
err = hsa_amd_memory_pool_allocate(global_pool,
kMemoryAllocSize, 0,
kMemoryAllocSize*sizeof(uint32_t), 0,
reinterpret_cast<void **>(&Indata));
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
@@ -240,7 +240,7 @@ void MemoryAllocationTest::GroupMemoryDynamicAllocation(hsa_agent_t cpuAgent,
// Get local memory of GPU to allocate device side buffers
uint32_t *OutData = NULL;
err = hsa_amd_memory_pool_allocate(gpu_pool, kMemoryAllocSize, 0,
err = hsa_amd_memory_pool_allocate(gpu_pool, kMemoryAllocSize*sizeof(uint32_t), 0,
reinterpret_cast<void **>(&OutData));
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
@@ -332,9 +332,9 @@ void MemoryAllocationTest::GroupMemoryDynamicAllocation(hsa_agent_t cpuAgent,
}
ASSERT_EQ(OutData[i], Indata[i]);
}
if (Indata) { hsa_memory_free(Indata); }
if (OutData) {hsa_memory_free(OutData); }
if (kernArgs) { hsa_memory_free(kernArgs); }
if (Indata) { hsa_amd_memory_pool_free(Indata); }
if (OutData) { hsa_amd_memory_pool_free(OutData); }
if (kernArgs) { hsa_amd_memory_pool_free(kernArgs); }
if (queue) { hsa_queue_destroy(queue); }
} else {
if (verbosity() > 0) {