fix: correct cleanup path when set priority call fail in wddm path
improve mock gdi - return unique handle and host ptr when creating allocation Related-To: NEO-7194 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
6f45574ff9
commit
c0015b3b95
|
@ -33,6 +33,7 @@ namespace ult {
|
|||
|
||||
struct L0DebuggerWindowsFixture {
|
||||
void setUp() {
|
||||
DebugManager.flags.ForcePreferredAllocationMethod.set(static_cast<int32_t>(GfxMemoryAllocationMethod::UseUmdSystemPtr));
|
||||
executionEnvironment = new NEO::ExecutionEnvironment;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);
|
||||
|
@ -65,6 +66,7 @@ struct L0DebuggerWindowsFixture {
|
|||
void tearDown() {
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;
|
||||
NEO::MockDevice *neoDevice = nullptr;
|
||||
L0::Device *device = nullptr;
|
||||
|
|
|
@ -1259,9 +1259,7 @@ GraphicsAllocation *WddmMemoryManager::allocatePhysicalLocalDeviceMemory(const A
|
|||
auto handles = wddmAllocation->getHandles();
|
||||
|
||||
if (!wddm.setAllocationPriority(handles.data(), static_cast<UINT>(handles.size()), getPriorityForAllocation(allocationData.type))) {
|
||||
for (auto handleId = 0u; handleId < allocationData.storageInfo.getNumBanks(); handleId++) {
|
||||
delete wddmAllocation->getGmm(handleId);
|
||||
}
|
||||
freeGraphicsMemory(wddmAllocation.release());
|
||||
status = AllocationStatus::Error;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1351,9 +1349,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const
|
|||
auto handles = wddmAllocation->getHandles();
|
||||
|
||||
if (!wddm.setAllocationPriority(handles.data(), static_cast<UINT>(handles.size()), getPriorityForAllocation(allocationData.type))) {
|
||||
for (auto handleId = 0u; handleId < allocationData.storageInfo.getNumBanks(); handleId++) {
|
||||
delete wddmAllocation->getGmm(handleId);
|
||||
}
|
||||
freeGraphicsMemory(wddmAllocation.release());
|
||||
status = AllocationStatus::Error;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,13 @@
|
|||
|
||||
#include "shared/test/common/mock_gdi/mock_gdi.h"
|
||||
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
ADAPTER_INFO_KMD gAdapterInfo{};
|
||||
D3DDDI_MAPGPUVIRTUALADDRESS gLastCallMapGpuVaArg{};
|
||||
D3DDDI_RESERVEGPUVIRTUALADDRESS gLastCallReserveGpuVaArg{};
|
||||
|
@ -139,6 +143,17 @@ NTSTATUS __stdcall mockD3DKMTCreateAllocation(IN OUT D3DKMT_CREATEALLOCATION *al
|
|||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
std::map<D3DKMT_HANDLE, void *> staticStorageMap;
|
||||
std::map<D3DKMT_HANDLE, void *> userPtrMap;
|
||||
|
||||
constexpr uint32_t numStaticStorages = 128;
|
||||
constexpr uint32_t singleStorageSize = 8 * 64 * 1024;
|
||||
uint8_t staticStorages[(numStaticStorages + 1) * singleStorageSize]{};
|
||||
inline void *getStaticStorage(uint32_t slot) {
|
||||
auto baseAddress = alignUp(staticStorages, 64 * 1024);
|
||||
return ptrOffset(baseAddress, slot * singleStorageSize);
|
||||
}
|
||||
|
||||
NTSTATUS __stdcall mockD3DKMTCreateAllocation2(IN OUT D3DKMT_CREATEALLOCATION *allocation) {
|
||||
D3DDDI_ALLOCATIONINFO2 *allocationInfo;
|
||||
int numOfAllocations;
|
||||
|
@ -164,7 +179,30 @@ NTSTATUS __stdcall mockD3DKMTCreateAllocation2(IN OUT D3DKMT_CREATEALLOCATION *a
|
|||
|
||||
for (int i = 0; i < numOfAllocations; ++i) {
|
||||
if (allocationInfo != NULL) {
|
||||
allocationInfo->hAllocation = ALLOCATION_HANDLE;
|
||||
if (createResource || globalShare) {
|
||||
allocationInfo->hAllocation = ALLOCATION_HANDLE;
|
||||
} else {
|
||||
static uint32_t handleIdForStaticStorage = 1u;
|
||||
static uint32_t handleIdForUserPtr = ALLOCATION_HANDLE + 1u;
|
||||
if (allocationInfo->pSystemMem) {
|
||||
userPtrMap.insert({handleIdForUserPtr, const_cast<void *>(allocationInfo->pSystemMem)});
|
||||
allocationInfo->hAllocation = handleIdForUserPtr;
|
||||
handleIdForUserPtr++;
|
||||
if (handleIdForUserPtr == 2 * ALLOCATION_HANDLE) {
|
||||
handleIdForUserPtr = ALLOCATION_HANDLE + 1;
|
||||
}
|
||||
} else {
|
||||
if (staticStorageMap.size() >= numStaticStorages) {
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
staticStorageMap.insert({handleIdForStaticStorage, getStaticStorage(handleIdForStaticStorage % numStaticStorages)});
|
||||
allocationInfo->hAllocation = handleIdForStaticStorage;
|
||||
handleIdForStaticStorage++;
|
||||
if (handleIdForStaticStorage == ALLOCATION_HANDLE) {
|
||||
handleIdForStaticStorage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
allocationInfo++;
|
||||
}
|
||||
|
@ -194,8 +232,12 @@ NTSTATUS __stdcall mockD3DKMTDestroyAllocation2(IN CONST D3DKMT_DESTROYALLOCATIO
|
|||
allocationList = destroyAllocation->phAllocationList;
|
||||
|
||||
for (int i = 0; i < numOfAllocations; ++i) {
|
||||
if (allocationList != NULL) {
|
||||
if (*allocationList != ALLOCATION_HANDLE) {
|
||||
if (allocationList != NULL && *allocationList != ALLOCATION_HANDLE) {
|
||||
if (userPtrMap.find(*allocationList) != userPtrMap.end()) {
|
||||
userPtrMap.erase(*allocationList);
|
||||
} else if (staticStorageMap.find(*allocationList) != staticStorageMap.end()) {
|
||||
staticStorageMap.erase(*allocationList);
|
||||
} else {
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +265,7 @@ NTSTATUS __stdcall mockD3DKMTMapGpuVirtualAddress(IN OUT D3DDDI_MAPGPUVIRTUALADD
|
|||
if (mapGpuVA->hPagingQueue != PAGINGQUEUE_HANDLE) {
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
if (mapGpuVA->hAllocation != ALLOCATION_HANDLE && mapGpuVA->hAllocation != NT_ALLOCATION_HANDLE) {
|
||||
if (userPtrMap.find(mapGpuVA->hAllocation) == userPtrMap.end() && staticStorageMap.find(mapGpuVA->hAllocation) == staticStorageMap.end() && mapGpuVA->hAllocation != ALLOCATION_HANDLE && mapGpuVA->hAllocation != NT_ALLOCATION_HANDLE) {
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
if (mapGpuVA->MinimumAddress != 0) {
|
||||
|
@ -426,11 +468,18 @@ NTSTATUS __stdcall mockD3DKMTQueryResourceInfoFromNtHandle(IN OUT D3DKMT_QUERYRE
|
|||
}
|
||||
|
||||
NTSTATUS __stdcall mockD3DKMTLock2(IN OUT D3DKMT_LOCK2 *lock2) {
|
||||
if (lock2->hAllocation == 0 || lock2->hDevice == 0) {
|
||||
auto handle = lock2->hAllocation;
|
||||
if (lock2->hDevice == 0) {
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
lock2->pData = (void *)65536;
|
||||
return STATUS_SUCCESS;
|
||||
if (userPtrMap.find(handle) != userPtrMap.end()) {
|
||||
lock2->pData = userPtrMap[handle];
|
||||
return STATUS_SUCCESS;
|
||||
} else if (staticStorageMap.find(handle) != staticStorageMap.end()) {
|
||||
lock2->pData = staticStorageMap[handle];
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
NTSTATUS __stdcall mockD3DKMTUnlock2(IN CONST D3DKMT_UNLOCK2 *unlock2) {
|
||||
|
|
|
@ -153,7 +153,7 @@ bool WddmMock::destroyAllocation(WddmAllocation *alloc, OsContextWin *osContext)
|
|||
resourceHandle = alloc->resourceHandle;
|
||||
} else {
|
||||
allocationHandles = &alloc->getHandles()[0];
|
||||
allocationCount = 1;
|
||||
allocationCount = static_cast<uint32_t>(alloc->getHandles().size());
|
||||
}
|
||||
auto success = destroyAllocations(allocationHandles, allocationCount, resourceHandle);
|
||||
::alignedFree(alloc->getDriverAllocatedCpuPtr());
|
||||
|
|
|
@ -63,7 +63,7 @@ class MockGdi : public Gdi {
|
|||
|
||||
static NTSTATUS __stdcall destroyAllocation2Mock(IN CONST D3DKMT_DESTROYALLOCATION2 *arg) {
|
||||
getDestroyArg() = *arg;
|
||||
return 0;
|
||||
return mockD3DKMTDestroyAllocation2(arg);
|
||||
}
|
||||
|
||||
static NTSTATUS __stdcall waitFromCpuMock(IN CONST D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMCPU *arg) {
|
||||
|
|
|
@ -504,6 +504,8 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafDisabledWhenFlushIsCalledWithAll
|
|||
ResidencyContainer allocationsForResidency = {linearStreamAllocation};
|
||||
|
||||
EXPECT_FALSE(wddm->isKmDafEnabled());
|
||||
wddm->kmDafLockResult.called = 0;
|
||||
wddm->kmDafLockResult.lockedAllocations.clear();
|
||||
csr->flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
EXPECT_EQ(0u, wddm->kmDafLockResult.called);
|
||||
|
@ -520,6 +522,8 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithoutA
|
|||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
wddm->setKmDafEnabled(true);
|
||||
wddm->kmDafLockResult.called = 0;
|
||||
wddm->kmDafLockResult.lockedAllocations.clear();
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
EXPECT_EQ(0u, wddm->kmDafLockResult.called);
|
||||
|
@ -542,6 +546,8 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithResi
|
|||
EXPECT_EQ(linearStreamAllocation, csr->getResidencyAllocations()[0]);
|
||||
|
||||
wddm->setKmDafEnabled(true);
|
||||
wddm->kmDafLockResult.called = 0;
|
||||
wddm->kmDafLockResult.lockedAllocations.clear();
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
EXPECT_EQ(1u, wddm->kmDafLockResult.called);
|
||||
|
@ -563,6 +569,8 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
|||
ResidencyContainer allocationsForResidency = {linearStreamAllocation};
|
||||
|
||||
wddm->setKmDafEnabled(true);
|
||||
wddm->kmDafLockResult.called = 0;
|
||||
wddm->kmDafLockResult.lockedAllocations.clear();
|
||||
csr->flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
EXPECT_EQ(1u, wddm->kmDafLockResult.called);
|
||||
|
@ -584,6 +592,8 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
|||
ResidencyContainer allocationsForResidency = {fillPatternAllocation};
|
||||
|
||||
wddm->setKmDafEnabled(true);
|
||||
wddm->kmDafLockResult.called = 0;
|
||||
wddm->kmDafLockResult.lockedAllocations.clear();
|
||||
csr->flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
EXPECT_EQ(1u, wddm->kmDafLockResult.called);
|
||||
|
@ -605,6 +615,8 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
|||
ResidencyContainer allocationsForResidency = {commandBufferAllocation};
|
||||
|
||||
wddm->setKmDafEnabled(true);
|
||||
wddm->kmDafLockResult.called = 0;
|
||||
wddm->kmDafLockResult.lockedAllocations.clear();
|
||||
csr->flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
EXPECT_EQ(1u, wddm->kmDafLockResult.called);
|
||||
|
@ -626,6 +638,8 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
|||
ResidencyContainer allocationsForResidency = {nonLinearStreamAllocation};
|
||||
|
||||
wddm->setKmDafEnabled(true);
|
||||
wddm->kmDafLockResult.called = 0;
|
||||
wddm->kmDafLockResult.lockedAllocations.clear();
|
||||
csr->flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
EXPECT_EQ(0u, wddm->kmDafLockResult.called);
|
||||
|
@ -938,6 +952,12 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenI
|
|||
expectedHandles.push_back(static_cast<WddmAllocation *>(iohAlloc)->getDefaultHandle());
|
||||
expectedHandles.push_back(static_cast<WddmAllocation *>(sshAlloc)->getDefaultHandle());
|
||||
expectedHandles.push_back(static_cast<WddmAllocation *>(csrCommandStream)->getDefaultHandle());
|
||||
if (csr->getGlobalFenceAllocation()) {
|
||||
expectedHandles.push_back(static_cast<WddmAllocation *>(csr->getGlobalFenceAllocation())->getDefaultHandle());
|
||||
}
|
||||
if (csr->getKernelArgsBufferAllocation()) {
|
||||
expectedHandles.push_back(static_cast<WddmAllocation *>(csr->getKernelArgsBufferAllocation())->getDefaultHandle());
|
||||
}
|
||||
|
||||
for (auto i = 0u; i < wddm->makeResidentResult.handleCount; i++) {
|
||||
auto handle = wddm->makeResidentResult.handlePack[i];
|
||||
|
|
|
@ -325,6 +325,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmS
|
|||
|
||||
uint64_t expectedSizeInPages = static_cast<uint64_t>(mockResourceInfo->getSizeAllocation() / MemoryConstants::pageSize);
|
||||
EXPECT_EQ(expectedSizeInPages, getLastCallMapGpuVaArgFcn()->SizeInPages);
|
||||
wddm->destroyAllocation(&allocation, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, GivenInvalidCpuAddressWhenCheckingForGpuHangThenFalseIsReturned) {
|
||||
|
@ -406,8 +407,6 @@ TEST_F(Wddm20Tests, WhenMappingAndFreeingGpuVaThenReturnIsCorrect) {
|
|||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, 0, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmHelper()));
|
||||
|
||||
|
@ -422,8 +421,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
|||
|
||||
auto gmmHelper = rootDeviceEnvironment->getGmmHelper();
|
||||
EXPECT_EQ(allocation.getGpuAddress(), gmmHelper->canonize(allocation.getGpuAddress()));
|
||||
|
||||
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
||||
wddm->destroyAllocation(&allocation, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenCreateResourceFlagIsEnabled) {
|
||||
|
@ -436,6 +434,7 @@ TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenCreateResou
|
|||
auto passedCreateAllocation = getMockAllocationFcn();
|
||||
EXPECT_EQ(TRUE, passedCreateAllocation->Flags.CreateShared);
|
||||
EXPECT_EQ(TRUE, passedCreateAllocation->Flags.CreateResource);
|
||||
wddm->destroyAllocation(&allocation, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenSharedHandleAndResourceHandleAreSet) {
|
||||
|
@ -861,7 +860,7 @@ TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedTo
|
|||
wddm->destroyAllocation(&allocation, osContext.get());
|
||||
|
||||
EXPECT_EQ(wddm->getDeviceHandle(), gdi->getDestroyArg().hDevice);
|
||||
EXPECT_EQ(1u, gdi->getDestroyArg().AllocationCount);
|
||||
EXPECT_EQ(static_cast<uint32_t>(allocation.getHandles().size()), gdi->getDestroyArg().AllocationCount);
|
||||
EXPECT_NE(nullptr, gdi->getDestroyArg().phAllocationList);
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,8 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
|
|||
EXPECT_EQ(wddmWithKmDafMock->getDeviceHandle(), wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.hDevice);
|
||||
EXPECT_EQ(handle, wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.hAllocation);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.pfnEscape);
|
||||
|
||||
wddmWithKmDafMock->destroyAllocations(&handle, 1, 0);
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
|
@ -163,6 +165,8 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafLi
|
|||
EXPECT_EQ(wddmWithKmDafMock->getDeviceHandle(), wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.hDevice);
|
||||
EXPECT_EQ(handle, wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.hAllocation);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.pfnEscape);
|
||||
|
||||
wddmWithKmDafMock->destroyAllocations(&handle, 1, 0);
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
|
||||
|
@ -189,6 +193,8 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledT
|
|||
auto gmmHelper = rootDeviceEnvironment->gmmHelper.get();
|
||||
EXPECT_EQ(gmmHelper->decanonize(osHandle.gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.gpuVirtualAddress);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
|
||||
|
||||
wddmWithKmDafMock->destroyAllocations(&osHandle.handle, 1, 0);
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenKmDafLockIsCalledThenKmDafListenerNotifyLockIsFedWithCorrectParams) {
|
||||
|
|
|
@ -630,6 +630,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocateGraphicsMemoryWithPropertiesCal
|
|||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocateGraphicsMemoryIsCalledThenMemoryPoolIsSystem4KBPages) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForcePreferredAllocationMethod.set(static_cast<int32_t>(GfxMemoryAllocationMethod::UseUmdSystemPtr));
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, executionEnvironment));
|
||||
if (memoryManager->isLimitedGPU(0)) {
|
||||
GTEST_SKIP();
|
||||
|
@ -775,6 +777,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocate32BitGraphicsM
|
|||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesDisabledWhenAllocateGraphicsMemoryForSVMThen4KBGraphicsAllocationIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForcePreferredAllocationMethod.set(static_cast<int32_t>(GfxMemoryAllocationMethod::UseUmdSystemPtr));
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, executionEnvironment));
|
||||
if (memoryManager->isLimitedGPU(0)) {
|
||||
GTEST_SKIP();
|
||||
|
@ -1213,6 +1217,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationAndPreferredGpuVaI
|
|||
EXPECT_EQ(lastRequiredAddress, wddm->mapGpuVirtualAddressResult.uint64ParamPassed);
|
||||
EXPECT_GT(lastRequiredAddress, memoryManager->getGfxPartition(0)->getHeapMinimalAddress(HeapIndex::HEAP_SVM));
|
||||
EXPECT_LT(lastRequiredAddress, memoryManager->getGfxPartition(0)->getHeapLimit(HeapIndex::HEAP_SVM));
|
||||
|
||||
wddm->destroyAllocation(&allocation, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationWhenCreatePhysicalAllocationIsCalledThenAllocationSuccess) {
|
||||
|
@ -1230,6 +1236,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationWhenCreatePhysical
|
|||
memoryManager->createPhysicalAllocation(&allocation);
|
||||
EXPECT_EQ(0ull, allocation.getGpuAddress());
|
||||
EXPECT_EQ(0u, wddm->mapGpuVirtualAddressResult.called);
|
||||
wddm->destroyAllocation(&allocation, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationWhenCreatePhysicalAllocationIsCalledThenFailureReturned) {
|
||||
|
@ -2803,6 +2810,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
|
|||
allocation.setDefaultGmm(gmm.get());
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, allocation.getAlignedCpuPtr());
|
||||
EXPECT_TRUE(ret);
|
||||
wddm->destroyAllocation(&allocation, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAndMapGpuVaFailSecondAfterDrainFailThenFailToCreateAllocation) {
|
||||
|
|
|
@ -31,6 +31,7 @@ TEST_F(WddmTests, whenCreatingAllocation64kThenDoNotCreateResource) {
|
|||
EXPECT_TRUE(wddm->createAllocation(&gmm, handle));
|
||||
auto gdiParam = getMockAllocationFcn();
|
||||
EXPECT_EQ(FALSE, gdiParam->Flags.CreateResource);
|
||||
EXPECT_TRUE(wddm->destroyAllocations(&handle, 1, 0));
|
||||
}
|
||||
|
||||
TEST_F(WddmTests, whenInitializingWddmThenSetTimestampFrequencyToCorrectValue) {
|
||||
|
|
|
@ -6,8 +6,13 @@
|
|||
|
||||
if(WIN32)
|
||||
target_sources(neo_shared_tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager_tests_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}product_helper_tests_extra_dg2.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32 OR(UNIX AND NOT DISABLE_WDDM_LINUX))
|
||||
target_sources(neo_shared_tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager_tests_dg2.cpp
|
||||
)
|
||||
endif()
|
|
@ -9,6 +9,7 @@
|
|||
#include "shared/source/os_interface/product_helper.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "shared/source/xe_hpg_core/hw_cmds_dg2.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
#include "shared/test/common/mocks/windows/mock_gmm_memory_base.h"
|
||||
#include "shared/test/common/os_interface/windows/gdi_dll_fixture.h"
|
||||
|
@ -20,6 +21,8 @@ using namespace NEO;
|
|||
using Dg2WddmTest = ::testing::Test;
|
||||
|
||||
DG2TEST_F(Dg2WddmTest, givenG10A0WhenGettingLocalMemoryAccessModeThenCorrectValueIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForcePreferredAllocationMethod.set(static_cast<int32_t>(GfxMemoryAllocationMethod::UseUmdSystemPtr));
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[0].get();
|
||||
rootDeviceEnvironment->initGmm();
|
||||
|
|
Loading…
Reference in New Issue