diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.inl b/runtime/command_stream/aub_command_stream_receiver_hw.inl index 6526728cea..e7a46f24ba 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.inl +++ b/runtime/command_stream/aub_command_stream_receiver_hw.inl @@ -671,7 +671,7 @@ bool AUBCommandStreamReceiverHw::writeMemory(GraphicsAllocation &gfxA template bool AUBCommandStreamReceiverHw::writeMemory(AllocationView &allocationView) { - GraphicsAllocation gfxAllocation(reinterpret_cast(allocationView.first), allocationView.first, 0llu, allocationView.second, this->getMemoryManager()->getOsContextCount(), false); + GraphicsAllocation gfxAllocation(reinterpret_cast(allocationView.first), allocationView.first, 0llu, allocationView.second, false); return writeMemory(gfxAllocation); } diff --git a/runtime/memory_manager/graphics_allocation.cpp b/runtime/memory_manager/graphics_allocation.cpp index e04c81ab3a..ad4ec9814d 100644 --- a/runtime/memory_manager/graphics_allocation.cpp +++ b/runtime/memory_manager/graphics_allocation.cpp @@ -23,21 +23,21 @@ bool GraphicsAllocation::isL3Capable() { } return false; } -GraphicsAllocation::GraphicsAllocation(void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, uint32_t osContextCount, bool multiOsContextCapable) : gpuBaseAddress(baseAddress), - size(sizeIn), - cpuPtr(cpuPtrIn), - gpuAddress(gpuAddress), - multiOsContextCapable(multiOsContextCapable) { - usageInfos.resize(maxOsContextCount); -} +GraphicsAllocation::GraphicsAllocation(void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, + size_t sizeIn, bool multiOsContextCapable) + : gpuBaseAddress(baseAddress), + size(sizeIn), + cpuPtr(cpuPtrIn), + gpuAddress(gpuAddress), + multiOsContextCapable(multiOsContextCapable) {} + +GraphicsAllocation::GraphicsAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, bool multiOsContextCapable) + : size(sizeIn), + cpuPtr(cpuPtrIn), + gpuAddress(castToUint64(cpuPtrIn)), + sharedHandle(sharedHandleIn), + multiOsContextCapable(multiOsContextCapable) {} -GraphicsAllocation::GraphicsAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, uint32_t osContextCount, bool multiOsContextCapable) : size(sizeIn), - cpuPtr(cpuPtrIn), - gpuAddress(castToUint64(cpuPtrIn)), - sharedHandle(sharedHandleIn), - multiOsContextCapable(multiOsContextCapable) { - usageInfos.resize(maxOsContextCount); -} GraphicsAllocation::~GraphicsAllocation() = default; void GraphicsAllocation::updateTaskCount(uint32_t newTaskCount, uint32_t contextId) { diff --git a/runtime/memory_manager/graphics_allocation.h b/runtime/memory_manager/graphics_allocation.h index c2c9417367..0cfcbe7802 100644 --- a/runtime/memory_manager/graphics_allocation.h +++ b/runtime/memory_manager/graphics_allocation.h @@ -6,9 +6,6 @@ */ #pragma once -#include -#include -#include #include "runtime/helpers/debug_helpers.h" #include "runtime/helpers/ptr_math.h" @@ -19,6 +16,10 @@ #include "runtime/utilities/idlist.h" #include "runtime/utilities/stackvec.h" +#include +#include +#include + namespace OCLRT { using osHandle = unsigned int; @@ -79,9 +80,9 @@ class GraphicsAllocation : public IDNode { GraphicsAllocation &operator=(const GraphicsAllocation &) = delete; GraphicsAllocation(const GraphicsAllocation &) = delete; - GraphicsAllocation(void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, uint32_t osContextCount, bool multiOsContextCapable); + GraphicsAllocation(void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, bool multiOsContextCapable); - GraphicsAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, uint32_t osContextCount, bool multiOsContextCapable); + GraphicsAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, bool multiOsContextCapable); void *getUnderlyingBuffer() const { return cpuPtr; } void setCpuPtrAndGpuAddress(void *cpuPtr, uint64_t gpuAddress) { @@ -173,7 +174,7 @@ class GraphicsAllocation : public IDNode { bool aubWritable = true; bool allocDumpable = false; bool memObjectsAllocationWithWritableFlags = false; - std::vector usageInfos; + std::array usageInfos; std::atomic registeredContextsNum{0}; bool multiOsContextCapable = false; }; diff --git a/runtime/memory_manager/os_agnostic_memory_manager.cpp b/runtime/memory_manager/os_agnostic_memory_manager.cpp index 21670591af..460bcbe5fb 100644 --- a/runtime/memory_manager/os_agnostic_memory_manager.cpp +++ b/runtime/memory_manager/os_agnostic_memory_manager.cpp @@ -34,7 +34,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment if (fakeBigAllocations && allocationData.size > bigAllocation) { memoryAllocation = new MemoryAllocation(nullptr, (void *)dummyAddress, static_cast(dummyAddress), allocationData.size, counter, - MemoryPool::System4KBPages, this->getOsContextCount(), allocationData.flags.multiOsContextCapable); + MemoryPool::System4KBPages, allocationData.flags.multiOsContextCapable); counter++; memoryAllocation->uncacheable = allocationData.flags.uncacheable; return memoryAllocation; @@ -42,7 +42,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment auto ptr = allocateSystemMemory(sizeAligned, allocationData.alignment ? alignUp(allocationData.alignment, MemoryConstants::pageSize) : MemoryConstants::pageSize); if (ptr != nullptr) { memoryAllocation = new MemoryAllocation(ptr, ptr, reinterpret_cast(ptr), allocationData.size, counter, MemoryPool::System4KBPages, - this->getOsContextCount(), allocationData.flags.multiOsContextCapable); + allocationData.flags.multiOsContextCapable); if (!memoryAllocation) { alignedFreeWrapper(ptr); return nullptr; @@ -58,8 +58,8 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryForNonSvmHost auto alignedPtr = alignDown(reinterpret_cast(cpuPtr), MemoryConstants::pageSize); auto offsetInPage = reinterpret_cast(cpuPtr) - alignedPtr; - memoryAllocation = new MemoryAllocation(nullptr, cpuPtr, reinterpret_cast(alignedPtr), size, counter, MemoryPool::System4KBPages, - this->getOsContextCount(), false); + memoryAllocation = new MemoryAllocation(nullptr, cpuPtr, reinterpret_cast(alignedPtr), size, counter, + MemoryPool::System4KBPages, false); memoryAllocation->allocationOffset = offsetInPage; memoryAllocation->uncacheable = false; @@ -87,7 +87,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con } uint64_t offset = static_cast(reinterpret_cast(allocationData.hostPtr) & MemoryConstants::pageMask); MemoryAllocation *memAlloc = new MemoryAllocation(nullptr, const_cast(allocationData.hostPtr), GmmHelper::canonize(gpuVirtualAddress + offset), allocationData.size, - counter, MemoryPool::System4KBPagesWith32BitGpuAddressing, this->getOsContextCount(), false); + counter, MemoryPool::System4KBPagesWith32BitGpuAddressing, false); memAlloc->is32BitAllocation = true; memAlloc->gpuBaseAddress = GmmHelper::canonize(allocator32Bit->getBase()); memAlloc->sizeToFree = allocationSize; @@ -107,7 +107,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con MemoryAllocation *memoryAllocation = nullptr; if (ptrAlloc != nullptr) { memoryAllocation = new MemoryAllocation(ptrAlloc, ptrAlloc, GmmHelper::canonize(gpuAddress), allocationData.size, counter, - MemoryPool::System4KBPagesWith32BitGpuAddressing, this->getOsContextCount(), false); + MemoryPool::System4KBPagesWith32BitGpuAddressing, false); memoryAllocation->is32BitAllocation = true; memoryAllocation->gpuBaseAddress = GmmHelper::canonize(allocator32Bit->getBase()); memoryAllocation->sizeToFree = allocationSize; @@ -118,7 +118,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con GraphicsAllocation *OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(osHandle handle, bool requireSpecificBitness) { auto graphicsAllocation = new MemoryAllocation(nullptr, reinterpret_cast(1), 1, 4096u, static_cast(handle), - MemoryPool::SystemCpuInaccessible, this->getOsContextCount(), false); + MemoryPool::SystemCpuInaccessible, false); graphicsAllocation->setSharedHandle(handle); graphicsAllocation->is32BitAllocation = requireSpecificBitness; return graphicsAllocation; @@ -184,7 +184,7 @@ uint64_t OsAgnosticMemoryManager::getInternalHeapBaseAddress() { GraphicsAllocation *OsAgnosticMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, size_t hostPtrSize, const void *hostPtr) { auto allocation = new MemoryAllocation(nullptr, const_cast(hostPtr), reinterpret_cast(hostPtr), - hostPtrSize, counter++, MemoryPool::System4KBPages, this->getOsContextCount(), false); + hostPtrSize, counter++, MemoryPool::System4KBPages, false); allocation->fragmentsStorage = handleStorage; return allocation; } @@ -229,7 +229,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryForImageImpl( auto ptr = allocateSystemMemory(alignUp(allocationData.imgInfo->size, MemoryConstants::pageSize), MemoryConstants::pageSize); if (ptr != nullptr) { alloc = new MemoryAllocation(ptr, ptr, reinterpret_cast(ptr), allocationData.imgInfo->size, counter, - MemoryPool::SystemCpuInaccessible, this->getOsContextCount(), false); + MemoryPool::SystemCpuInaccessible, false); counter++; } diff --git a/runtime/memory_manager/os_agnostic_memory_manager.h b/runtime/memory_manager/os_agnostic_memory_manager.h index a9f9277c8c..1d77c94923 100644 --- a/runtime/memory_manager/os_agnostic_memory_manager.h +++ b/runtime/memory_manager/os_agnostic_memory_manager.h @@ -21,8 +21,9 @@ class MemoryAllocation : public GraphicsAllocation { void setSharedHandle(osHandle handle) { this->sharedHandle = handle; } - MemoryAllocation(void *driverAllocatedCpuPointer, void *pMem, uint64_t gpuAddress, size_t memSize, uint64_t count, MemoryPool::Type pool, uint32_t osContextCount, bool multiOsContextCapable) : GraphicsAllocation(pMem, gpuAddress, 0u, memSize, osContextCount, multiOsContextCapable), - id(count) { + MemoryAllocation(void *driverAllocatedCpuPointer, void *pMem, uint64_t gpuAddress, size_t memSize, uint64_t count, MemoryPool::Type pool, bool multiOsContextCapable) + : GraphicsAllocation(pMem, gpuAddress, 0u, memSize, multiOsContextCapable), id(count) { + this->driverAllocatedCpuPointer = driverAllocatedCpuPointer; overrideMemoryPool(pool); } diff --git a/runtime/os_interface/linux/drm_allocation.h b/runtime/os_interface/linux/drm_allocation.h index d74e00409d..f4d11a4480 100644 --- a/runtime/os_interface/linux/drm_allocation.h +++ b/runtime/os_interface/linux/drm_allocation.h @@ -17,13 +17,13 @@ struct OsHandle { class DrmAllocation : public GraphicsAllocation { public: - DrmAllocation(BufferObject *bo, void *ptrIn, size_t sizeIn, MemoryPool::Type pool, uint32_t osContextsCount, bool multiOsContextCapable) : GraphicsAllocation(ptrIn, castToUint64(ptrIn), 0llu, sizeIn, osContextsCount, multiOsContextCapable), bo(bo) { + DrmAllocation(BufferObject *bo, void *ptrIn, size_t sizeIn, MemoryPool::Type pool, bool multiOsContextCapable) : GraphicsAllocation(ptrIn, castToUint64(ptrIn), 0llu, sizeIn, multiOsContextCapable), bo(bo) { this->memoryPool = pool; } - DrmAllocation(BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, uint32_t osContextsCount, bool multiOsContextCapable) : GraphicsAllocation(ptrIn, sizeIn, sharedHandle, osContextsCount, multiOsContextCapable), bo(bo) { + DrmAllocation(BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, bool multiOsContextCapable) : GraphicsAllocation(ptrIn, sizeIn, sharedHandle, multiOsContextCapable), bo(bo) { this->memoryPool = pool; } - DrmAllocation(BufferObject *bo, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool, uint32_t osContextsCount, bool multiOsContextCapable) : GraphicsAllocation(ptrIn, gpuAddress, 0, sizeIn, osContextsCount, multiOsContextCapable), bo(bo) { + DrmAllocation(BufferObject *bo, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool, bool multiOsContextCapable) : GraphicsAllocation(ptrIn, gpuAddress, 0, sizeIn, multiOsContextCapable), bo(bo) { this->memoryPool = pool; } diff --git a/runtime/os_interface/linux/drm_memory_manager.cpp b/runtime/os_interface/linux/drm_memory_manager.cpp index cde443fd05..c6925d146c 100644 --- a/runtime/os_interface/linux/drm_memory_manager.cpp +++ b/runtime/os_interface/linux/drm_memory_manager.cpp @@ -204,7 +204,7 @@ OCLRT::BufferObject *DrmMemoryManager::allocUserptr(uintptr_t address, size_t si } DrmAllocation *DrmMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, size_t hostPtrSize, const void *hostPtr) { - auto allocation = new DrmAllocation(nullptr, const_cast(hostPtr), hostPtrSize, MemoryPool::System4KBPages, getOsContextCount(), false); + auto allocation = new DrmAllocation(nullptr, const_cast(hostPtr), hostPtrSize, MemoryPool::System4KBPages, false); allocation->fragmentsStorage = handleStorage; return allocation; } @@ -232,7 +232,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryWithAlignment(const Alloc if (forcePinEnabled && pinBB != nullptr && allocationData.flags.forcePin && allocationData.size >= this->pinThreshold) { pinBB->pin(&bo, 1, getDefaultCommandStreamReceiver(0)->getOsContext().get()->getDrmContextId()); } - return new DrmAllocation(bo, res, cSize, MemoryPool::System4KBPages, getOsContextCount(), allocationData.flags.multiOsContextCapable); + return new DrmAllocation(bo, res, cSize, MemoryPool::System4KBPages, allocationData.flags.multiOsContextCapable); } DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryWithHostPtr(const AllocationData &allocationData) { @@ -273,7 +273,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(size_t s bo->softPin((uint64_t)offset); bo->setAllocationType(allocType); - auto allocation = new DrmAllocation(bo, cpuPtr, reinterpret_cast(alignedPtr), size, MemoryPool::System4KBPages, getOsContextCount(), false); + auto allocation = new DrmAllocation(bo, cpuPtr, reinterpret_cast(alignedPtr), size, MemoryPool::System4KBPages, false); allocation->allocationOffset = offsetInPage; allocation->gpuBaseAddress = limitedGpuAddressRangeAllocator->getBase(); @@ -318,7 +318,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImageImpl(const A bo->setUnmapSize(allocationData.imgInfo->size); - auto allocation = new DrmAllocation(bo, nullptr, (uint64_t)gpuRange, allocationData.imgInfo->size, MemoryPool::SystemCpuInaccessible, getOsContextCount(), false); + auto allocation = new DrmAllocation(bo, nullptr, (uint64_t)gpuRange, allocationData.imgInfo->size, MemoryPool::SystemCpuInaccessible, false); bo->setAllocationType(allocatorType); allocation->gmm = gmm.release(); return allocation; @@ -352,7 +352,7 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio bo->softPin((uint64_t)offset); bo->setAllocationType(allocatorType); auto drmAllocation = new DrmAllocation(bo, const_cast(allocationData.hostPtr), static_cast(ptrOffset(gpuVirtualAddress, inputPointerOffset)), - allocationSize, MemoryPool::System4KBPagesWith32BitGpuAddressing, getOsContextCount(), false); + allocationSize, MemoryPool::System4KBPagesWith32BitGpuAddressing, false); drmAllocation->is32BitAllocation = true; drmAllocation->gpuBaseAddress = allocatorToUse->getBase(); return drmAllocation; @@ -397,10 +397,10 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio DrmAllocation *drmAllocation = nullptr; if (limitedRangeAllocation) { drmAllocation = new DrmAllocation(bo, ptrAlloc, res, alignedAllocationSize, - MemoryPool::System4KBPagesWith32BitGpuAddressing, getOsContextCount(), false); + MemoryPool::System4KBPagesWith32BitGpuAddressing, false); } else { drmAllocation = new DrmAllocation(bo, reinterpret_cast(res), alignedAllocationSize, - MemoryPool::System4KBPagesWith32BitGpuAddressing, getOsContextCount(), false); + MemoryPool::System4KBPagesWith32BitGpuAddressing, false); } drmAllocation->is32BitAllocation = true; @@ -474,7 +474,7 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o lock.unlock(); - auto drmAllocation = new DrmAllocation(bo, bo->address, bo->size, handle, MemoryPool::SystemCpuInaccessible, getOsContextCount(), false); + auto drmAllocation = new DrmAllocation(bo, bo->address, bo->size, handle, MemoryPool::SystemCpuInaccessible, false); if (requireSpecificBitness && this->force32bitAllocations) { drmAllocation->is32BitAllocation = true; @@ -506,7 +506,7 @@ GraphicsAllocation *DrmMemoryManager::createPaddedAllocation(GraphicsAllocation bo->setUnmapSize(sizeWithPadding); bo->setAllocationType(storageType); return new DrmAllocation(bo, (void *)srcPtr, (uint64_t)ptrOffset(gpuRange, offset), sizeWithPadding, - inputGraphicsAllocation->getMemoryPool(), getOsContextCount(), false); + inputGraphicsAllocation->getMemoryPool(), false); } void DrmMemoryManager::addAllocationToHostPtrManager(GraphicsAllocation *gfxAllocation) { diff --git a/runtime/os_interface/windows/wddm_allocation.h b/runtime/os_interface/windows/wddm_allocation.h index 90234bd4e5..d252530d51 100644 --- a/runtime/os_interface/windows/wddm_allocation.h +++ b/runtime/os_interface/windows/wddm_allocation.h @@ -31,8 +31,8 @@ class WddmAllocation : public GraphicsAllocation { D3DKMT_HANDLE resourceHandle = 0u; // used by shared resources D3DGPU_VIRTUAL_ADDRESS gpuPtr; // set by mapGpuVA - WddmAllocation(void *cpuPtrIn, size_t sizeIn, void *reservedAddr, MemoryPool::Type pool, size_t osContextsCount, bool multiOsContextCapable) - : GraphicsAllocation(cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, static_cast(osContextsCount), multiOsContextCapable), + WddmAllocation(void *cpuPtrIn, size_t sizeIn, void *reservedAddr, MemoryPool::Type pool, bool multiOsContextCapable) + : GraphicsAllocation(cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, multiOsContextCapable), handle(0), gpuPtr(0), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) { @@ -40,11 +40,11 @@ class WddmAllocation : public GraphicsAllocation { this->memoryPool = pool; } - WddmAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, size_t osContextsCount, bool multiOsContextCapable) - : GraphicsAllocation(cpuPtrIn, sizeIn, sharedHandle, static_cast(osContextsCount), multiOsContextCapable), + WddmAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, bool multiOsContextCapable) + : GraphicsAllocation(cpuPtrIn, sizeIn, sharedHandle, multiOsContextCapable), handle(0), gpuPtr(0), - trimCandidateListPositions(osContextsCount, trimListUnusedPosition) { + trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) { reservedAddressSpace = nullptr; this->memoryPool = pool; } diff --git a/runtime/os_interface/windows/wddm_memory_manager.cpp b/runtime/os_interface/windows/wddm_memory_manager.cpp index cf1c36a9a0..9e331c06e7 100644 --- a/runtime/os_interface/windows/wddm_memory_manager.cpp +++ b/runtime/os_interface/windows/wddm_memory_manager.cpp @@ -45,7 +45,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImageImpl(const return allocateGraphicsMemoryWithAlignment(allocationData); } - auto allocation = std::make_unique(nullptr, allocationData.imgInfo->size, nullptr, MemoryPool::SystemCpuInaccessible, getOsContextCount(), false); + auto allocation = std::make_unique(nullptr, allocationData.imgInfo->size, nullptr, MemoryPool::SystemCpuInaccessible, false); allocation->gmm = gmm.get(); if (!WddmMemoryManager::createWddmAllocation(allocation.get(), AllocationOrigin::EXTERNAL_ALLOCATION)) { @@ -62,7 +62,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(AllocationData size_t sizeAligned = alignUp(allocationData.size, MemoryConstants::pageSize64k); Gmm *gmm = nullptr; - auto wddmAllocation = std::make_unique(nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages, getOsContextCount(), !!allocationData.flags.multiOsContextCapable); + auto wddmAllocation = std::make_unique(nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages, !!allocationData.flags.multiOsContextCapable); gmm = new Gmm(nullptr, sizeAligned, false, allocationData.flags.preferRenderCompressed, true, 0); wddmAllocation->gmm = gmm; @@ -93,7 +93,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithAlignment(const return nullptr; } - auto wddmAllocation = std::make_unique(pSysMem, sizeAligned, nullptr, MemoryPool::System4KBPages, getOsContextCount(), allocationData.flags.multiOsContextCapable); + auto wddmAllocation = std::make_unique(pSysMem, sizeAligned, nullptr, MemoryPool::System4KBPages, allocationData.flags.multiOsContextCapable); wddmAllocation->driverAllocatedCpuPointer = pSysMem; gmm = new Gmm(pSysMem, sizeAligned, allocationData.flags.uncacheable); @@ -115,7 +115,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(si auto offsetInPage = ptrDiff(cpuPtr, alignedPtr); auto alignedSize = alignSizeWholePage(cpuPtr, size); - auto wddmAllocation = std::make_unique(cpuPtr, size, nullptr, MemoryPool::System4KBPages, getOsContextCount(), false); + auto wddmAllocation = std::make_unique(cpuPtr, size, nullptr, MemoryPool::System4KBPages, false); wddmAllocation->allocationOffset = offsetInPage; auto gmm = new Gmm(alignedPtr, alignedSize, false); @@ -149,7 +149,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory(const AllocationPr return nullptr; } - auto allocation = new WddmAllocation(ptr, properties.size, reserve, MemoryPool::System4KBPages, getOsContextCount(), false); + auto allocation = new WddmAllocation(ptr, properties.size, reserve, MemoryPool::System4KBPages, false); allocation->allocationOffset = offset; Gmm *gmm = new Gmm(ptrAligned, sizeAligned, false); @@ -188,7 +188,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All } auto wddmAllocation = std::make_unique(const_cast(ptrAligned), sizeAligned, nullptr, - MemoryPool::System4KBPagesWith32BitGpuAddressing, getOsContextCount(), false); + MemoryPool::System4KBPagesWith32BitGpuAddressing, false); wddmAllocation->driverAllocatedCpuPointer = pSysMem; wddmAllocation->is32BitAllocation = true; wddmAllocation->allocationOffset = offset; @@ -211,7 +211,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All } GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handle, bool requireSpecificBitness, bool ntHandle) { - auto allocation = std::make_unique(nullptr, 0, handle, MemoryPool::SystemCpuInaccessible, getOsContextCount(), false); + auto allocation = std::make_unique(nullptr, 0, handle, MemoryPool::SystemCpuInaccessible, false); bool status = ntHandle ? wddm->openNTHandle((HANDLE)((UINT_PTR)handle), allocation.get()) : wddm->openSharedHandle(handle, allocation.get()); @@ -435,7 +435,7 @@ void WddmMemoryManager::obtainGpuAddressFromFragments(WddmAllocation *allocation } GraphicsAllocation *WddmMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, size_t hostPtrSize, const void *hostPtr) { - auto allocation = new WddmAllocation(const_cast(hostPtr), hostPtrSize, nullptr, MemoryPool::System4KBPages, getOsContextCount(), false); + auto allocation = new WddmAllocation(const_cast(hostPtr), hostPtrSize, nullptr, MemoryPool::System4KBPages, false); allocation->fragmentsStorage = handleStorage; obtainGpuAddressFromFragments(allocation, handleStorage); return allocation; diff --git a/unit_tests/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp index 47b3e65314..5f9a3d2c7a 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2018 Intel Corporation + * Copyright (C) 2017-2019 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -114,7 +114,7 @@ HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) { cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f}; cl_float dstMemory[] = {0.0f, 0.0f, 0.0f, 0.0f}; - GraphicsAllocation *srcAlocation = new GraphicsAllocation(srcMemory, 0xFFFF800400001000, 0xFFFF800400001000, sizeof(srcMemory), 1u, false); + GraphicsAllocation *srcAlocation = new GraphicsAllocation(srcMemory, 0xFFFF800400001000, 0xFFFF800400001000, sizeof(srcMemory), false); std::unique_ptr srcBuffer(Buffer::createBufferHw(&context, CL_MEM_USE_HOST_PTR, diff --git a/unit_tests/command_stream/command_stream_receiver_tests.cpp b/unit_tests/command_stream/command_stream_receiver_tests.cpp index ea78a95d19..a7db7fdaa5 100644 --- a/unit_tests/command_stream/command_stream_receiver_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_tests.cpp @@ -327,7 +327,7 @@ TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenItIsDestroye bool destructorCalled = false; - auto mockGraphicsAllocation = new MockGraphicsAllocationWithDestructorTracing(nullptr, 0llu, 0llu, 1u, 1u, false); + auto mockGraphicsAllocation = new MockGraphicsAllocationWithDestructorTracing(nullptr, 0llu, 0llu, 1u, false); mockGraphicsAllocation->destructorCalled = &destructorCalled; ExecutionEnvironment executionEnvironment; executionEnvironment.commandStreamReceivers.resize(1); diff --git a/unit_tests/helpers/hw_helper_tests.cpp b/unit_tests/helpers/hw_helper_tests.cpp index 3492fe29fd..afb9bd5cd8 100644 --- a/unit_tests/helpers/hw_helper_tests.cpp +++ b/unit_tests/helpers/hw_helper_tests.cpp @@ -345,7 +345,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenU uint64_t gpuAddr = 0x4000u; size_t allocSize = size; length.Length = static_cast(allocSize - 1); - GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, 0, false); + GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, false); allocation.gmm = new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false); ASSERT_NE(nullptr, allocation.gmm); SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; @@ -383,7 +383,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres void *cpuAddr = reinterpret_cast(0x4000); uint64_t gpuAddr = 0x4000u; size_t allocSize = size; - GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, 0, false); + GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, false); allocation.gmm = new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false); ASSERT_NE(nullptr, allocation.gmm); allocation.gmm->isRenderCompressed = true; @@ -417,7 +417,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmCompressionEnabledAn void *cpuAddr = reinterpret_cast(0x4000); uint64_t gpuAddr = 0x4000u; size_t allocSize = size; - GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, 0, false); + GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, false); allocation.gmm = new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false); ASSERT_NE(nullptr, allocation.gmm); allocation.gmm->isRenderCompressed = true; @@ -450,7 +450,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmCompressionDisabledA void *cpuAddr = reinterpret_cast(0x4000); uint64_t gpuAddr = 0x4000u; size_t allocSize = size; - GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, 0, false); + GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, false); allocation.gmm = new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false); ASSERT_NE(nullptr, allocation.gmm); allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); @@ -483,7 +483,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres void *cpuAddr = reinterpret_cast(0x4000); uint64_t gpuAddr = 0x4000u; size_t allocSize = size; - GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, 0, false); + GraphicsAllocation allocation(cpuAddr, gpuAddr, 0u, allocSize, false); allocation.gmm = new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false); ASSERT_NE(nullptr, allocation.gmm); allocation.gmm->isRenderCompressed = true; diff --git a/unit_tests/helpers/kernel_commands_tests.cpp b/unit_tests/helpers/kernel_commands_tests.cpp index 01ea75c880..66b268f210 100644 --- a/unit_tests/helpers/kernel_commands_tests.cpp +++ b/unit_tests/helpers/kernel_commands_tests.cpp @@ -676,12 +676,12 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelCommandsTest, usedBindingTableStatePointersFor // setup global memory char globalBuffer[16]; - GraphicsAllocation gfxGlobalAlloc(globalBuffer, castToUint64(globalBuffer), 0llu, sizeof(globalBuffer), 1u, false); + GraphicsAllocation gfxGlobalAlloc(globalBuffer, castToUint64(globalBuffer), 0llu, sizeof(globalBuffer), false); program.setGlobalSurface(&gfxGlobalAlloc); // setup constant memory char constBuffer[16]; - GraphicsAllocation gfxConstAlloc(constBuffer, castToUint64(constBuffer), 0llu, sizeof(constBuffer), 1u, false); + GraphicsAllocation gfxConstAlloc(constBuffer, castToUint64(constBuffer), 0llu, sizeof(constBuffer), false); program.setConstantSurface(&gfxConstAlloc); // create kernel diff --git a/unit_tests/kernel/kernel_tests.cpp b/unit_tests/kernel/kernel_tests.cpp index 715814b8c3..1325e6f994 100644 --- a/unit_tests/kernel/kernel_tests.cpp +++ b/unit_tests/kernel/kernel_tests.cpp @@ -945,7 +945,7 @@ TEST_F(KernelGlobalSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenGlobalS char buffer[16]; - GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8, 1u, false); + GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8, false); uint64_t bufferAddress = gfxAlloc.getGpuAddress(); // create kernel @@ -1119,7 +1119,7 @@ TEST_F(KernelConstantSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenConst char buffer[16]; - GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8, 1u, false); + GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8, false); uint64_t bufferAddress = gfxAlloc.getGpuAddress(); // create kernel diff --git a/unit_tests/libult/ult_command_stream_receiver.h b/unit_tests/libult/ult_command_stream_receiver.h index 907f54bf82..0b386b2319 100644 --- a/unit_tests/libult/ult_command_stream_receiver.h +++ b/unit_tests/libult/ult_command_stream_receiver.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2018 Intel Corporation + * Copyright (C) 2017-2019 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -70,7 +70,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw, publ UltCommandStreamReceiver(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment) : BaseClass(hwInfoIn, executionEnvironment) { if (hwInfoIn.capabilityTable.defaultPreemptionMode == PreemptionMode::MidThread) { - tempPreemptionLocation = std::make_unique(nullptr, 0, 0, 0, 1u, false); + tempPreemptionLocation = std::make_unique(nullptr, 0, 0, 0, false); this->preemptionCsrAllocation = tempPreemptionLocation.get(); } } diff --git a/unit_tests/memory_manager/graphics_allocation_tests.cpp b/unit_tests/memory_manager/graphics_allocation_tests.cpp index c80169e65e..7fdd428019 100644 --- a/unit_tests/memory_manager/graphics_allocation_tests.cpp +++ b/unit_tests/memory_manager/graphics_allocation_tests.cpp @@ -18,8 +18,8 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenIsCreatedThenAllInspecti } TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenIsCreatedThenTaskCountsAreInitializedProperly) { - GraphicsAllocation graphicsAllocation1(nullptr, 0u, 0u, 0u, maxOsContextCount, true); - GraphicsAllocation graphicsAllocation2(nullptr, 0u, 0u, maxOsContextCount, true); + GraphicsAllocation graphicsAllocation1(nullptr, 0u, 0u, 0u, true); + GraphicsAllocation graphicsAllocation2(nullptr, 0u, 0u, true); for (auto i = 0u; i < maxOsContextCount; i++) { EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation1.getTaskCount(i)); EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation2.getTaskCount(i)); diff --git a/unit_tests/memory_manager/memory_manager_tests.cpp b/unit_tests/memory_manager/memory_manager_tests.cpp index 363cd7956a..27098529d8 100644 --- a/unit_tests/memory_manager/memory_manager_tests.cpp +++ b/unit_tests/memory_manager/memory_manager_tests.cpp @@ -73,7 +73,7 @@ TEST(GraphicsAllocationTest, Ctor2) { void *cpuPtr = (void *)0x30000; size_t size = 0x1000; osHandle sharedHandle = Sharing::nonSharedResource; - GraphicsAllocation gfxAllocation(cpuPtr, size, sharedHandle, 1u, false); + GraphicsAllocation gfxAllocation(cpuPtr, size, sharedHandle, false); uint64_t expectedGpuAddr = static_cast(reinterpret_cast(gfxAllocation.getUnderlyingBuffer())); EXPECT_EQ(expectedGpuAddr, gfxAllocation.getGpuAddress()); @@ -87,7 +87,7 @@ TEST(GraphicsAllocationTest, getGpuAddress) { uint64_t gpuBaseAddr = 0x10000; size_t size = 0x1000; - GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, 1u, false); + GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, false); EXPECT_EQ(gpuAddr, gfxAllocation.getGpuAddress()); @@ -104,7 +104,7 @@ TEST(GraphicsAllocationTest, getGpuAddressToPatch) { uint64_t gpuBaseAddr = 0x10000; size_t size = 0x1000; - GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, 1u, false); + GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, false); EXPECT_EQ(gpuAddr - gpuBaseAddr, gfxAllocation.getGpuAddressToPatch()); } @@ -115,7 +115,7 @@ TEST(GraphicsAllocationTest, setSize) { uint64_t gpuBaseAddr = 0x10000; size_t size = 0x2000; - GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, 1u, false); + GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, false); EXPECT_EQ(size, gfxAllocation.getUnderlyingBufferSize()); size = 0x3000; @@ -1515,7 +1515,7 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation void *addressWithTrailingBitSet = reinterpret_cast(address); uint64_t expectedGpuAddress = 0xf0000000; osHandle sharedHandle{}; - GraphicsAllocation graphicsAllocation(addressWithTrailingBitSet, 1u, sharedHandle, 1u, false); + GraphicsAllocation graphicsAllocation(addressWithTrailingBitSet, 1u, sharedHandle, false); EXPECT_EQ(expectedGpuAddress, graphicsAllocation.getGpuAddress()); } diff --git a/unit_tests/mocks/mock_graphics_allocation.h b/unit_tests/mocks/mock_graphics_allocation.h index a8fdf3fc35..69a93a892a 100644 --- a/unit_tests/mocks/mock_graphics_allocation.h +++ b/unit_tests/mocks/mock_graphics_allocation.h @@ -17,8 +17,8 @@ class MockGraphicsAllocation : public GraphicsAllocation { using GraphicsAllocation::usageInfos; MockGraphicsAllocation() : MockGraphicsAllocation(true) {} - MockGraphicsAllocation(bool multiOsContextCapable) : GraphicsAllocation(nullptr, 0u, 0, maxOsContextCount, multiOsContextCapable) {} - MockGraphicsAllocation(void *buffer, size_t sizeIn) : GraphicsAllocation(buffer, castToUint64(buffer), 0llu, sizeIn, maxOsContextCount, false) { + MockGraphicsAllocation(bool multiOsContextCapable) : GraphicsAllocation(nullptr, 0u, 0, multiOsContextCapable) {} + MockGraphicsAllocation(void *buffer, size_t sizeIn) : GraphicsAllocation(buffer, castToUint64(buffer), 0llu, sizeIn, false) { } void resetInspectionIds() { diff --git a/unit_tests/os_interface/windows/mock_wddm_allocation.h b/unit_tests/os_interface/windows/mock_wddm_allocation.h index 34301444fd..d218b17515 100644 --- a/unit_tests/os_interface/windows/mock_wddm_allocation.h +++ b/unit_tests/os_interface/windows/mock_wddm_allocation.h @@ -12,7 +12,7 @@ namespace OCLRT { class MockWddmAllocation : public WddmAllocation { public: - MockWddmAllocation() : WddmAllocation(nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false) { + MockWddmAllocation() : WddmAllocation(nullptr, 0, nullptr, MemoryPool::MemoryNull, false) { } void setMemoryPool(MemoryPool::Type pool) { diff --git a/unit_tests/os_interface/windows/wddm20_tests.cpp b/unit_tests/os_interface/windows/wddm20_tests.cpp index d7d4cec21e..e5d1ba8559 100644 --- a/unit_tests/os_interface/windows/wddm20_tests.cpp +++ b/unit_tests/os_interface/windows/wddm20_tests.cpp @@ -78,7 +78,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp mockGmmRes->setUnifiedAuxTranslationCapable(); void *fakePtr = reinterpret_cast(0x100); - WddmAllocation allocation(fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); allocation.handle = ALLOCATION_HANDLE; @@ -172,7 +172,7 @@ TEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) { TEST_F(Wddm20Tests, allocation) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -196,7 +196,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz size_t underlyingPages = underlyingSize / MemoryConstants::pageSize; size_t alignedPages = alignedSize / MemoryConstants::pageSize; - WddmAllocation allocation(ptr, 0x2100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(ptr, 0x2100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize()); allocation.gmm = gmm; @@ -219,7 +219,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) { void *fakePtr = reinterpret_cast(0x123); - WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, false); std::unique_ptr gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize())); allocation.gmm = gmm.get(); @@ -243,7 +243,7 @@ TEST_F(Wddm20Tests, createAllocation32bit) { void *alignedPtr = (void *)0x12000; size_t alignedSize = 0x2000; - WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -271,7 +271,7 @@ TEST_F(Wddm20Tests, createAllocation32bit) { TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap0ThenItHasGpuAddressWithingHeapInternalLimits) { void *alignedPtr = (void *)0x12000; size_t alignedSize = 0x2000; - WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, false); allocation.handle = ALLOCATION_HANDLE; allocation.gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); @@ -322,7 +322,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati TEST_F(Wddm20Tests, mapAndFreeGpuVa) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -348,7 +348,7 @@ TEST_F(Wddm20Tests, mapAndFreeGpuVa) { TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(nullptr, 100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(nullptr, 100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -367,7 +367,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) { TEST_F(Wddm20Tests, makeResidentNonResident) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -579,7 +579,7 @@ TEST(DebugFlagTest, givenDebugManagerWhenGetForUseNoRingFlushesKmdModeIsCalledTh TEST_F(Wddm20Tests, makeResidentMultipleHandles) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); allocation.handle = ALLOCATION_HANDLE; D3DKMT_HANDLE handles[2] = {0}; @@ -601,7 +601,7 @@ TEST_F(Wddm20Tests, makeResidentMultipleHandles) { TEST_F(Wddm20Tests, makeResidentMultipleHandlesWithReturnBytesToTrim) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); allocation.handle = ALLOCATION_HANDLE; D3DKMT_HANDLE handles[2] = {0}; @@ -641,7 +641,7 @@ TEST_F(Wddm20Tests, makeNonResidentCallsEvict) { } TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedToDestroyAllocation) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.getResidencyData().updateCompletionData(10, osContext.get()->getContextId()); allocation.handle = ALLOCATION_HANDLE; @@ -667,7 +667,7 @@ TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedTo } TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.getResidencyData().updateCompletionData(10, osContext.get()->getContextId()); allocation.handle = ALLOCATION_HANDLE; @@ -690,7 +690,7 @@ TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalle } TEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.getResidencyData().updateCompletionData(10, osContext.get()->getContextId()); allocation.handle = ALLOCATION_HANDLE; @@ -748,7 +748,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) { void *fakePtr = reinterpret_cast(0x123); auto gmm = std::make_unique(fakePtr, 100, false); - WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); EXPECT_FALSE(wddm->createAllocation64k(&allocation)); @@ -822,7 +822,7 @@ TEST_F(Wddm20Tests, givenNullTrimCallbackHandleWhenUnregisteringTrimCallbackThen } TEST_F(Wddm20Tests, givenAllocationThatDoesntNeedMakeResidentBeforeLockWhenLockThenDontStoreItOrCallMakeResident) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; EXPECT_FALSE(allocation.needsMakeResidentBeforeLock); EXPECT_TRUE(wddm->temporaryResources.empty()); EXPECT_EQ(0u, wddm->makeResidentResult.called); @@ -832,25 +832,25 @@ TEST_F(Wddm20Tests, givenAllocationThatDoesntNeedMakeResidentBeforeLockWhenLockT wddm->unlockResource(allocation); } TEST_F(Wddm20Tests, givenAllocationThatNeedsMakeResidentBeforeLockWhenLockThenCallBlockingMakeResident) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.needsMakeResidentBeforeLock = true; wddm->lockResource(allocation); EXPECT_EQ(1u, wddm->applyBlockingMakeResidentResult.called); } TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenAcquireUniqueLock) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->applyBlockingMakeResident(allocation); EXPECT_EQ(1u, wddm->acquireLockResult.called); EXPECT_EQ(reinterpret_cast(&wddm->temporaryResourcesLock), wddm->acquireLockResult.uint64ParamPassed); } TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenCallMakeResidentAndStoreAllocation) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->applyBlockingMakeResident(allocation); EXPECT_EQ(1u, wddm->makeResidentResult.called); EXPECT_EQ(allocation.handle, wddm->temporaryResources.back()); } TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenWaitForCurrentPagingFenceValue) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->mockPagingFence = 0u; wddm->currentPagingFenceValue = 3u; wddm->applyBlockingMakeResident(allocation); @@ -859,14 +859,14 @@ TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenWaitForCurre EXPECT_EQ(3u, wddm->getPagingFenceAddressResult.called); } TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentAndMakeResidentCallFailsThenEvictTemporaryResourcesAndRetry) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(2).WillRepeatedly(::testing::Return(false)); gmockWddm.applyBlockingMakeResident(allocation); EXPECT_EQ(1u, gmockWddm.evictAllTemporaryResourcesResult.called); } TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvictedSuccessfullyThenCallMakeResidentOneMoreTime) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(allocation.handle); EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true)); @@ -875,7 +875,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvicted EXPECT_EQ(2u, gmockWddm.evictAllTemporaryResourcesResult.called); } TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDontStoreTemporaryResource) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x2; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(0x1); @@ -886,7 +886,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDo EXPECT_EQ(0u, gmockWddm.temporaryResources.size()); } TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvictThenStoreTemporaryResource) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x2; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(0x1); @@ -898,7 +898,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvict EXPECT_EQ(0x2, gmockWddm.temporaryResources.back()); } TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentPassesThenStoreTemporaryResource) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x2; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(0x1); @@ -917,7 +917,7 @@ TEST_F(Wddm20Tests, whenEvictingAllTemporaryResourcesThenAcquireTemporaryResourc EXPECT_EQ(reinterpret_cast(&wddm->temporaryResourcesLock), wddm->acquireLockResult.uint64ParamPassed); } TEST_F(Wddm20Tests, whenEvictingAllTemporaryResourcesAndAllEvictionsSucceedThenReturnSuccess) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(allocation.handle); EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true)); @@ -946,18 +946,18 @@ TEST_F(Wddm20Tests, givenThreeAllocationsWhenEvictingAllTemporaryResourcesAndOne EXPECT_EQ(EvictionStatus::FAILED, gmockWddm.evictAllTemporaryResourcesResult.status); } TEST_F(Wddm20Tests, givenNoTemporaryResourcesWhenEvictingTemporaryResourceThenEvictionIsNotApplied) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->evictTemporaryResource(allocation); EXPECT_EQ(EvictionStatus::NOT_APPLIED, wddm->evictTemporaryResourceResult.status); } TEST_F(Wddm20Tests, whenEvictingTemporaryResourceThenAcquireTemporaryResourcesLock) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->evictTemporaryResource(allocation); EXPECT_EQ(1u, wddm->acquireLockResult.called); EXPECT_EQ(reinterpret_cast(&wddm->temporaryResourcesLock), wddm->acquireLockResult.uint64ParamPassed); } TEST_F(Wddm20Tests, whenEvictingNonExistingTemporaryResourceThenEvictIsNotAppliedAndTemporaryResourcesAreRestored) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x1; wddm->temporaryResources.push_back(0x2); EXPECT_FALSE(wddm->temporaryResources.empty()); @@ -966,7 +966,7 @@ TEST_F(Wddm20Tests, whenEvictingNonExistingTemporaryResourceThenEvictIsNotApplie EXPECT_EQ(EvictionStatus::NOT_APPLIED, wddm->evictTemporaryResourceResult.status); } TEST_F(Wddm20Tests, whenEvictingTemporaryResourceAndEvictFailsThenReturnFail) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(allocation.handle); EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(false)); @@ -975,7 +975,7 @@ TEST_F(Wddm20Tests, whenEvictingTemporaryResourceAndEvictFailsThenReturnFail) { EXPECT_EQ(EvictionStatus::FAILED, gmockWddm.evictTemporaryResourceResult.status); } TEST_F(Wddm20Tests, whenEvictingTemporaryResourceAndEvictSucceedThenReturnSuccess) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(allocation.handle); EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true)); @@ -988,7 +988,7 @@ TEST_F(Wddm20Tests, whenEvictingTemporaryResourceThenOtherResourcesRemainOnTheLi wddm->temporaryResources.push_back(0x2); wddm->temporaryResources.push_back(0x3); - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x2; wddm->evictTemporaryResource(allocation); @@ -1000,25 +1000,25 @@ TEST_F(Wddm20Tests, whenEvictingTemporaryResourceThenOtherResourcesRemainOnTheLi using WddmHeapSelectorTest = Wddm20Tests; TEST_F(WddmHeapSelectorTest, given32bitInternalAllocationWhenSelectingHeapThenInternalHeapIsUsed) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.is32BitAllocation = true; allocation.origin = AllocationOrigin::INTERNAL_ALLOCATION; EXPECT_EQ(internalHeapIndex, wddm->selectHeap(&allocation, nullptr)); } TEST_F(WddmHeapSelectorTest, givenNon32bitInternalAllocationWhenSelectingHeapThenInternalHeapIsUsed) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.is32BitAllocation = false; allocation.origin = AllocationOrigin::INTERNAL_ALLOCATION; EXPECT_EQ(internalHeapIndex, wddm->selectHeap(&allocation, nullptr)); } TEST_F(WddmHeapSelectorTest, given32bitExternalAllocationWhenSelectingHeapThenExternalHeapIsUsed) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.is32BitAllocation = true; allocation.origin = AllocationOrigin::EXTERNAL_ALLOCATION; EXPECT_EQ(HeapIndex::HEAP_EXTERNAL, wddm->selectHeap(&allocation, nullptr)); } TEST_F(WddmHeapSelectorTest, givenLimitedAddressSpaceWhenSelectingHeapForExternalAllocationThenLimitedHeapIsUsed) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; EXPECT_EQ(AllocationOrigin::EXTERNAL_ALLOCATION, allocation.origin); if (hardwareInfoTable[wddm->getGfxPlatform()->eProductFamily]->capabilityTable.gpuAddressSpace == MemoryConstants::max48BitAddress) { return; @@ -1026,7 +1026,7 @@ TEST_F(WddmHeapSelectorTest, givenLimitedAddressSpaceWhenSelectingHeapForExterna EXPECT_EQ(HeapIndex::HEAP_LIMITED, wddm->selectHeap(&allocation, nullptr)); } TEST_F(WddmHeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithPtrThenSvmHeapIsUsed) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; EXPECT_EQ(AllocationOrigin::EXTERNAL_ALLOCATION, allocation.origin); if (hardwareInfoTable[wddm->getGfxPlatform()->eProductFamily]->capabilityTable.gpuAddressSpace != MemoryConstants::max48BitAddress) { return; @@ -1034,7 +1034,7 @@ TEST_F(WddmHeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAl EXPECT_EQ(HeapIndex::HEAP_SVM, wddm->selectHeap(&allocation, &allocation)); } TEST_F(WddmHeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrThenStandardHeapIsUsed) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; EXPECT_EQ(AllocationOrigin::EXTERNAL_ALLOCATION, allocation.origin); if (hardwareInfoTable[wddm->getGfxPlatform()->eProductFamily]->capabilityTable.gpuAddressSpace != MemoryConstants::max48BitAddress) { return; diff --git a/unit_tests/os_interface/windows/wddm_kmdaf_listener_tests.cpp b/unit_tests/os_interface/windows/wddm_kmdaf_listener_tests.cpp index 65995f027f..fe9c14a2a8 100644 --- a/unit_tests/os_interface/windows/wddm_kmdaf_listener_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_kmdaf_listener_tests.cpp @@ -79,7 +79,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen } TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.handle = ALLOCATION_HANDLE; auto gmm = std::unique_ptr(new Gmm(nullptr, 1, false)); allocation.gmm = gmm.get(); @@ -95,7 +95,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDaf } TEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDafListenerNotifyUnmapGpuVAIsFedWithCorrectParams) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.gpuPtr = GPUVA; wddmWithKmDafMock->freeGpuVirtualAddress(allocation.gpuPtr, allocation.getUnderlyingBufferSize()); @@ -135,7 +135,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE } TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); auto gmm = std::unique_ptr(new Gmm(nullptr, 1, false)); allocation.gmm = gmm.get(); @@ -149,7 +149,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList } TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); auto gmm = std::unique_ptr(new Gmm(nullptr, 1, false)); allocation.gmm = gmm.get(); diff --git a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp index 02211054f9..cdc97953c3 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp @@ -68,7 +68,7 @@ TEST(WddmMemoryManager, NonAssignable) { constexpr EngineInstanceT defaultRcsEngine{ENGINE_RCS, 0}; TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 3u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; OsContext osContext(nullptr, 1u, defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); @@ -77,14 +77,14 @@ TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGetting } TEST(WddmAllocationTest, givenAllocationCreatedWithOsContextCountOneWhenItIsCreatedThenMaxOsContextCountIsUsedInstead) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.setTrimCandidateListPosition(3u, 700u); EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(3u)); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(2u)); } TEST(WddmAllocationTest, givenRequestedContextIdTooLargeWhenGettingTrimCandidateListPositionThenReturnUnusedPosition) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false}; + WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1u)); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1000u)); } @@ -253,7 +253,7 @@ TEST_F(WddmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationT void *cpuPtr = (void *)0x30000; size_t size = 0x1000; - WddmAllocation gfxAllocation(cpuPtr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false); + WddmAllocation gfxAllocation(cpuPtr, size, nullptr, MemoryPool::MemoryNull, false); memoryManager->addAllocationToHostPtrManager(&gfxAllocation); auto fragment = memoryManager->getHostPtrManager()->getFragment(gfxAllocation.getUnderlyingBuffer()); EXPECT_NE(fragment, nullptr); @@ -817,7 +817,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV memoryManager->setDeferredDeleter(nullptr); setMapGpuVaFailConfigFcn(0, 1); - WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false); + WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION); EXPECT_FALSE(ret); @@ -833,7 +833,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap setMapGpuVaFailConfigFcn(0, 1); - WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false); + WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION); EXPECT_TRUE(ret); @@ -849,7 +849,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAnd setMapGpuVaFailConfigFcn(0, 2); - WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false); + WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION); EXPECT_FALSE(ret); diff --git a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp index 2ab4deb4f7..8dcb94e777 100644 --- a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp @@ -629,9 +629,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetReturnsFalseWhenNumBytesT } TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetStopsEvictingWhenNumBytesToTrimIsZero) { - WddmAllocation allocation1(reinterpret_cast(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false), - allocation2(reinterpret_cast(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, 1u, false), - allocation3(reinterpret_cast(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation1(reinterpret_cast(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false), + allocation2(reinterpret_cast(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, false), + allocation3(reinterpret_cast(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -724,8 +724,8 @@ TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetWaitsFromCpuWhenLastFence TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, trimToBudgetEvictsDoneFragmentsOnly) { gdi->setNonZeroNumBytesToTrimInEvict(); void *ptr = reinterpret_cast(wddm->virtualAllocAddress + 0x1000); - WddmAllocation allocation1(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); - WddmAllocation allocation2(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation1(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation2(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -783,9 +783,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenThreeAllocationsAlignedSizeBigge void *ptr2 = reinterpret_cast(wddm->virtualAllocAddress + 0x3000); void *ptr3 = reinterpret_cast(wddm->virtualAllocAddress + 0x5000); - WddmAllocation allocation1(ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, 1u, false); - WddmAllocation allocation2(ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, 1u, false); - WddmAllocation allocation3(ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, 1u, false); + WddmAllocation allocation1(ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation2(ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation3(ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, false); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -985,7 +985,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsAndTrimToB MockWddmAllocation allocation1; void *cpuPtr = reinterpret_cast(wddm->getWddmMinAddress() + 0x1000); size_t allocationSize = 0x1000; - WddmAllocation allocationToTrim(cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false); + WddmAllocation allocationToTrim(cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, false); allocationToTrim.getResidencyData().updateCompletionData(residencyController->getMonitoredFence().lastSubmittedFence, osContext->getContextId());