mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
feature: expose separate L0 driver handle per product family in Core/Tools path
Related-To: NEO-14062 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
aafefda74f
commit
87f4cd8e83
@@ -74,9 +74,12 @@ void DriverImp::initialize(ze_result_t *result) {
|
||||
auto neoDevices = NEO::DeviceFactory::createDevices(*executionEnvironment);
|
||||
executionEnvironment->decRefInternal();
|
||||
if (!neoDevices.empty()) {
|
||||
auto driverHandle = DriverHandle::create(std::move(neoDevices), envVariables, result);
|
||||
if (driverHandle) {
|
||||
globalDriverHandles->push_back(driverHandle);
|
||||
auto deviceGroups = NEO::Device::groupDevices(std::move(neoDevices));
|
||||
for (auto &devices : deviceGroups) {
|
||||
auto driverHandle = DriverHandle::create(std::move(devices), envVariables, result);
|
||||
if (driverHandle) {
|
||||
globalDriverHandles->push_back(driverHandle);
|
||||
}
|
||||
}
|
||||
|
||||
if (globalDriverHandles->size() > 0) {
|
||||
|
||||
@@ -1449,5 +1449,60 @@ TEST(InitDriversTest, givenAllPossibleFlagCombinationsWhenInitDriversIsCalledThe
|
||||
}
|
||||
}
|
||||
|
||||
TEST(MultiDriverHandleTest, givenMultiplesDifferentDevicesWhenGetDriverHandleThenSeparateDriverHandleIsReturnedPerEachProductFamily) {
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
const size_t numRootDevices = 5u;
|
||||
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get(), true, numRootDevices);
|
||||
|
||||
executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo()->platform.eProductFamily = IGFX_LUNARLAKE;
|
||||
executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = true;
|
||||
executionEnvironment.rootDeviceEnvironments[1]->getMutableHardwareInfo()->platform.eProductFamily = IGFX_BMG;
|
||||
executionEnvironment.rootDeviceEnvironments[1]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = false;
|
||||
executionEnvironment.rootDeviceEnvironments[2]->getMutableHardwareInfo()->platform.eProductFamily = IGFX_LUNARLAKE;
|
||||
executionEnvironment.rootDeviceEnvironments[2]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = true;
|
||||
executionEnvironment.rootDeviceEnvironments[3]->getMutableHardwareInfo()->platform.eProductFamily = IGFX_LUNARLAKE;
|
||||
executionEnvironment.rootDeviceEnvironments[3]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = true;
|
||||
executionEnvironment.rootDeviceEnvironments[4]->getMutableHardwareInfo()->platform.eProductFamily = IGFX_PTL;
|
||||
executionEnvironment.rootDeviceEnvironments[4]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = true;
|
||||
|
||||
ultHwConfig.sourceExecutionEnvironment = &executionEnvironment;
|
||||
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
DriverImp driverImp;
|
||||
driverImp.initialize(&result);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ASSERT_FALSE(globalDriverHandles->empty());
|
||||
uint32_t numDrivers = 0;
|
||||
zeDriverGet(&numDrivers, nullptr);
|
||||
|
||||
ASSERT_EQ(3u, numDrivers);
|
||||
|
||||
ze_driver_handle_t drivers[3];
|
||||
zeDriverGet(&numDrivers, drivers);
|
||||
|
||||
auto driver0 = static_cast<L0::DriverHandleImp *>(drivers[0]);
|
||||
auto driver1 = static_cast<L0::DriverHandleImp *>(drivers[1]);
|
||||
auto driver2 = static_cast<L0::DriverHandleImp *>(drivers[2]);
|
||||
|
||||
EXPECT_EQ(1u, driver0->devices.size());
|
||||
EXPECT_EQ(IGFX_BMG, driver0->devices[0]->getHwInfo().platform.eProductFamily);
|
||||
|
||||
EXPECT_EQ(1u, driver1->devices.size());
|
||||
EXPECT_EQ(IGFX_PTL, driver1->devices[0]->getHwInfo().platform.eProductFamily);
|
||||
|
||||
EXPECT_EQ(3u, driver2->devices.size());
|
||||
EXPECT_EQ(IGFX_LUNARLAKE, driver2->devices[0]->getHwInfo().platform.eProductFamily);
|
||||
EXPECT_EQ(IGFX_LUNARLAKE, driver2->devices[1]->getHwInfo().platform.eProductFamily);
|
||||
EXPECT_EQ(IGFX_LUNARLAKE, driver2->devices[2]->getHwInfo().platform.eProductFamily);
|
||||
|
||||
delete driver0;
|
||||
delete driver1;
|
||||
delete driver2;
|
||||
|
||||
globalDriverHandles->clear();
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/mocks/mock_memory_operations_handler.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/tests_configuration.h"
|
||||
|
||||
@@ -57,6 +58,7 @@ bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment) {
|
||||
executionEnvironment.rootDeviceEnvironments[i] = std::make_unique<RootDeviceEnvironment>(executionEnvironment);
|
||||
executionEnvironment.rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
||||
executionEnvironment.rootDeviceEnvironments[i]->initGmm();
|
||||
executionEnvironment.rootDeviceEnvironments[i]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
|
||||
|
||||
executionEnvironment.rootDeviceEnvironments[i]->getMutableHardwareInfo()->platform = ultHwConfig.sourceExecutionEnvironment->rootDeviceEnvironments[i]->getHardwareInfo()->platform;
|
||||
executionEnvironment.rootDeviceEnvironments[i]->getMutableHardwareInfo()->capabilityTable = ultHwConfig.sourceExecutionEnvironment->rootDeviceEnvironments[i]->getHardwareInfo()->capabilityTable;
|
||||
|
||||
Reference in New Issue
Block a user