diff --git a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp index 9ed382a832..d3654c720e 100644 --- a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp +++ b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp @@ -10,6 +10,7 @@ #include "shared/source/command_stream/aub_command_stream_receiver.h" #include "shared/source/command_stream/tbx_command_stream_receiver_hw.h" #include "shared/source/helpers/api_specific_config.h" +#include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/hw_info.h" #include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/tests_configuration.h" @@ -41,6 +42,7 @@ void AUBFixtureL0::setUp() { void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEnabled) { ASSERT_NE(nullptr, hardwareInfo); const auto &hwInfo = *hardwareInfo; + backupUltConfig = std::make_unique>(&NEO::ultHwConfig); executionEnvironment = new NEO::ExecutionEnvironment(); executionEnvironment->prepareRootDeviceEnvironments(1u); @@ -50,9 +52,8 @@ void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEn if (debuggingEnabled) { executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); } - neoDevice = NEO::MockDevice::createWithExecutionEnvironment(&hwInfo, executionEnvironment, 0u); - auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); + auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); auto engineType = getChosenEngineType(hwInfo); const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); @@ -61,6 +62,11 @@ void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEn strfilename << NEO::ApiSpecificConfig::getAubPrefixForSpecificApi(); strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << gfxCoreHelper.getCsTraits(engineType).name; + aubFileName = strfilename.str(); + NEO::ultHwConfig.aubTestName = aubFileName.c_str(); + + neoDevice = NEO::MockDevice::createWithExecutionEnvironment(&hwInfo, executionEnvironment, 0u); + if (NEO::testMode == NEO::TestMode::AubTestsWithTbx) { this->csr = NEO::TbxCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0, neoDevice->getDeviceBitfield()); } else { diff --git a/level_zero/core/test/aub_tests/fixtures/aub_fixture.h b/level_zero/core/test/aub_tests/fixtures/aub_fixture.h index 15e453b4ed..be5073343a 100644 --- a/level_zero/core/test/aub_tests/fixtures/aub_fixture.h +++ b/level_zero/core/test/aub_tests/fixtures/aub_fixture.h @@ -11,6 +11,8 @@ #include "shared/source/command_stream/command_stream_receiver_simulated_common_hw.h" #include "shared/source/command_stream/command_stream_receiver_with_aub_dump.h" #include "shared/source/command_stream/tbx_command_stream_receiver_hw.h" +#include "shared/test/common/helpers/ult_hw_config.h" +#include "shared/test/common/helpers/variable_backup.h" #include "level_zero/core/test/unit_tests/mock.h" @@ -99,6 +101,9 @@ class AUBFixtureL0 { } } + std::string aubFileName; + std::unique_ptr> backupUltConfig; + const uint32_t rootDeviceIndex = 0; NEO::ExecutionEnvironment *executionEnvironment; NEO::MemoryManager *memoryManager = nullptr; diff --git a/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h b/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h index e79fa8e333..9f6d803bfe 100644 --- a/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h +++ b/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h @@ -13,6 +13,7 @@ #include "shared/source/command_stream/tbx_command_stream_receiver_hw.h" #include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/gfx_core_helper.h" +#include "shared/test/common/helpers/ult_hw_config.h" #include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/mocks/mock_memory_operations_handler.h" #include "shared/test/common/tests_configuration.h" @@ -55,6 +56,8 @@ class AUBFixture : public CommandQueueHwFixture { void setUp(const HardwareInfo *hardwareInfo) { const HardwareInfo &hwInfo = hardwareInfo ? *hardwareInfo : *defaultHwInfo; + backupUltConfig = std::make_unique>(&ultHwConfig); + executionEnvironment = platform()->peekExecutionEnvironment(); executionEnvironment->prepareRootDeviceEnvironments(1u); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(&hwInfo); @@ -69,6 +72,9 @@ class AUBFixture : public CommandQueueHwFixture { strfilename << ApiSpecificConfig::getAubPrefixForSpecificApi(); strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << gfxCoreHelper.getCsTraits(engineType).name; + aubFileName = strfilename.str(); + ultHwConfig.aubTestName = aubFileName.c_str(); + auto pDevice = MockDevice::create(executionEnvironment, rootDeviceIndex); device = std::make_unique(pDevice); @@ -176,6 +182,9 @@ class AUBFixture : public CommandQueueHwFixture { private: using CommandQueueHwFixture::setUp; + std::string aubFileName; + std::unique_ptr> backupUltConfig; + }; // namespace NEO template diff --git a/shared/test/common/base_ult_config_listener.cpp b/shared/test/common/base_ult_config_listener.cpp index 8d54f6b5bb..b52d2dae49 100644 --- a/shared/test/common/base_ult_config_listener.cpp +++ b/shared/test/common/base_ult_config_listener.cpp @@ -36,7 +36,7 @@ void NEO::BaseUltConfigListener::OnTestEnd(const ::testing::TestInfo &) { // Ensure that global state is restored UltHwConfig expectedState{}; - static_assert(sizeof(UltHwConfig) == 15 * sizeof(bool), ""); // Ensure that there is no internal padding + static_assert(sizeof(UltHwConfig) == (16 * sizeof(bool) + sizeof(const char *)), ""); // Ensure that there is no internal padding EXPECT_EQ(0, memcmp(&expectedState, &ultHwConfig, sizeof(UltHwConfig))); EXPECT_EQ(0, memcmp(&referencedHwInfo.platform, &defaultHwInfo->platform, sizeof(PLATFORM))); diff --git a/shared/test/common/helpers/ult_hw_config.h b/shared/test/common/helpers/ult_hw_config.h index 4c4298d429..f26717c5c8 100644 --- a/shared/test/common/helpers/ult_hw_config.h +++ b/shared/test/common/helpers/ult_hw_config.h @@ -26,6 +26,9 @@ struct UltHwConfig { bool csrBaseCallCreatePreemption = true; bool csrCreatePreemptionReturnValue = true; + bool reserved = false; + + const char *aubTestName = nullptr; }; extern UltHwConfig ultHwConfig; diff --git a/shared/test/common/libult/create_command_stream.cpp b/shared/test/common/libult/create_command_stream.cpp index 203123e39e..0e76798493 100644 --- a/shared/test/common/libult/create_command_stream.cpp +++ b/shared/test/common/libult/create_command_stream.cpp @@ -7,7 +7,9 @@ #include "shared/test/common/libult/create_command_stream.h" +#include "shared/source/command_stream/aub_command_stream_receiver.h" #include "shared/source/command_stream/create_command_stream_impl.h" +#include "shared/source/command_stream/tbx_command_stream_receiver.h" #include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/execution_environment/execution_environment.h" #include "shared/source/execution_environment/root_device_environment.h" @@ -15,6 +17,7 @@ #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/ult_hw_config.h" #include "shared/test/common/mocks/ult_device_factory.h" +#include "shared/test/common/tests_configuration.h" namespace NEO { @@ -29,6 +32,14 @@ CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnviro return createCommandStreamImpl(executionEnvironment, rootDeviceIndex, deviceBitfield); } + if (ultHwConfig.aubTestName != nullptr) { + if (testMode == TestMode::AubTestsWithTbx) { + return TbxCommandStreamReceiver::create(ultHwConfig.aubTestName, true, executionEnvironment, rootDeviceIndex, deviceBitfield); + } else { + return AUBCommandStreamReceiver::create(ultHwConfig.aubTestName, true, executionEnvironment, rootDeviceIndex, deviceBitfield); + } + } + auto funcCreate = commandStreamReceiverFactory[IGFX_MAX_CORE + hwInfo->platform.eRenderCoreFamily]; if (funcCreate) { return funcCreate(false, executionEnvironment, rootDeviceIndex, deviceBitfield);