Move engine node helper tests to shared

Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com>
This commit is contained in:
Rafal Maziejuk
2022-11-29 16:41:21 +00:00
committed by Compute-Runtime-Automation
parent 4a2a6a15c2
commit 811db4d575
3 changed files with 18 additions and 33 deletions

View File

@ -9,7 +9,6 @@ if(TESTS_PVC)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper_tests_pvc.cpp ${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}/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}/get_device_info_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_pvc.cpp
) )

View File

@ -10,6 +10,7 @@ if(TESTS_PVC)
${CMAKE_CURRENT_SOURCE_DIR}/device_binary_format_ar_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/device_binary_format_ar_tests_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/device_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/device_tests_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_walker_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}/excludes_xe_hpc_core_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_pvc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_pvc.cpp

View File

@ -7,17 +7,14 @@
#include "shared/source/helpers/engine_node_helper.h" #include "shared/source/helpers/engine_node_helper.h"
#include "shared/source/xe_hpc_core/hw_cmds_pvc.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/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_graphics_allocation.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/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.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 namespace NEO;
using EngineNodeHelperPvcTests = ::Test<ClDeviceFixture>; using EngineNodeHelperPvcTests = ::Test<DeviceFixture>;
PVCTEST_F(EngineNodeHelperPvcTests, WhenGetBcsEngineTypeIsCalledWithoutSelectorEnabledForPVCThenCorrectBcsEngineIsReturned) { PVCTEST_F(EngineNodeHelperPvcTests, WhenGetBcsEngineTypeIsCalledWithoutSelectorEnabledForPVCThenCorrectBcsEngineIsReturned) {
using namespace aub_stream; using namespace aub_stream;
@ -152,42 +149,30 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCccsDisabledWhenGetGpgpuEnginesCalledTh
} }
PVCTEST_F(EngineNodeHelperPvcTests, givenCCSEngineWhenCallingIsCooperativeDispatchSupportedThenTrueIsReturned) { PVCTEST_F(EngineNodeHelperPvcTests, givenCCSEngineWhenCallingIsCooperativeDispatchSupportedThenTrueIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily); const auto &hwHelper = HwHelper::get(renderCoreFamily);
auto hwInfo = *defaultHwInfo; auto hwInfo = *defaultHwInfo;
uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily]; hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hardwareInfoSetup[productFamily](&hwInfo, true, hwInfoConfig);
auto device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&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<MockCommandQueue *>(new MockCommandQueueHw<FamilyType>(context, clDevice, 0));
auto engineGroupType = helper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), auto engineGroupType = hwHelper.getEngineGroupType(pDevice->getDefaultEngine().getEngineType(),
commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); pDevice->getDefaultEngine().getEngineUsage(), hwInfo);
auto retVal = helper.isCooperativeDispatchSupported(engineGroupType, hwInfo); auto retVal = hwHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo);
ASSERT_TRUE(retVal); EXPECT_TRUE(retVal);
commandQueue->release();
context->decRefInternal();
delete clDevice;
} }
PVCTEST_F(EngineNodeHelperPvcTests, givenCCCSEngineAndRevisionBWhenCallingIsCooperativeDispatchSupportedThenFalseIsReturned) { PVCTEST_F(EngineNodeHelperPvcTests, givenCCCSEngineAndRevisionBWhenCallingIsCooperativeDispatchSupportedThenFalseIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily); const auto &productHelper = getHelper<ProductHelper>();
auto context = new NEO::MockContext(pClDevice); const auto &hwHelper = HwHelper::get(renderCoreFamily);
auto commandQueue = reinterpret_cast<MockCommandQueue *>(new MockCommandQueueHw<FamilyType>(context, pClDevice, 0)); auto hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCCS;
auto engineGroupType = helper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), auto engineGroupType = hwHelper.getEngineGroupType(pDevice->getDefaultEngine().getEngineType(),
commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); pDevice->getDefaultEngine().getEngineUsage(), hwInfo);
auto retVal = helper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo); auto retVal = hwHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo);
EXPECT_TRUE(retVal); EXPECT_TRUE(retVal);
auto &hwConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo);
hardwareInfo.platform.usRevId = hwConfig.getHwRevIdFromStepping(REVISION_B, hardwareInfo); retVal = hwHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo);
retVal = helper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo);
EXPECT_FALSE(retVal); EXPECT_FALSE(retVal);
commandQueue->release();
context->decRefInternal();
} }
PVCTEST_F(EngineNodeHelperPvcTests, givenBcsDisabledWhenGetEnginesCalledThenDontCreateAnyBcs) { PVCTEST_F(EngineNodeHelperPvcTests, givenBcsDisabledWhenGetEnginesCalledThenDontCreateAnyBcs) {