From 5977eb554fcdde880391b7d6d113e95749d51a3a Mon Sep 17 00:00:00 2001 From: Yifan Zhang Date: Fri, 19 Feb 2021 16:48:15 +0800 Subject: [PATCH] rocrtst: fix a test case setup issue in iommuv2 for APU APU doesn't have non-KERNARG memory pool for cpu agent or a global memory pool for gpu agent. Current setup check fails as below. Change to a APU specific check method. [==========] Running 45 tests from 5 test cases. [----------] Global test environment set-up. [----------] 1 test from rocrtst [ RUN ] rocrtst.Test_Example #### TEST NAME #### Test Case Example #### TEST DESCRIPTION #### Put a description of the test case here. Line breaks will be taken care of on output, not here. #### TEST SETUP #### The gpu device name is gfx902 Target HW Profile is HSA_PROFILE_FULL Test can run on any profile. OK. /home/jenkins/hsa/runtime/rocrtst/common/base_rocr_utils.cc:180: Failure Value of: rocrtst::ProcessIterateError(err) Actual: 4096 Expected: HSA_STATUS_SUCCESS Which is: 0 HSA_STATUS_ERROR: A generic error has occurred. /home/jenkins/hsa/runtime/rocrtst/suites/test_common/test_case_template.cc:195: Failure Value of: HSA_STATUS_SUCCESS Actual: 0 Expected: err Which is: 4096 rocrtst64: /home/jenkins/hsa/runtime/rocrtst/common/base_rocr_utils.cc:416: hsa_kernel_dispatch_packet_t* rocrtst::WriteAQLToQueue(rocrtst::BaseRocR*, uint64_t*): Assertion `test->main_queue()' failed. ../shunit2: line 977: 1382 Aborted (core dumped) ./rocrtst$ROCRTST_BLD_BITS "$ROCRTST_ARGS" --gtest_output=xml:"$gtest_xml" failed (failed to run rocrtst) Signed-off-by: Yifan Zhang Change-Id: I03691bd4171b6e622231baf3dce4db2211eb47e7 --- rocrtst/common/base_rocr_utils.cc | 32 ++++++++++++++++++++++--------- rocrtst/common/common.cc | 5 +++++ rocrtst/common/common.h | 1 + 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/rocrtst/common/base_rocr_utils.cc b/rocrtst/common/base_rocr_utils.cc index 7631211d6d..f171aae456 100755 --- a/rocrtst/common/base_rocr_utils.cc +++ b/rocrtst/common/base_rocr_utils.cc @@ -174,18 +174,32 @@ static hsa_status_t ProcessIterateError(hsa_status_t err) { // yourself instead of using this function. hsa_status_t SetPoolsTypical(BaseRocR* test) { hsa_status_t err; + if (test->profile() == HSA_PROFILE_FULL) { + err = hsa_amd_agent_iterate_memory_pools(*test->cpu_device(), + rocrtst::FindAPUStandardPool, &test->cpu_pool()); + RET_IF_HSA_UTILS_ERR(rocrtst::ProcessIterateError(err)); - err = hsa_amd_agent_iterate_memory_pools(*test->cpu_device(), - rocrtst::FindStandardPool, &test->cpu_pool()); - RET_IF_HSA_UTILS_ERR(rocrtst::ProcessIterateError(err)); + err = hsa_amd_agent_iterate_memory_pools(*test->cpu_device(), + rocrtst::FindAPUStandardPool, &test->device_pool()); + RET_IF_HSA_UTILS_ERR(rocrtst::ProcessIterateError(err)); - err = hsa_amd_agent_iterate_memory_pools(*test->gpu_device1(), - rocrtst::FindStandardPool, &test->device_pool()); - RET_IF_HSA_UTILS_ERR(rocrtst::ProcessIterateError(err)); + err = hsa_amd_agent_iterate_memory_pools(*test->cpu_device(), + rocrtst::FindAPUStandardPool, &test->kern_arg_pool()); + RET_IF_HSA_UTILS_ERR(rocrtst::ProcessIterateError(err)); - err = hsa_amd_agent_iterate_memory_pools(*test->cpu_device(), - rocrtst::FindKernArgPool, &test->kern_arg_pool()); - RET_IF_HSA_UTILS_ERR(rocrtst::ProcessIterateError(err)); + } else { + err = hsa_amd_agent_iterate_memory_pools(*test->cpu_device(), + rocrtst::FindStandardPool, &test->cpu_pool()); + RET_IF_HSA_UTILS_ERR(rocrtst::ProcessIterateError(err)); + + err = hsa_amd_agent_iterate_memory_pools(*test->gpu_device1(), + rocrtst::FindStandardPool, &test->device_pool()); + RET_IF_HSA_UTILS_ERR(rocrtst::ProcessIterateError(err)); + + err = hsa_amd_agent_iterate_memory_pools(*test->cpu_device(), + rocrtst::FindKernArgPool, &test->kern_arg_pool()); + RET_IF_HSA_UTILS_ERR(rocrtst::ProcessIterateError(err)); + } return HSA_STATUS_SUCCESS; } diff --git a/rocrtst/common/common.cc b/rocrtst/common/common.cc index 2dc7f636f6..9d02a68828 100755 --- a/rocrtst/common/common.cc +++ b/rocrtst/common/common.cc @@ -269,6 +269,11 @@ hsa_status_t FindGlobalPool(hsa_amd_memory_pool_t pool, void* data) { POOL_PROP_OFF, POOL_PROP_DONT_CARE); } +hsa_status_t FindAPUStandardPool(hsa_amd_memory_pool_t pool, void* data) { + return FindPool(pool, data, HSA_AMD_SEGMENT_GLOBAL, POOL_PROP_DONT_CARE, + POOL_PROP_DONT_CARE, POOL_PROP_DONT_CARE); +} + // Populate the vector with handles to all agents and pools hsa_status_t GetAgentPools(std::vector> *agent_pools) { diff --git a/rocrtst/common/common.h b/rocrtst/common/common.h index 503166ae02..6e8017d3e0 100755 --- a/rocrtst/common/common.h +++ b/rocrtst/common/common.h @@ -193,6 +193,7 @@ hsa_status_t GetKernArgMemoryPool(hsa_amd_memory_pool_t pool, void* data); /// -HSA_STATUS_SUCCESS - we did not find a pool that meets the criteria /// -else return an appropriate error code for any error encountered hsa_status_t FindStandardPool(hsa_amd_memory_pool_t pool, void* data); +hsa_status_t FindAPUStandardPool(hsa_amd_memory_pool_t pool, void* data); /// Find a "kernel arg" pool. /// The pool found will have the following properties: