rorctst: check gpu_pool value after hsa_amd_agent_iterate_memory_pools.

hsa_amd_agent_iterate_memory_pools return HSA_STATUS_SUCCESS even if
no memory pool is found. Add a memory pool check.

jenkins@jenkins-System-Product-Name:~/rocrtst_tests/gfx902$ ./rocrtst64 --gtest_filter=rocrtstFunc.MemoryAccessTests
Note: Google Test filter = rocrtstFunc.MemoryAccessTests
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from rocrtstFunc
[ RUN      ] rocrtstFunc.MemoryAccessTests

	#### TEST NAME ####
RocR Memory Access Tests

	#### TEST DESCRIPTION ####
This series of tests check memory allocationon GPU and CPU, i.e. GPU access
to system memory and CPU access to GPU memory.

	#### TEST SETUP ####
The gpu device name is gfx902
Target HW Profile is HSA_PROFILE_FULL
Test can run on any profile. OK.

	#### TEST EXECUTION ####
  *** Memory Subtest: CPUAccessToGPUMemoryTest in Memory Pools ***
Segmentation fault (core dumped)

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Change-Id: Ic335c4c98990b43f5d4842ab6d74855859a9048a
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
This commit is contained in:
Yifan Zhang
2021-02-19 17:38:33 +08:00
zatwierdzone przez Yifan1 Zhang
rodzic 9311789398
commit 27ae854cda
@@ -463,10 +463,15 @@ void MemoryAccessTest::CPUAccessToGPUMemoryTest(void) {
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
for (unsigned int i = 0 ; i< gpus.size(); ++i) {
hsa_amd_memory_pool_t gpu_pool;
memset(&gpu_pool, 0, sizeof(gpu_pool));
err = hsa_amd_agent_iterate_memory_pools(gpus[i],
rocrtst::GetGlobalMemoryPool,
&gpu_pool);
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
if (gpu_pool.handle == 0) {
std::cout << "no global mempool in gpu agent" << std::endl;
return;
}
CPUAccessToGPUMemoryTest(cpus[0], gpus[i], gpu_pool);
}
if (verbosity() > 0) {