Remove platformDevices from shared, fixtures and mocks

Related-To: NEO-4499
Change-Id: If835ad7a3f21682bce8abe446867857c4e42cadc
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-03-24 17:04:08 +01:00
committed by sys_ocldev
parent 94bd9af6e2
commit fb0f74dc5a
11 changed files with 16 additions and 16 deletions

View File

@ -20,7 +20,7 @@ struct DispatchFlagsTests : public ::testing::Test {
template <typename CsrType>
void SetUpImpl() {
environmentWrapper.setCsrType<CsrType>();
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
context = std::make_unique<MockContext>(device.get());
}

View File

@ -133,7 +133,7 @@ struct ImageClearColorFixture : ::testing::Test {
return surfaceState;
}
NEO::HardwareInfo hardwareInfo = **NEO::platformDevices;
NEO::HardwareInfo hardwareInfo = *NEO::defaultHwInfo;
MockContext context;
std::unique_ptr<Image> image;
};

View File

@ -24,8 +24,8 @@ class MemoryAllocatorFixture : public MemoryManagementFixture {
MemoryManagementFixture::SetUp();
executionEnvironment = new ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(*platformDevices);
device.reset(MockDevice::createWithExecutionEnvironment<MockDevice>(*platformDevices, executionEnvironment, 0u));
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
device.reset(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
memoryManager = new MockMemoryManager(false, false, *executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
csr = &device->getGpgpuCommandStreamReceiver();

View File

@ -18,7 +18,7 @@ using namespace NEO;
void MemoryManagerWithCsrFixture::SetUp() {
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(*platformDevices);
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
csr = std::make_unique<MockCommandStreamReceiver>(this->executionEnvironment, 0);
memoryManager = new MockMemoryManager(executionEnvironment);
executionEnvironment.memoryManager.reset(memoryManager);

View File

@ -33,7 +33,7 @@ struct MockAubCenterFixture {
}
static void setMockAubCenter(RootDeviceEnvironment &rootDeviceEnvironment, CommandStreamReceiverType commandStreamReceiverType) {
if (testMode != TestMode::AubTests && testMode != TestMode::AubTestsWithTbx) {
auto mockAubCenter = std::make_unique<MockAubCenter>(platformDevices[0], false, "", commandStreamReceiverType);
auto mockAubCenter = std::make_unique<MockAubCenter>(defaultHwInfo.get(), false, "", commandStreamReceiverType);
mockAubCenter->aubManager = std::make_unique<MockAubManager>();
rootDeviceEnvironment.aubCenter.reset(mockAubCenter.release());
}

View File

@ -182,7 +182,7 @@ template <typename CsrType>
std::unique_ptr<AubExecutionEnvironment> getEnvironment(bool createTagAllocation, bool allocateCommandBuffer, bool standalone) {
std::unique_ptr<ExecutionEnvironment> executionEnvironment(new ExecutionEnvironment);
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(*platformDevices);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(new AubCenter());
executionEnvironment->initializeMemoryManager();

View File

@ -91,7 +91,7 @@ class MockDevice : public RootDevice {
template <typename T>
static T *createWithExecutionEnvironment(const HardwareInfo *pHwInfo, ExecutionEnvironment *executionEnvironment, uint32_t rootDeviceIndex) {
pHwInfo = pHwInfo ? pHwInfo : platformDevices[0];
pHwInfo = pHwInfo ? pHwInfo : defaultHwInfo.get();
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(pHwInfo);
T *device = new T(executionEnvironment, rootDeviceIndex);
executionEnvironment->memoryManager = std::move(device->mockMemoryManager);
@ -103,7 +103,7 @@ class MockDevice : public RootDevice {
ExecutionEnvironment *executionEnvironment = new ExecutionEnvironment();
auto numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get() ? DebugManager.flags.CreateMultipleRootDevices.get() : 1u;
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
pHwInfo = pHwInfo ? pHwInfo : platformDevices[0];
pHwInfo = pHwInfo ? pHwInfo : defaultHwInfo.get();
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(pHwInfo);
}
@ -127,7 +127,7 @@ inline Device *MockDevice::createWithNewExecutionEnvironment<Device>(const Hardw
auto executionEnvironment = new ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1);
MockAubCenterFixture::setMockAubCenter(*executionEnvironment->rootDeviceEnvironments[0]);
auto hwInfo = pHwInfo ? pHwInfo : *platformDevices;
auto hwInfo = pHwInfo ? pHwInfo : defaultHwInfo.get();
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
executionEnvironment->initializeMemoryManager();
return Device::create<RootDevice>(executionEnvironment, 0u);

View File

@ -59,10 +59,10 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
hostPtrManager.reset(new MockHostPtrManager);
};
MockMemoryManager() : MockMemoryManager(*(new MockExecutionEnvironment(*platformDevices))) {
MockMemoryManager() : MockMemoryManager(*(new MockExecutionEnvironment(defaultHwInfo.get()))) {
mockExecutionEnvironment.reset(static_cast<MockExecutionEnvironment *>(&executionEnvironment));
};
MockMemoryManager(bool enable64pages, bool enableLocalMemory) : MemoryManagerCreate(enable64pages, enableLocalMemory, *(new MockExecutionEnvironment(*platformDevices))) {
MockMemoryManager(bool enable64pages, bool enableLocalMemory) : MemoryManagerCreate(enable64pages, enableLocalMemory, *(new MockExecutionEnvironment(defaultHwInfo.get()))) {
mockExecutionEnvironment.reset(static_cast<MockExecutionEnvironment *>(&executionEnvironment));
}
GraphicsAllocation *allocateGraphicsMemory64kb(const AllocationData &allocationData) override;

View File

@ -55,7 +55,7 @@ void GlobalMockSipProgram::initSipProgram() {
std::vector<char> binary = MockCompilerInterface::getDummyGenBinary();
executionEnvironment.prepareRootDeviceEnvironments(maxRootDeviceCount);
for (auto i = 0u; i < executionEnvironment.rootDeviceEnvironments.size(); i++) {
executionEnvironment.rootDeviceEnvironments[i]->setHwInfo(*platformDevices);
executionEnvironment.rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
}
executionEnvironment.calculateMaxOsContextCount();
sipProgram = Program::createFromGenBinary<GlobalMockSipProgram>(executionEnvironment,

View File

@ -67,7 +67,7 @@ void ThreadGroupPreemptionEnqueueKernelTest::SetUp() {
dbgRestore.reset(new DebugManagerStateRestore());
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::ThreadGroup));
globalHwInfo = const_cast<HardwareInfo *>(platformDevices[0]);
globalHwInfo = defaultHwInfo.get();
originalPreemptionMode = globalHwInfo->capabilityTable.defaultPreemptionMode;
globalHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::ThreadGroup;
@ -85,7 +85,7 @@ void MidThreadPreemptionEnqueueKernelTest::SetUp() {
dbgRestore.reset(new DebugManagerStateRestore());
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::MidThread));
globalHwInfo = const_cast<HardwareInfo *>(platformDevices[0]);
globalHwInfo = defaultHwInfo.get();
originalPreemptionMode = globalHwInfo->capabilityTable.defaultPreemptionMode;
globalHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;

View File

@ -24,7 +24,7 @@ TEST(GmmHelperTest, whenCreateGmmHelperWithoutOsInterfaceThenPassedAdapterBDFIsZ
ADAPTER_BDF expectedAdapterBDF{};
gmmHelper.reset(new GmmHelper(nullptr, platformDevices[0]));
gmmHelper.reset(new GmmHelper(nullptr, defaultHwInfo.get()));
EXPECT_EQ(0, memcmp(&expectedAdapterBDF, &passedInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF)));
}