From 27ae854cda471f91ba4a339fb1ad13623e6d52ef Mon Sep 17 00:00:00 2001 From: Yifan Zhang Date: Fri, 19 Feb 2021 17:38:33 +0800 Subject: [PATCH] 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 Change-Id: Ic335c4c98990b43f5d4842ab6d74855859a9048a Signed-off-by: Yifan Zhang --- rocrtst/suites/functional/memory_access.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rocrtst/suites/functional/memory_access.cc b/rocrtst/suites/functional/memory_access.cc index 9f50e10897..befe691422 100755 --- a/rocrtst/suites/functional/memory_access.cc +++ b/rocrtst/suites/functional/memory_access.cc @@ -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) {