Add instance of gmm helper to execution environment

Change-Id: I1b044611fbad91fbb681ba233938f41502f29056
This commit is contained in:
Mateusz Jablonski
2018-07-03 10:00:12 +02:00
committed by sys_ocldev
parent f26535a93d
commit 94dbdb602d
67 changed files with 220 additions and 204 deletions

View File

@@ -38,7 +38,7 @@ using namespace ::testing;
namespace OCLRT {
TEST(DeviceOsTest, osSpecificExtensions) {
auto hwInfo = *platformDevices;
auto pDevice = Device::create<OCLRT::Device>(hwInfo);
auto pDevice = MockDevice::createWithNewExecutionEnvironment<Device>(hwInfo);
std::string extensionString(pDevice->getDeviceInfo().deviceExtensions);
@@ -53,7 +53,7 @@ TEST(DeviceOsTest, osSpecificExtensions) {
}
TEST(DeviceOsTest, supportedSimultaneousInterops) {
auto pDevice = std::unique_ptr<Device>(Device::create<OCLRT::Device>(*platformDevices));
auto pDevice = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(*platformDevices));
std::vector<unsigned int> expected = {0};
@@ -62,7 +62,7 @@ TEST(DeviceOsTest, supportedSimultaneousInterops) {
TEST(DeviceOsTest, DeviceCreationFail) {
auto hwInfo = *platformDevices;
auto pDevice = Device::create<OCLRT::FailDevice>(hwInfo);
auto pDevice = MockDevice::createWithNewExecutionEnvironment<FailDevice>(hwInfo);
EXPECT_THAT(pDevice, nullptr);
}
@@ -112,7 +112,7 @@ TEST(ApiOsTest, notSupportedApiList) {
TEST(DeviceOsTest, DeviceCreationFailMidThreadPreemption) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::MidThread));
auto pDevice = Device::create<OCLRT::FailDeviceAfterOne>(nullptr);
auto pDevice = MockDevice::createWithNewExecutionEnvironment<FailDeviceAfterOne>(nullptr);
EXPECT_THAT(pDevice, nullptr);
}

View File

@@ -1120,7 +1120,7 @@ TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenAllHeapsAreExh
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.Force32bitAddressing.set(true);
std::unique_ptr<Device> pDevice(Device::create<OCLRT::MockDevice>(nullptr));
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
memoryManager->device = pDevice.get();
memoryManager->setForce32BitAllocations(true);
@@ -1150,7 +1150,7 @@ TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenAllHeapsAreExh
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.Force32bitAddressing.set(true);
std::unique_ptr<Device> pDevice(Device::create<OCLRT::MockDevice>(nullptr));
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
pDevice->increaseProgramCount();
memoryManager->device = pDevice.get();
memoryManager->setForce32BitAllocations(true);
@@ -1166,7 +1166,7 @@ TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenInternalHeapIs
DebugManagerStateRestore dbgStateRestore;
DebugManager.flags.Force32bitAddressing.set(true);
memoryManager->setForce32BitAllocations(true);
std::unique_ptr<Device> pDevice(Device::create<OCLRT::MockDevice>(nullptr));
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
memoryManager->device = pDevice.get();
auto allocator = memoryManager->getDrmInternal32BitAllocator();
@@ -1195,6 +1195,8 @@ TEST_F(DrmMemoryManagerTest, GivenMemoryManagerWhenAllocateGraphicsMemoryForImag
imgInfo.size = 4096u;
imgInfo.rowPitch = 512u;
ExecutionEnvironment execEnv;
execEnv.initGmm(*platformDevices);
auto queryGmm = MockGmm::queryImgParams(imgInfo);
auto imageGraphicsAllocation = memoryManager->allocateGraphicsMemoryForImage(imgInfo, queryGmm.get());
queryGmm.release();
@@ -1738,6 +1740,8 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
imgInfo.size = 4096u;
imgInfo.rowPitch = 512u;
ExecutionEnvironment execEnv;
execEnv.initGmm(*platformDevices);
auto queryGmm = MockGmm::queryImgParams(imgInfo);
auto allocation = memoryManager->allocateGraphicsMemoryForImage(imgInfo, queryGmm.get());
queryGmm.release();