1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
/*
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/test/common/fixtures/mock_aub_center_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/execution_environment_helper.h"
#include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/libult/create_command_stream.h"
#include "shared/test/common/test_macros/hw_test.h"
namespace NEO {
struct HardwareInfo;
} // namespace NEO
using namespace NEO;
struct CreateCommandStreamReceiverTest : public ::testing::TestWithParam<CommandStreamReceiverType> {};
HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetToValidTypeThenTheFuntionReturnsCommandStreamReceiver) {
DebugManagerStateRestore stateRestorer;
debugManager.flags.EnableL3FlushAfterPostSync.set(0);
HardwareInfo *hwInfo = nullptr;
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
ASSERT_NE(nullptr, executionEnvironment->memoryManager.get());
executionEnvironment->incRefInternal();
MockAubCenterFixture::setMockAubCenter(*executionEnvironment->rootDeviceEnvironments[0]);
CommandStreamReceiverType csrType = GetParam();
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useHwCsr = true;
debugManager.flags.SetCommandStreamReceiver.set(static_cast<int32_t>(csrType));
{
auto csr = std::unique_ptr<CommandStreamReceiver>(createCommandStream(*executionEnvironment, 0, 1));
if (csrType < CommandStreamReceiverType::typesNum) {
EXPECT_NE(nullptr, csr.get());
} else {
EXPECT_EQ(nullptr, csr.get());
}
}
executionEnvironment->decRefInternal();
}
static CommandStreamReceiverType commandStreamReceiverTypes[] = {
CommandStreamReceiverType::hardware,
CommandStreamReceiverType::aub,
CommandStreamReceiverType::tbx,
CommandStreamReceiverType::hardwareWithAub,
CommandStreamReceiverType::tbxWithAub,
CommandStreamReceiverType::nullAub,
CommandStreamReceiverType::typesNum};
INSTANTIATE_TEST_SUITE_P(
CreateCommandStreamReceiverTest_Create,
CreateCommandStreamReceiverTest,
testing::ValuesIn(commandStreamReceiverTypes));
|