From 811db4d575d090251364291e728c33541e0d49da Mon Sep 17 00:00:00 2001 From: Rafal Maziejuk Date: Tue, 29 Nov 2022 16:41:21 +0000 Subject: [PATCH] Move engine node helper tests to shared Signed-off-by: Rafal Maziejuk --- .../unit_test/xe_hpc_core/pvc/CMakeLists.txt | 1 - .../unit_test/xe_hpc_core/pvc/CMakeLists.txt | 1 + .../pvc/engine_node_helper_tests_pvc.cpp | 49 +++++++------------ 3 files changed, 18 insertions(+), 33 deletions(-) rename {opencl => shared}/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp (91%) diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt b/opencl/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt index 71d9013c18..b7d98284b8 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt +++ b/opencl/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt @@ -9,7 +9,6 @@ if(TESTS_PVC) ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_pvc.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/engine_node_helper_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_pvc.cpp ) diff --git a/shared/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt b/shared/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt index 44cddacdf2..083342985d 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt +++ b/shared/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt @@ -10,6 +10,7 @@ if(TESTS_PVC) ${CMAKE_CURRENT_SOURCE_DIR}/device_binary_format_ar_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/device_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dispatch_walker_tests_pvc.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/engine_node_helper_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/excludes_xe_hpc_core_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_pvc.cpp diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp similarity index 91% rename from opencl/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp rename to shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp index 23e4d81a9b..19cfdeb6f4 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp @@ -7,17 +7,14 @@ #include "shared/source/helpers/engine_node_helper.h" #include "shared/source/xe_hpc_core/hw_cmds_pvc.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/mocks/mock_graphics_allocation.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" #include "shared/test/common/test_macros/test.h" -#include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/mocks/mock_command_queue.h" -#include "opencl/test/unit_test/mocks/mock_context.h" - using namespace NEO; -using EngineNodeHelperPvcTests = ::Test; +using EngineNodeHelperPvcTests = ::Test; PVCTEST_F(EngineNodeHelperPvcTests, WhenGetBcsEngineTypeIsCalledWithoutSelectorEnabledForPVCThenCorrectBcsEngineIsReturned) { using namespace aub_stream; @@ -152,42 +149,30 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCccsDisabledWhenGetGpgpuEnginesCalledTh } PVCTEST_F(EngineNodeHelperPvcTests, givenCCSEngineWhenCallingIsCooperativeDispatchSupportedThenTrueIsReturned) { - auto &helper = HwHelper::get(renderCoreFamily); + const auto &hwHelper = HwHelper::get(renderCoreFamily); auto hwInfo = *defaultHwInfo; - uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily]; - hardwareInfoSetup[productFamily](&hwInfo, true, hwInfoConfig); - auto device = MockDevice::createWithNewExecutionEnvironment(&hwInfo); - ASSERT_NE(nullptr, device); - auto clDevice = new MockClDevice{device}; - ASSERT_NE(nullptr, clDevice); // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks) - auto context = new NEO::MockContext(clDevice); - auto commandQueue = reinterpret_cast(new MockCommandQueueHw(context, clDevice, 0)); + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; - auto engineGroupType = helper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), - commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); - auto retVal = helper.isCooperativeDispatchSupported(engineGroupType, hwInfo); - ASSERT_TRUE(retVal); - commandQueue->release(); - context->decRefInternal(); - delete clDevice; + auto engineGroupType = hwHelper.getEngineGroupType(pDevice->getDefaultEngine().getEngineType(), + pDevice->getDefaultEngine().getEngineUsage(), hwInfo); + auto retVal = hwHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo); + EXPECT_TRUE(retVal); } PVCTEST_F(EngineNodeHelperPvcTests, givenCCCSEngineAndRevisionBWhenCallingIsCooperativeDispatchSupportedThenFalseIsReturned) { - auto &helper = HwHelper::get(renderCoreFamily); - auto context = new NEO::MockContext(pClDevice); - auto commandQueue = reinterpret_cast(new MockCommandQueueHw(context, pClDevice, 0)); + const auto &productHelper = getHelper(); + const auto &hwHelper = HwHelper::get(renderCoreFamily); + auto hwInfo = *defaultHwInfo; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCCS; - auto engineGroupType = helper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), - commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); - auto retVal = helper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo); + auto engineGroupType = hwHelper.getEngineGroupType(pDevice->getDefaultEngine().getEngineType(), + pDevice->getDefaultEngine().getEngineUsage(), hwInfo); + auto retVal = hwHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo); EXPECT_TRUE(retVal); - auto &hwConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); - hardwareInfo.platform.usRevId = hwConfig.getHwRevIdFromStepping(REVISION_B, hardwareInfo); - retVal = helper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo); + hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); + retVal = hwHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo); EXPECT_FALSE(retVal); - commandQueue->release(); - context->decRefInternal(); } PVCTEST_F(EngineNodeHelperPvcTests, givenBcsDisabledWhenGetEnginesCalledThenDontCreateAnyBcs) {