Remove GMock from GMockMemoryManagerFailFirstAllocation, GMockMemoryManager...

Removed GMock from
- GMockMemoryManagerFailFirstAllocation
- GMockMemoryManager
- TestEventCsr
- MockKmdNotifyCsr
- MockMemoryOperationsHandlerTests
- GmockGmmMemory
- MockMemoryManagerCommandQueueSBA
- TestCmdQueueCsr

Renamed:
- GMockMemoryManagerFailFirstAllocation -> MockMemoryManagerFailFirstAllocation

Moved class body:
- GMockMemoryManager to MockMemoryManager
- GmockGmmMemory to MockGmmMemoryBase

Related-To: NEO-4914
Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwolinski
2022-01-13 13:03:40 +00:00
committed by Compute-Runtime-Automation
parent fbc0666d1b
commit d9bf1886c2
19 changed files with 378 additions and 310 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -1486,7 +1486,22 @@ template <typename GfxFamily>
struct TestEventCsr : public UltCommandStreamReceiver<GfxFamily> {
TestEventCsr(const ExecutionEnvironment &executionEnvironment, const DeviceBitfield deviceBitfield)
: UltCommandStreamReceiver<GfxFamily>(const_cast<ExecutionEnvironment &>(executionEnvironment), 0, deviceBitfield) {}
MOCK_METHOD3(waitForCompletionWithTimeout, bool(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
bool waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) override {
waitForCompletionWithTimeoutCalled++;
waitForCompletionWithTimeoutParamsPassed.push_back({enableTimeout, timeoutMs, taskCountToWait});
return waitForCompletionWithTimeoutResult;
}
struct WaitForCompletionWithTimeoutParams {
bool enableTimeout = false;
int64_t timeoutMs{};
uint32_t taskCountToWait{};
};
uint32_t waitForCompletionWithTimeoutCalled = 0u;
bool waitForCompletionWithTimeoutResult = true;
StackVec<WaitForCompletionWithTimeoutParams, 1> waitForCompletionWithTimeoutParamsPassed{};
};
HWTEST_F(EventTest, givenQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestToWaitingFunction) {
@@ -1498,18 +1513,15 @@ HWTEST_F(EventTest, givenQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestToWa
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->setHwInfo(&localHwInfo);
auto csr = new ::testing::NiceMock<TestEventCsr<FamilyType>>(*pDevice->executionEnvironment, pDevice->getDeviceBitfield());
auto csr = new TestEventCsr<FamilyType>(*pDevice->executionEnvironment, pDevice->getDeviceBitfield());
pDevice->resetCommandStreamReceiver(csr);
Event event(pCmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
event.updateCompletionStamp(1u, 0, 1u, 1u);
EXPECT_CALL(*csr, waitForCompletionWithTimeout(::testing::_,
localHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds, ::testing::_))
.Times(1)
.WillOnce(::testing::Return(true));
event.wait(true, true);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(localHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(EventTest, givenNonQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestToWaitingFunction) {
@@ -1522,18 +1534,15 @@ HWTEST_F(EventTest, givenNonQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestT
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->setHwInfo(&localHwInfo);
auto csr = new ::testing::NiceMock<TestEventCsr<FamilyType>>(*pDevice->executionEnvironment, pDevice->getDeviceBitfield());
auto csr = new TestEventCsr<FamilyType>(*pDevice->executionEnvironment, pDevice->getDeviceBitfield());
pDevice->resetCommandStreamReceiver(csr);
Event event(pCmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
event.updateCompletionStamp(1u, 0, 1u, 1u);
EXPECT_CALL(*csr, waitForCompletionWithTimeout(::testing::_,
localHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, ::testing::_))
.Times(1)
.WillOnce(::testing::Return(true));
event.wait(true, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(localHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(InternalsEventTest, givenCommandWhenSubmitCalledThenUpdateFlushStamp) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -198,7 +198,10 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDe
uint32_t destructorId = 0u;
struct MemoryMangerMock : public DestructorCounted<MockMemoryManager, 8> {
MemoryMangerMock(uint32_t &destructorId, ExecutionEnvironment &executionEnvironment) : DestructorCounted(destructorId, executionEnvironment) {}
MemoryMangerMock(uint32_t &destructorId, ExecutionEnvironment &executionEnvironment) : DestructorCounted(destructorId, executionEnvironment) {
callBaseAllocateGraphicsMemoryForNonSvmHostPtr = false;
callBasePopulateOsHandles = false;
}
};
struct DirectSubmissionControllerMock : public DestructorCounted<DirectSubmissionController, 7> {
DirectSubmissionControllerMock(uint32_t &destructorId) : DestructorCounted(destructorId) {}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -25,7 +25,7 @@ struct Gen12LpWddmTest : public GdiDllFixture, ::testing::Test {
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
rootDeviceEnvironment->initGmm();
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment));
gmmMemory = new ::testing::NiceMock<GmockGmmMemory>(rootDeviceEnvironment->getGmmClientContext());
gmmMemory = new MockGmmMemoryBase(rootDeviceEnvironment->getGmmClientContext());
wddm->gmmMemory.reset(gmmMemory);
}
@@ -36,29 +36,20 @@ struct Gen12LpWddmTest : public GdiDllFixture, ::testing::Test {
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
WddmMock *wddm = nullptr;
GmockGmmMemory *gmmMemory = nullptr;
MockGmmMemoryBase *gmmMemory = nullptr;
};
GEN12LPTEST_F(Gen12LpWddmTest, whenConfigureDeviceAddressSpaceThenObtainMinAddress) {
ON_CALL(*gmmMemory, configureDeviceAddressSpace(::testing::_,
::testing::_,
::testing::_,
::testing::_,
::testing::_))
.WillByDefault(::testing::Return(true));
uintptr_t minAddress = 0x12345u;
EXPECT_NE(NEO::windowsMinAddress, minAddress);
EXPECT_CALL(*gmmMemory,
getInternalGpuVaRangeLimit())
.Times(1)
.WillRepeatedly(::testing::Return(minAddress));
gmmMemory->getInternalGpuVaRangeLimitResult = minAddress;
wddm->init();
EXPECT_EQ(minAddress, wddm->getWddmMinAddress());
EXPECT_EQ(1u, gmmMemory->getInternalGpuVaRangeLimitCalled);
}
using Gen12LpWddmHwInfoTest = ::testing::Test;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -73,13 +73,41 @@ struct KmdNotifyTests : public ::testing::Test {
public:
MockKmdNotifyCsr(const ExecutionEnvironment &executionEnvironment, const DeviceBitfield deviceBitfield)
: UltCommandStreamReceiver<Family>(const_cast<ExecutionEnvironment &>(executionEnvironment), 0, deviceBitfield) {}
MOCK_METHOD1(waitForFlushStamp, bool(FlushStamp &flushStampToWait));
MOCK_METHOD3(waitForCompletionWithTimeout, bool(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
bool waitForFlushStamp(FlushStamp &flushStampToWait) override {
waitForFlushStampCalled++;
waitForFlushStampParamsPassed.push_back({flushStampToWait});
return waitForFlushStampResult;
}
struct WaitForFlushStampParams {
FlushStamp flushStampToWait{};
};
uint32_t waitForFlushStampCalled = 0u;
bool waitForFlushStampResult = true;
StackVec<WaitForFlushStampParams, 1> waitForFlushStampParamsPassed{};
bool waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) override {
waitForCompletionWithTimeoutCalled++;
waitForCompletionWithTimeoutParamsPassed.push_back({enableTimeout, timeoutMs, taskCountToWait});
return waitForCompletionWithTimeoutResult;
}
struct WaitForCompletionWithTimeoutParams {
bool enableTimeout{};
int64_t timeoutMs{};
uint32_t taskCountToWait{};
};
uint32_t waitForCompletionWithTimeoutCalled = 0u;
bool waitForCompletionWithTimeoutResult = true;
StackVec<WaitForCompletionWithTimeoutParams, 2> waitForCompletionWithTimeoutParamsPassed{};
};
template <typename Family>
MockKmdNotifyCsr<Family> *createMockCsr() {
auto csr = new ::testing::NiceMock<MockKmdNotifyCsr<Family>>(*device->executionEnvironment, device->getDeviceBitfield());
auto csr = new MockKmdNotifyCsr<Family>(*device->executionEnvironment, device->getDeviceBitfield());
device->resetCommandStreamReceiver(csr);
mockKmdNotifyHelper = new MockKmdNotifyHelper(&device->getHardwareInfo().capabilityTable.kmdNotifyProperties);
@@ -100,19 +128,23 @@ struct KmdNotifyTests : public ::testing::Test {
HWTEST_F(KmdNotifyTests, givenTaskCountWhenWaitUntilCompletionCalledThenAlwaysTryCpuPolling) {
auto csr = createMockCsr<FamilyType>();
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 2, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
cmdQ->waitUntilComplete(taskCountToWait, {}, flushStampToWait, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(2, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
EXPECT_EQ(taskCountToWait, csr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
}
HWTEST_F(KmdNotifyTests, givenTaskCountAndKmdNotifyDisabledWhenWaitUntilCompletionCalledThenTryCpuPollingWithoutTimeout) {
overrideKmdNotifyParams(false, 0, false, 0, false, 0, false, 0);
auto csr = createMockCsr<FamilyType>();
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, 0, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0);
cmdQ->waitUntilComplete(taskCountToWait, {}, flushStampToWait, false);
EXPECT_EQ(0u, csr->waitForFlushStampCalled);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(false, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(0, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
EXPECT_EQ(taskCountToWait, csr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
}
HWTEST_F(KmdNotifyTests, givenNotReadyTaskCountWhenWaitUntilCompletionCalledThenTryCpuPollingAndKmdWait) {
@@ -120,40 +152,57 @@ HWTEST_F(KmdNotifyTests, givenNotReadyTaskCountWhenWaitUntilCompletionCalledThen
*csr->getTagAddress() = taskCountToWait - 1;
::testing::InSequence is;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 2, taskCountToWait)).Times(1).WillOnce(::testing::Return(false));
EXPECT_CALL(*csr, waitForFlushStamp(flushStampToWait)).Times(1).WillOnce(::testing::Return(true));
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, 0, taskCountToWait)).Times(1).WillOnce(::testing::Return(false));
csr->waitForCompletionWithTimeoutResult = false;
//we have unrecoverable for this case, this will throw.
EXPECT_THROW(cmdQ->waitUntilComplete(taskCountToWait, {}, flushStampToWait, false), std::exception);
EXPECT_EQ(1u, csr->waitForFlushStampCalled);
EXPECT_EQ(flushStampToWait, csr->waitForFlushStampParamsPassed[0].flushStampToWait);
EXPECT_EQ(2u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(2, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
EXPECT_EQ(taskCountToWait, csr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
EXPECT_EQ(false, csr->waitForCompletionWithTimeoutParamsPassed[1].enableTimeout);
EXPECT_EQ(0, csr->waitForCompletionWithTimeoutParamsPassed[1].timeoutMs);
EXPECT_EQ(taskCountToWait, csr->waitForCompletionWithTimeoutParamsPassed[1].taskCountToWait);
}
HWTEST_F(KmdNotifyTests, givenReadyTaskCountWhenWaitUntilCompletionCalledThenTryCpuPollingAndDontCallKmdWait) {
auto csr = createMockCsr<FamilyType>();
::testing::InSequence is;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 2, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0);
cmdQ->waitUntilComplete(taskCountToWait, {}, flushStampToWait, false);
EXPECT_EQ(0u, csr->waitForFlushStampCalled);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(2, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
EXPECT_EQ(taskCountToWait, csr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
}
HWTEST_F(KmdNotifyTests, givenDefaultArgumentWhenWaitUntilCompleteIsCalledThenDisableQuickKmdSleep) {
auto csr = createMockCsr<FamilyType>();
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
cmdQ->waitUntilComplete(taskCountToWait, {}, flushStampToWait, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(expectedTimeout, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
EXPECT_EQ(taskCountToWait, csr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
}
HWTEST_F(KmdNotifyTests, givenEnabledQuickSleepWhenWaitUntilCompleteIsCalledThenChangeDelayValue) {
auto csr = createMockCsr<FamilyType>();
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
cmdQ->waitUntilComplete(taskCountToWait, {}, flushStampToWait, true);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(expectedTimeout, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
EXPECT_EQ(taskCountToWait, csr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
}
HWTEST_F(KmdNotifyTests, givenDisabledQuickSleepWhenWaitUntilCompleteWithQuickSleepRequestIsCalledThenUseBaseDelayValue) {
@@ -161,9 +210,11 @@ HWTEST_F(KmdNotifyTests, givenDisabledQuickSleepWhenWaitUntilCompleteWithQuickSl
auto csr = createMockCsr<FamilyType>();
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
cmdQ->waitUntilComplete(taskCountToWait, {}, flushStampToWait, true);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(expectedTimeout, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
EXPECT_EQ(taskCountToWait, csr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
}
HWTEST_F(KmdNotifyTests, givenNotReadyTaskCountWhenPollForCompletionCalledThenTimeout) {
@@ -176,10 +227,12 @@ HWTEST_F(KmdNotifyTests, givenZeroFlushStampWhenWaitIsCalledThenDisableTimeout)
auto csr = createMockCsr<FamilyType>();
EXPECT_TRUE(device->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, ::testing::_, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0);
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 0, false, false);
EXPECT_EQ(0u, csr->waitForFlushStampCalled);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(false, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(taskCountToWait, csr->waitForCompletionWithTimeoutParamsPassed[0].taskCountToWait);
}
HWTEST_F(KmdNotifyTests, givenNonQuickSleepRequestWhenItsSporadicWaitThenOverrideQuickSleepRequest) {
@@ -187,12 +240,13 @@ HWTEST_F(KmdNotifyTests, givenNonQuickSleepRequestWhenItsSporadicWaitThenOverrid
auto csr = createMockCsr<FamilyType>();
auto expectedDelay = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(::testing::_, expectedDelay, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
int64_t timeSinceLastWait = mockKmdNotifyHelper->properties->delayQuickKmdSleepForSporadicWaitsMicroseconds + 1;
mockKmdNotifyHelper->lastWaitForCompletionTimestampUs = mockKmdNotifyHelper->getMicrosecondsSinceEpoch() - timeSinceLastWait;
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(expectedDelay, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(KmdNotifyTests, givenNonQuickSleepRequestWhenItsNotSporadicWaitThenOverrideQuickSleepRequest) {
@@ -200,33 +254,41 @@ HWTEST_F(KmdNotifyTests, givenNonQuickSleepRequestWhenItsNotSporadicWaitThenOver
auto csr = createMockCsr<FamilyType>();
auto expectedDelay = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(::testing::_, expectedDelay, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(expectedDelay, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(KmdNotifyTests, givenKmdNotifyDisabledWhenPowerSavingModeIsRequestedThenTimeoutIsEnabled) {
overrideKmdNotifyParams(false, 3, false, 2, false, 9999999, false, 0);
auto csr = createMockCsr<FamilyType>();
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 1, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, true);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(1, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(KmdNotifyTests, givenKmdNotifyDisabledWhenQueueHasPowerSavingModeAndCallWaitThenTimeoutIsEnabled) {
overrideKmdNotifyParams(false, 3, false, 2, false, 9999999, false, 0);
auto csr = createMockCsr<FamilyType>();
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 1, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
cmdQ->throttle = QueueThrottle::LOW;
cmdQ->waitUntilComplete(1, {}, 1, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(1, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(KmdNotifyTests, givenKmdNotifyDisabledWhenQueueHasPowerSavingModButThereIsNoFlushStampeAndCallWaitThenTimeoutIsDisabled) {
overrideKmdNotifyParams(false, 3, false, 2, false, 9999999, false, 0);
auto csr = createMockCsr<FamilyType>();
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, 0, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
cmdQ->throttle = QueueThrottle::LOW;
cmdQ->waitUntilComplete(1, {}, 0, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(false, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(0, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(KmdNotifyTests, givenQuickSleepRequestWhenItsSporadicWaitOptimizationIsDisabledThenDontOverrideQuickSleepRequest) {
@@ -234,9 +296,10 @@ HWTEST_F(KmdNotifyTests, givenQuickSleepRequestWhenItsSporadicWaitOptimizationIs
auto csr = createMockCsr<FamilyType>();
auto expectedDelay = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(::testing::_, expectedDelay, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, true, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(expectedDelay, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(KmdNotifyTests, givenTaskCountEqualToHwTagWhenWaitCalledThenDontMultiplyTimeout) {
@@ -245,9 +308,10 @@ HWTEST_F(KmdNotifyTests, givenTaskCountEqualToHwTagWhenWaitCalledThenDontMultipl
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(expectedTimeout, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(KmdNotifyTests, givenTaskCountLowerThanHwTagWhenWaitCalledThenDontMultiplyTimeout) {
@@ -256,9 +320,10 @@ HWTEST_F(KmdNotifyTests, givenTaskCountLowerThanHwTagWhenWaitCalledThenDontMulti
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, false);
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
EXPECT_EQ(expectedTimeout, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
}
HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWhenWaitCalledThenUpdateWaitTimestamp) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -225,11 +225,9 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithReadOnlyFlagsThenB
MockContext ctx(device.get());
// First fail simulates error for read only memory allocation
auto memoryManager = std::make_unique<::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>>(*device->getExecutionEnvironment());
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillOnce(::testing::Return(nullptr))
.WillRepeatedly(::testing::Invoke(memoryManager.get(), &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool));
auto memoryManager = std::make_unique<MockMemoryManagerFailFirstAllocation>(*device->getExecutionEnvironment());
memoryManager->returnNullptr = true;
memoryManager->returnBaseAllocateGraphicsMemoryInDevicePool = true;
cl_int retVal;
cl_mem_flags flags = CL_MEM_HOST_READ_ONLY | CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR;
@@ -256,9 +254,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithReadOnlyFlagsAndSe
// First fail simulates error for read only memory allocation
// Second fail returns nullptr
auto memoryManager = std::make_unique<::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>>(*device->getExecutionEnvironment());
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillRepeatedly(::testing::Return(nullptr));
auto memoryManager = std::make_unique<MockMemoryManagerFailFirstAllocation>(*device->getExecutionEnvironment());
cl_int retVal;
cl_mem_flags flags = CL_MEM_HOST_READ_ONLY | CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR;
@@ -281,9 +277,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithKernelWriteFlagThe
MockContext ctx(device.get());
// First fail simulates error for read only memory allocation
auto memoryManager = std::make_unique<::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>>(*device->getExecutionEnvironment());
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillOnce(::testing::Return(nullptr));
auto memoryManager = std::make_unique<MockMemoryManagerFailFirstAllocation>(*device->getExecutionEnvironment());
cl_int retVal;
cl_mem_flags flags = CL_MEM_HOST_READ_ONLY | CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
@@ -301,9 +295,7 @@ TEST(Buffer, givenNullPtrWhenBufferIsCreatedWithKernelReadOnlyFlagsThenBufferAll
MockContext ctx(device.get());
// First fail simulates error for read only memory allocation
auto memoryManager = std::make_unique<::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>>(*device->getExecutionEnvironment());
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillOnce(::testing::Return(nullptr));
auto memoryManager = std::make_unique<MockMemoryManagerFailFirstAllocation>(*device->getExecutionEnvironment());
cl_int retVal;
cl_mem_flags flags = CL_MEM_HOST_READ_ONLY | CL_MEM_WRITE_ONLY;
@@ -319,10 +311,8 @@ TEST(Buffer, givenNullptrPassedToBufferCreateWhenAllocationIsNotSystemMemoryPool
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockContext ctx(device.get());
auto memoryManager = std::make_unique<::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>>(*device->getExecutionEnvironment());
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillOnce(::testing::Invoke(memoryManager.get(), &GMockMemoryManagerFailFirstAllocation::allocateNonSystemGraphicsMemoryInDevicePool));
auto memoryManager = std::make_unique<MockMemoryManagerFailFirstAllocation>(*device->getExecutionEnvironment());
memoryManager->returnAllocateNonSystemGraphicsMemoryInDevicePool = true;
cl_int retVal = 0;
cl_mem_flags flags = CL_MEM_READ_WRITE;
@@ -338,10 +328,8 @@ TEST(Buffer, givenNullptrPassedToBufferCreateWhenAllocationIsNotSystemMemoryPool
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockContext ctx(device.get());
auto memoryManager = std::make_unique<::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>>(*device->getExecutionEnvironment());
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillOnce(::testing::Invoke(memoryManager.get(), &GMockMemoryManagerFailFirstAllocation::allocateNonSystemGraphicsMemoryInDevicePool));
auto memoryManager = std::make_unique<MockMemoryManagerFailFirstAllocation>(*device->getExecutionEnvironment());
memoryManager->returnAllocateNonSystemGraphicsMemoryInDevicePool = true;
cl_int retVal = 0;
cl_mem_flags flags = CL_MEM_READ_WRITE;
@@ -601,23 +589,19 @@ TEST(Buffer, givenZeroFlagsNoSharedContextAndCompressedBuffersDisabledWhenAlloca
TEST(Buffer, givenClMemCopyHostPointerPassedToBufferCreateWhenAllocationIsNotInSystemMemoryPoolThenAllocationIsWrittenByEnqueueWriteBuffer) {
ExecutionEnvironment *executionEnvironment = MockClDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
auto *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>(*executionEnvironment);
auto *memoryManager = new MockMemoryManagerFailFirstAllocation(*executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillRepeatedly(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool));
memoryManager->returnBaseAllocateGraphicsMemoryInDevicePool = true;
auto device = std::make_unique<MockClDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0));
MockContext ctx(device.get());
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillOnce(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::allocateNonSystemGraphicsMemoryInDevicePool))
.WillRepeatedly(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool));
cl_int retVal = 0;
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR;
char memory[] = {1, 2, 3, 4, 5, 6, 7, 8};
auto taskCount = device->getGpgpuCommandStreamReceiver().peekLatestFlushedTaskCount();
memoryManager->returnAllocateNonSystemGraphicsMemoryInDevicePool = true;
std::unique_ptr<Buffer> buffer(Buffer::create(&ctx, flags, sizeof(memory), memory, retVal));
ASSERT_NE(nullptr, buffer.get());
auto taskCountSent = device->getGpgpuCommandStreamReceiver().peekLatestFlushedTaskCount();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -36,11 +36,10 @@ class ImageInLocalMemoryTest : public testing::Test {
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&inputPlatformDevice);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
gmockMemoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>(true, *executionEnvironment);
executionEnvironment->memoryManager.reset(gmockMemoryManager);
mockMemoryManager = new MockMemoryManagerFailFirstAllocation(true, *executionEnvironment);
executionEnvironment->memoryManager.reset(mockMemoryManager);
ON_CALL(*gmockMemoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillByDefault(::testing::Invoke(gmockMemoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool));
mockMemoryManager->returnBaseAllocateGraphicsMemoryInDevicePool = true;
device = std::make_unique<MockClDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0));
context = std::make_unique<MockContext>(device.get());
@@ -56,7 +55,7 @@ class ImageInLocalMemoryTest : public testing::Test {
void TearDown() override {}
::testing::NiceMock<GMockMemoryManagerFailFirstAllocation> *gmockMemoryManager = nullptr;
MockMemoryManagerFailFirstAllocation *mockMemoryManager = nullptr;
cl_image_desc imageDesc{};
cl_image_format imageFormat = {};
std::unique_ptr<MockClDevice> device;
@@ -71,9 +70,6 @@ TEST_F(ImageInLocalMemoryTest, givenImageWithoutHostPtrWhenLocalMemoryIsEnabledT
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
EXPECT_CALL(*gmockMemoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillRepeatedly(::testing::Invoke(gmockMemoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool));
std::unique_ptr<Image> image(Image::create(
context.get(), ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
flags, 0, surfaceFormat, &imageDesc, memory, retVal));
@@ -85,7 +81,7 @@ TEST_F(ImageInLocalMemoryTest, givenImageWithoutHostPtrWhenLocalMemoryIsEnabledT
EXPECT_LE(imageDesc.image_width * surfaceFormat->surfaceFormat.ImageElementSizeInBytes, imgGfxAlloc->getUnderlyingBufferSize());
EXPECT_EQ(GraphicsAllocation::AllocationType::IMAGE, imgGfxAlloc->getAllocationType());
EXPECT_FALSE(imgGfxAlloc->getDefaultGmm()->useSystemMemoryPool);
EXPECT_LT(GmmHelper::canonize(gmockMemoryManager->getGfxPartition(imgGfxAlloc->getRootDeviceIndex())->getHeapBase(HeapIndex::HEAP_STANDARD64KB)), imgGfxAlloc->getGpuAddress());
EXPECT_GT(GmmHelper::canonize(gmockMemoryManager->getGfxPartition(imgGfxAlloc->getRootDeviceIndex())->getHeapLimit(HeapIndex::HEAP_STANDARD64KB)), imgGfxAlloc->getGpuAddress());
EXPECT_LT(GmmHelper::canonize(mockMemoryManager->getGfxPartition(imgGfxAlloc->getRootDeviceIndex())->getHeapBase(HeapIndex::HEAP_STANDARD64KB)), imgGfxAlloc->getGpuAddress());
EXPECT_GT(GmmHelper::canonize(mockMemoryManager->getGfxPartition(imgGfxAlloc->getRootDeviceIndex())->getHeapLimit(HeapIndex::HEAP_STANDARD64KB)), imgGfxAlloc->getGpuAddress());
EXPECT_EQ(0llu, imgGfxAlloc->getGpuBaseAddress());
}

View File

@@ -1472,17 +1472,12 @@ TEST(ImageTest, givenClMemForceLinearStorageSetWhenCreateImageThenDisallowTiling
TEST(ImageTest, givenClMemCopyHostPointerPassedToImageCreateWhenAllocationIsNotInSystemMemoryPoolThenAllocationIsWrittenByEnqueueWriteImage) {
REQUIRE_IMAGES_OR_SKIP(defaultHwInfo);
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
auto *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>(*executionEnvironment);
auto *memoryManager = new MockMemoryManagerFailFirstAllocation(*executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillRepeatedly(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool));
memoryManager->returnBaseAllocateGraphicsMemoryInDevicePool = true;
auto device = std::make_unique<MockClDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0));
MockContext ctx(device.get());
EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_))
.WillOnce(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::allocateNonSystemGraphicsMemoryInDevicePool))
.WillRepeatedly(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool));
char memory[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
auto taskCount = device->getGpgpuCommandStreamReceiver().peekLatestFlushedTaskCount();
@@ -1502,7 +1497,7 @@ TEST(ImageTest, givenClMemCopyHostPointerPassedToImageCreateWhenAllocationIsNotI
MockContext context;
auto surfaceFormat = Image::getSurfaceFormatFromTable(
flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
memoryManager->returnAllocateNonSystemGraphicsMemoryInDevicePool = true;
std::unique_ptr<Image> image(
Image::create(&ctx, ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context.getDevice(0)->getDevice()),
flags, 0, surfaceFormat, &imageDesc, memory, retVal));

View File

@@ -571,45 +571,42 @@ HWTEST_F(Wddm20InstrumentationTest, WhenConfiguringDeviceAddressSpaceThenTrueIsR
uintptr_t maxAddr = hwInfo.capabilityTable.gpuAddressSpace >= MemoryConstants::max64BitAppAddress
? reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress) + 1
: 0;
EXPECT_CALL(*gmmMem, configureDeviceAddressSpace(adapterHandle,
deviceHandle,
wddm->getGdi()->escape.mFunc,
maxAddr,
FtrL3IACoherency))
.Times(1)
.WillRepeatedly(::testing::Return(true));
wddm->init();
EXPECT_EQ(1u, gmmMem->configureDeviceAddressSpaceCalled);
EXPECT_EQ(adapterHandle, gmmMem->configureDeviceAddressSpaceParamsPassed[0].hAdapter);
EXPECT_EQ(deviceHandle, gmmMem->configureDeviceAddressSpaceParamsPassed[0].hDevice);
EXPECT_EQ(wddm->getGdi()->escape.mFunc, gmmMem->configureDeviceAddressSpaceParamsPassed[0].pfnEscape);
EXPECT_EQ(maxAddr, gmmMem->configureDeviceAddressSpaceParamsPassed[0].svmSize);
EXPECT_EQ(FtrL3IACoherency, gmmMem->configureDeviceAddressSpaceParamsPassed[0].bdwL3Coherency);
}
TEST_F(Wddm20InstrumentationTest, GivenNoAdapterWhenConfiguringDeviceAddressSpaceThenFalseIsReturned) {
auto gdi = std::make_unique<Gdi>();
wddm->resetGdi(gdi.release());
EXPECT_CALL(*gmmMem,
configureDeviceAddressSpace(static_cast<D3DKMT_HANDLE>(0), ::testing::_, ::testing::_, ::testing::_, ::testing::_))
.Times(0);
auto ret = wddm->configureDeviceAddressSpace();
EXPECT_FALSE(ret);
EXPECT_EQ(0u, gmmMem->configureDeviceAddressSpaceCalled);
}
TEST_F(Wddm20InstrumentationTest, GivenNoDeviceWhenConfiguringDeviceAddressSpaceThenFalseIsReturned) {
wddm->device = static_cast<D3DKMT_HANDLE>(0);
EXPECT_CALL(*gmmMem,
configureDeviceAddressSpace(::testing::_, static_cast<D3DKMT_HANDLE>(0), ::testing::_, ::testing::_, ::testing::_))
.Times(0);
auto ret = wddm->configureDeviceAddressSpace();
EXPECT_FALSE(ret);
EXPECT_EQ(0u, gmmMem->configureDeviceAddressSpaceCalled);
}
TEST_F(Wddm20InstrumentationTest, GivenNoEscFuncWhenConfiguringDeviceAddressSpaceThenFalseIsReturned) {
wddm->getGdi()->escape = static_cast<PFND3DKMT_ESCAPE>(nullptr);
EXPECT_CALL(*gmmMem, configureDeviceAddressSpace(::testing::_, ::testing::_, static_cast<PFND3DKMT_ESCAPE>(nullptr), ::testing::_,
::testing::_))
.Times(0);
auto ret = wddm->configureDeviceAddressSpace();
EXPECT_FALSE(ret);
EXPECT_EQ(0u, gmmMem->configureDeviceAddressSpaceCalled);
}
TEST_F(Wddm20Tests, WhenGettingMaxApplicationAddressThen32Or64BitIsCorrectlyReturned) {
@@ -1337,41 +1334,26 @@ TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoSucceedsThenDeviceCallbacksAr
TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoFailsThenDeviceIsNotConfigured) {
auto gmockGmmMemory = new ::testing::NiceMock<GmockGmmMemory>(getGmmClientContext());
ON_CALL(*gmockGmmMemory, setDeviceInfo(::testing::_))
.WillByDefault(::testing::Return(false));
EXPECT_CALL(*gmockGmmMemory, configureDeviceAddressSpace(::testing::_,
::testing::_,
::testing::_,
::testing::_,
::testing::_))
.Times(0);
auto mockGmmMemory = new MockGmmMemoryBase(getGmmClientContext());
mockGmmMemory->setDeviceInfoResult = false;
wddm->gmmMemory.reset(gmockGmmMemory);
wddm->gmmMemory.reset(mockGmmMemory);
wddm->init();
EXPECT_EQ(0u, mockGmmMemory->configureDeviceAddressSpaceCalled);
}
HWTEST_F(Wddm20WithMockGdiDllTests, givenNonGen12LPPlatformWhenConfigureDeviceAddressSpaceThenDontObtainMinAddress) {
if (defaultHwInfo->platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
GTEST_SKIP();
}
auto gmmMemory = new ::testing::NiceMock<GmockGmmMemory>(getGmmClientContext());
auto gmmMemory = new MockGmmMemoryBase(getGmmClientContext());
wddm->gmmMemory.reset(gmmMemory);
ON_CALL(*gmmMemory, configureDeviceAddressSpace(::testing::_,
::testing::_,
::testing::_,
::testing::_,
::testing::_))
.WillByDefault(::testing::Return(true));
EXPECT_CALL(*gmmMemory,
getInternalGpuVaRangeLimit())
.Times(0);
wddm->init();
EXPECT_EQ(NEO::windowsMinAddress, wddm->getWddmMinAddress());
EXPECT_EQ(0u, gmmMemory->getInternalGpuVaRangeLimitCalled);
}
struct GdiWithMockedCloseFunc : public MockGdi {