Set root device index in OsContext

- correclty choose default engine context accounting for root device
index and  subdevices bitfield

Related-To: NEO-7516

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2022-11-16 19:31:25 +00:00
committed by Compute-Runtime-Automation
parent 4882f51721
commit f19abda0e2
53 changed files with 351 additions and 222 deletions

View File

@@ -6,6 +6,7 @@
*/
#pragma once
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
#include "shared/test/common/helpers/default_hw_info.h"
@@ -390,7 +391,7 @@ class MockMemoryManagerOsAgnosticContext : public MockMemoryManager {
MockMemoryManagerOsAgnosticContext(NEO::ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {}
OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
const EngineDescriptor &engineDescriptor) override {
auto osContext = new OsContext(0, engineDescriptor);
auto osContext = new OsContext(commandStreamReceiver->getRootDeviceIndex(), 0, engineDescriptor);
osContext->incRefInternal();
registeredEngines.emplace_back(commandStreamReceiver, osContext);
return osContext;

View File

@@ -18,7 +18,7 @@ class MockOsContext : public OsContext {
using OsContext::getDeviceBitfield;
MockOsContext(uint32_t contextId, const EngineDescriptor &engineDescriptorHelper)
: OsContext(contextId, engineDescriptorHelper) {}
: OsContext(0, contextId, engineDescriptorHelper) {}
};
static_assert(sizeof(OsContext) == sizeof(MockOsContext));

View File

@@ -78,7 +78,7 @@ class DrmBufferObjectFixture {
this->mock = std::make_unique<DrmClass>(*executionEnvironment.rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, this->mock);
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*mock.get(), 0u);
osContext.reset(new OsContextLinux(*this->mock, 0u, EngineDescriptorHelper::getDefaultDescriptor()));
osContext.reset(new OsContextLinux(*this->mock, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor()));
this->mock->reset();
bo = new TestedBufferObject(this->mock.get());
ASSERT_NE(nullptr, bo);

View File

@@ -48,7 +48,7 @@ class DrmCommandStreamTest : public ::testing::Test {
executionEnvironment.rootDeviceEnvironments[0]->initGmm();
mock->createVirtualMemoryAddressSpace(HwHelper::getSubDevicesCount(hwInfo));
osContext = std::make_unique<OsContextLinux>(*mock, 0u,
osContext = std::make_unique<OsContextLinux>(*mock, 0, 0u,
EngineDescriptorHelper::getDefaultDescriptor(HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0],
PreemptionHelper::getDefaultPreemptionMode(*hwInfo)));
osContext->ensureContextInitialized();

View File

@@ -47,7 +47,7 @@ struct WddmFixture : public Test<MockExecutionEnvironmentGmmFixture> {
wddm->init();
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0u, EngineDescriptorHelper::getDefaultDescriptor(engine, preemptionMode));
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0, 0u, EngineDescriptorHelper::getDefaultDescriptor(engine, preemptionMode));
osContext->ensureContextInitialized();
mockTemporaryResources = static_cast<MockWddmResidentAllocationsContainer *>(wddm->temporaryResources.get());
}
@@ -78,7 +78,7 @@ struct WddmFixtureLuid : public Test<MockExecutionEnvironmentGmmFixture> {
wddm->init();
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0u, EngineDescriptorHelper::getDefaultDescriptor(engine, preemptionMode));
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0, 0u, EngineDescriptorHelper::getDefaultDescriptor(engine, preemptionMode));
osContext->ensureContextInitialized();
mockTemporaryResources = static_cast<MockWddmResidentAllocationsContainer *>(wddm->temporaryResources.get());
}
@@ -115,7 +115,7 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture, public MockExecutionEnv
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0u, EngineDescriptorHelper::getDefaultDescriptor(engine, preemptionMode));
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0, 0u, EngineDescriptorHelper::getDefaultDescriptor(engine, preemptionMode));
osContext->ensureContextInitialized();
}
@@ -163,7 +163,7 @@ struct WddmFixtureWithMockGdiDllWddmNoCleanup : public GdiDllFixture, public Moc
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0u, EngineDescriptorHelper::getDefaultDescriptor(engine, preemptionMode));
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0, 0u, EngineDescriptorHelper::getDefaultDescriptor(engine, preemptionMode));
osContext->ensureContextInitialized();
}