Create heap helper for bindless

Related-To: NEO-4724

Change-Id: I62527a3ad06dce5d886b6ecfebd3c9abc46f6741
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2020-10-19 10:02:28 +02:00
committed by sys_ocldev
parent 4e4affe53b
commit 6bb4112d1e
16 changed files with 384 additions and 35 deletions

View File

@@ -26,6 +26,8 @@ add_executable(${TARGET_NAME}
${NEO_SOURCE_DIR}/shared/test/unit_test/helpers/memory_management.cpp
${NEO_SOURCE_DIR}/shared/test/unit_test/helpers/memory_leak_listener.h
${NEO_SOURCE_DIR}/shared/test/unit_test/helpers/memory_leak_listener.cpp
${NEO_SOURCE_DIR}/shared/test/unit_test/mocks/ult_device_factory.cpp
${NEO_SOURCE_DIR}/shared/test/unit_test/mocks/ult_device_factory.h
${L0_CORE_ENABLERS}
)

View File

@@ -5,9 +5,12 @@
*
*/
#include "shared/source/device/root_device.h"
#include "shared/source/helpers/bindless_heaps_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
#include "shared/test/unit_test/mocks/mock_device.h"
#include "shared/test/unit_test/mocks/ult_device_factory.h"
#include "test.h"
@@ -377,13 +380,13 @@ struct MultipleDevicesTest : public ::testing::Test {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(NEO::defaultHwInfo.get());
}
memoryManager = new ::testing::NiceMock<MockMemoryManagerMultiDevice>(*executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
deviceFactory = std::make_unique<UltDeviceFactory>(numRootDevices, numSubDevices, *executionEnvironment);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
devices.push_back(std::unique_ptr<NEO::MockDevice>(NEO::MockDevice::createWithExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get(), executionEnvironment, i)));
devices.push_back(std::unique_ptr<NEO::Device>(deviceFactory->rootDevices[i]));
}
memoryManager = new ::testing::NiceMock<MockMemoryManagerMultiDevice>(*devices[0].get()->getExecutionEnvironment());
devices[0].get()->getExecutionEnvironment()->memoryManager.reset(memoryManager);
driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
driverHandle->initialize(std::move(devices));
}
@@ -391,6 +394,7 @@ struct MultipleDevicesTest : public ::testing::Test {
DebugManagerStateRestore restorer;
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;
MockMemoryManagerMultiDevice *memoryManager = nullptr;
std::unique_ptr<UltDeviceFactory> deviceFactory;
const uint32_t numRootDevices = 2u;
const uint32_t numSubDevices = 2u;

View File

@@ -9,6 +9,7 @@
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
#include "shared/test/unit_test/mocks/ult_device_factory.h"
#include "opencl/test/unit_test/mocks/mock_io_functions.h"
#include "test.h"
@@ -241,26 +242,23 @@ struct DriverTestMultipleFamilySupport : public ::testing::Test {
void SetUp() override {
VariableBackup<bool> mockDeviceFlagBackup(&MockDevice::createSingleDevice, false);
NEO::ExecutionEnvironment *executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(NEO::defaultHwInfo.get());
}
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
devices.push_back(std::unique_ptr<NEO::MockDevice>(NEO::MockDevice::createWithExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get(), executionEnvironment, i)));
deviceFactory = std::make_unique<UltDeviceFactory>(numRootDevices, numSubDevices);
for (auto i = 0u; i < numRootDevices; i++) {
devices.push_back(std::unique_ptr<NEO::Device>(deviceFactory->rootDevices[i]));
if (i < numSupportedRootDevices) {
devices[i]->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.levelZeroSupported = true;
} else {
deviceFactory->rootDevices.erase(deviceFactory->rootDevices.begin() + i);
devices[i]->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.levelZeroSupported = false;
}
}
}
DebugManagerStateRestore restorer;
std::vector<std::unique_ptr<NEO::Device>> devices;
std::unique_ptr<UltDeviceFactory> deviceFactory;
const uint32_t numRootDevices = 3u;
const uint32_t numSubDevices = 2u;
const uint32_t numSupportedRootDevices = 2u;
};