From 5f11e68861fbc13f26d2766dfea92ca65320e4b6 Mon Sep 17 00:00:00 2001 From: "Hoppe, Mateusz" Date: Mon, 1 Oct 2018 13:36:15 -0700 Subject: [PATCH] Add EngineType suffix to aub file name in AubFixture Change-Id: I9b8f27461e6d36d596e85fde973aa1b2f34dbede --- runtime/device/device.cpp | 5 ++--- runtime/helpers/hw_info.cpp | 7 +++++++ runtime/helpers/hw_info.h | 1 + unit_tests/aub_tests/fixtures/CMakeLists.txt | 1 + unit_tests/aub_tests/fixtures/aub_fixture.h | 5 ++++- unit_tests/helpers/hw_helper_tests.cpp | 19 ++++++++++++++++++- 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index 5169f5619c..5f540c5e61 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -70,9 +70,8 @@ Device::Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnviro deviceExtensions.reserve(1000); name.reserve(100); preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo); - engineType = DebugManager.flags.NodeOrdinal.get() == -1 - ? hwInfo.capabilityTable.defaultEngineType - : static_cast(DebugManager.flags.NodeOrdinal.get()); + engineType = getChosenEngineType(hwInfo); + if (!getSourceLevelDebugger()) { this->executionEnvironment->initSourceLevelDebugger(hwInfo); } diff --git a/runtime/helpers/hw_info.cpp b/runtime/helpers/hw_info.cpp index f1bbed2096..e307807440 100644 --- a/runtime/helpers/hw_info.cpp +++ b/runtime/helpers/hw_info.cpp @@ -7,6 +7,7 @@ #include "hw_info.h" #include "hw_cmds.h" +#include "runtime/os_interface/debug_settings_manager.h" namespace OCLRT { HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *skuTable, const WorkaroundTable *waTable, @@ -42,4 +43,10 @@ bool getHwInfoForPlatformString(const char *str, const HardwareInfo *&hwInfoIn) } return ret; } + +EngineType getChosenEngineType(const HardwareInfo &hwInfo) { + return DebugManager.flags.NodeOrdinal.get() == -1 + ? hwInfo.capabilityTable.defaultEngineType + : static_cast(DebugManager.flags.NodeOrdinal.get()); +} } // namespace OCLRT diff --git a/runtime/helpers/hw_info.h b/runtime/helpers/hw_info.h index 3349dbf237..8b57afaa72 100644 --- a/runtime/helpers/hw_info.h +++ b/runtime/helpers/hw_info.h @@ -113,4 +113,5 @@ struct EnableGfxFamilyHw { const char *getPlatformType(const HardwareInfo &hwInfo); bool getHwInfoForPlatformString(const char *str, const HardwareInfo *&hwInfoIn); +EngineType getChosenEngineType(const HardwareInfo &hwInfo); } // namespace OCLRT diff --git a/unit_tests/aub_tests/fixtures/CMakeLists.txt b/unit_tests/aub_tests/fixtures/CMakeLists.txt index 6a78983383..38130377c0 100644 --- a/unit_tests/aub_tests/fixtures/CMakeLists.txt +++ b/unit_tests/aub_tests/fixtures/CMakeLists.txt @@ -6,6 +6,7 @@ target_sources(igdrcl_aub_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/aub_fixture.h ${CMAKE_CURRENT_SOURCE_DIR}/aub_parent_kernel_fixture.h ${CMAKE_CURRENT_SOURCE_DIR}/fixture_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hello_world_fixture.h diff --git a/unit_tests/aub_tests/fixtures/aub_fixture.h b/unit_tests/aub_tests/fixtures/aub_fixture.h index a70fc5d039..d35c7adf72 100644 --- a/unit_tests/aub_tests/fixtures/aub_fixture.h +++ b/unit_tests/aub_tests/fixtures/aub_fixture.h @@ -28,9 +28,12 @@ class AUBFixture : public CommandQueueHwFixture { const HardwareInfo &hwInfo = hardwareInfo ? *hardwareInfo : *platformDevices[0]; uint32_t deviceIndex = 0; + auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + EngineType engineType = getChosenEngineType(hwInfo); + const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); std::stringstream strfilename; - strfilename << testInfo->test_case_name() << "_" << testInfo->name(); + strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << hwHelper.getCsTraits(engineType).name; executionEnvironment = new ExecutionEnvironment; diff --git a/unit_tests/helpers/hw_helper_tests.cpp b/unit_tests/helpers/hw_helper_tests.cpp index 9aba4d862f..ac275f8c2a 100644 --- a/unit_tests/helpers/hw_helper_tests.cpp +++ b/unit_tests/helpers/hw_helper_tests.cpp @@ -5,8 +5,9 @@ * */ -#include "unit_tests/helpers/hw_helper_tests.h" #include "runtime/helpers/options.h" +#include "unit_tests/helpers/debug_manager_state_restore.h" +#include "unit_tests/helpers/hw_helper_tests.h" void HwHelperTest::SetUp() { memcpy(&testPlatform, platformDevices[0]->pPlatform, sizeof(testPlatform)); @@ -153,3 +154,19 @@ TEST(HwInfoTest, givenHwInfoWhenIsNotCoreThenPlatformTypeIsLp) { auto platformType = getPlatformType(hwInfo); EXPECT_STREQ("lp", platformType); } + +TEST(HwInfoTest, givenHwInfoWhenChosenEngineTypeQueriedThenDefaultIsReturned) { + HardwareInfo hwInfo; + hwInfo.capabilityTable.defaultEngineType = EngineType::ENGINE_RCS; + auto engineType = getChosenEngineType(hwInfo); + EXPECT_EQ(EngineType::ENGINE_RCS, engineType); +} + +TEST(HwInfoTest, givenNodeOrdinalSetWhenChosenEngineTypeQueriedThenSetValueIsReturned) { + DebugManagerStateRestore dbgRestore; + DebugManager.flags.NodeOrdinal.set(EngineType::ENGINE_VECS); + HardwareInfo hwInfo; + hwInfo.capabilityTable.defaultEngineType = EngineType::ENGINE_RCS; + auto engineType = getChosenEngineType(hwInfo); + EXPECT_EQ(EngineType::ENGINE_VECS, engineType); +}