mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Override engine type used by device in Device ctor
AUB tests do not use DeviceFactory class to create Device objects but still need to have a functionality to override default engine type Change-Id: I6841cb0a9c5726ac4308c742c78cf7a61829f168
This commit is contained in:

committed by
sys_ocldev

parent
b5dab07aa2
commit
5a175cf1cf
@ -118,6 +118,19 @@ TEST_F(DeviceTest, getEngineTypeDefault) {
|
||||
EXPECT_EQ(defaultEngineType, actualEngineType);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, givenDebugVariableOverrideEngineTypeWhenDeviceIsCreatedThenUseDebugNotDefaul) {
|
||||
EngineType expectedEngine = EngineType::ENGINE_VCS;
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(expectedEngine));
|
||||
auto pTestDevice = std::unique_ptr<Device>(createWithUsDeviceId(0));
|
||||
|
||||
EngineType actualEngineType = pTestDevice->getEngineType();
|
||||
EngineType defaultEngineType = hwInfoHelper.capabilityTable.defaultEngineType;
|
||||
|
||||
EXPECT_NE(defaultEngineType, actualEngineType);
|
||||
EXPECT_EQ(expectedEngine, actualEngineType);
|
||||
}
|
||||
|
||||
struct SmallMockDevice : public Device {
|
||||
SmallMockDevice(const HardwareInfo &hwInfo, bool isRootDevice = true)
|
||||
: Device(hwInfo, isRootDevice) {}
|
||||
@ -129,4 +142,4 @@ TEST(DeviceCreation, givenDeviceWithUsedTagAllocationWhenItIsDestroyedThenThereA
|
||||
std::unique_ptr<SmallMockDevice> device(Device::create<SmallMockDevice>(platformDevices[0]));
|
||||
auto tagAllocation = device->peekTagAllocation();
|
||||
tagAllocation->taskCount = 1;
|
||||
}
|
||||
}
|
||||
|
@ -116,19 +116,3 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
|
||||
|
||||
DeviceFactory::releaseDevices();
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
int32_t debugEngineType = 2;
|
||||
DebugManager.flags.NodeOrdinal.set(debugEngineType);
|
||||
HardwareInfo *hwInfoOverriden = nullptr;
|
||||
size_t numDevices = 0;
|
||||
|
||||
bool success = DeviceFactory::getDevices(&hwInfoOverriden, numDevices);
|
||||
ASSERT_TRUE(success);
|
||||
ASSERT_NE(nullptr, hwInfoOverriden);
|
||||
int32_t actualEngineType = static_cast<int32_t>(hwInfoOverriden->capabilityTable.defaultEngineType);
|
||||
EXPECT_EQ(debugEngineType, actualEngineType);
|
||||
|
||||
DeviceFactory::releaseDevices();
|
||||
}
|
||||
|
Reference in New Issue
Block a user