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 <yifan1.zhang@amd.com>
Change-Id: I03691bd4171b6e622231baf3dce4db2211eb47e7
This commit is contained in:
Yifan Zhang
2021-02-19 16:48:15 +08:00
committed by Yifan1 Zhang
parent 93609fd3d4
commit 5977eb554f
3 changed files with 29 additions and 9 deletions
+23 -9
View File
@@ -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;
}
+5
View File
@@ -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<std::shared_ptr<agent_pools_t>> *agent_pools) {
+1
View File
@@ -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: