|
1 | 1 | /* |
2 | | - * Copyright (C) 2019 Intel Corporation |
| 2 | + * Copyright (C) 2019-2020 Intel Corporation |
3 | 3 | * |
4 | 4 | * SPDX-License-Identifier: MIT |
5 | 5 | * |
6 | 6 | */ |
7 | 7 |
|
| 8 | +#include "core/unit_tests/helpers/debug_manager_state_restore.h" |
| 9 | +#include "runtime/os_interface/device_factory.h" |
8 | 10 | #include "test.h" |
| 11 | +#include "unit_tests/mocks/mock_execution_environment.h" |
9 | 12 |
|
10 | 13 | using namespace NEO; |
11 | 14 |
|
@@ -80,3 +83,48 @@ TGLLPTEST_F(TgllpHwInfo, givenHwInfoConfigStringThenAfterSetupResultingVmeIsDisa |
80 | 83 | EXPECT_FALSE(hwInfo.capabilityTable.supportsVme); |
81 | 84 | } |
82 | 85 |
|
| 86 | +TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeForTgllpProductFamilyWhenGetDevicesForProductFamilyOverrideIsCalledThenAubCenterIsInitializedCorrectly) { |
| 87 | + DeviceFactoryCleaner cleaner; |
| 88 | + DebugManagerStateRestore stateRestore; |
| 89 | + DebugManager.flags.SetCommandStreamReceiver.set(1); |
| 90 | + DebugManager.flags.ProductFamilyOverride.set("tgllp"); |
| 91 | + |
| 92 | + MockExecutionEnvironment executionEnvironment(*platformDevices); |
| 93 | + |
| 94 | + size_t numDevices = 0; |
| 95 | + bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, executionEnvironment); |
| 96 | + ASSERT_TRUE(success); |
| 97 | + |
| 98 | + auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[0].get()); |
| 99 | + |
| 100 | + EXPECT_TRUE(rootDeviceEnvironment->initAubCenterCalled); |
| 101 | + EXPECT_FALSE(rootDeviceEnvironment->localMemoryEnabledReceived); |
| 102 | +} |
| 103 | + |
| 104 | +TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeWhenGetDevicesForProductFamilyOverrideIsCalledThenAllRootDeviceEnvironmentMembersAreInitialized) { |
| 105 | + DeviceFactoryCleaner cleaner; |
| 106 | + DebugManagerStateRestore stateRestore; |
| 107 | + auto requiredDeviceCount = 2u; |
| 108 | + DebugManager.flags.CreateMultipleRootDevices.set(requiredDeviceCount); |
| 109 | + DebugManager.flags.SetCommandStreamReceiver.set(1); |
| 110 | + DebugManager.flags.ProductFamilyOverride.set("tgllp"); |
| 111 | + |
| 112 | + MockExecutionEnvironment executionEnvironment(*platformDevices, true, requiredDeviceCount); |
| 113 | + |
| 114 | + size_t numDevices = 0; |
| 115 | + bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, executionEnvironment); |
| 116 | + ASSERT_TRUE(success); |
| 117 | + EXPECT_EQ(requiredDeviceCount, numDevices); |
| 118 | + |
| 119 | + std::set<MemoryOperationsHandler *> memoryOperationHandlers; |
| 120 | + for (auto rootDeviceIndex = 0u; rootDeviceIndex < requiredDeviceCount; rootDeviceIndex++) { |
| 121 | + auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get()); |
| 122 | + EXPECT_TRUE(rootDeviceEnvironment->initAubCenterCalled); |
| 123 | + EXPECT_FALSE(rootDeviceEnvironment->localMemoryEnabledReceived); |
| 124 | + |
| 125 | + auto memoryOperationInterface = rootDeviceEnvironment->memoryOperationsInterface.get(); |
| 126 | + EXPECT_NE(nullptr, memoryOperationInterface); |
| 127 | + EXPECT_EQ(memoryOperationHandlers.end(), memoryOperationHandlers.find(memoryOperationInterface)); |
| 128 | + memoryOperationHandlers.insert(memoryOperationInterface); |
| 129 | + } |
| 130 | +} |
0 commit comments