mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 18:06:32 +08:00
[1/n] Use GfxPartition for 32-bit allocations - WddmMemoryManager
Related-To: NEO-2877 Change-Id: Ie3d94f68d5c9958b0b7bade600b964b778aeb4cf Signed-off-by: Venevtsev, Igor <igor.venevtsev@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
603eee76e5
commit
f77cd94cd5
@@ -769,7 +769,7 @@ void Wddm::initGfxPartition(GfxPartition &outGfxPartition) const {
|
||||
outGfxPartition.heapInit(HeapIndex::HEAP_STANDARD64KB, gfxPartition.Standard64KB.Base, gfxPartition.Standard64KB.Limit - gfxPartition.Standard64KB.Base + 1);
|
||||
|
||||
for (auto heap : GfxPartition::heap32Names) {
|
||||
outGfxPartition.heapInit(heap, gfxPartition.Heap32[static_cast<uint32_t>(heap)].Base + MemoryConstants::pageSize,
|
||||
outGfxPartition.heapInit(heap, gfxPartition.Heap32[static_cast<uint32_t>(heap)].Base,
|
||||
gfxPartition.Heap32[static_cast<uint32_t>(heap)].Limit - gfxPartition.Heap32[static_cast<uint32_t>(heap)].Base + 1);
|
||||
}
|
||||
}
|
||||
@@ -791,14 +791,6 @@ PFND3DKMT_ESCAPE Wddm::getEscapeHandle() const {
|
||||
return gdi->escape;
|
||||
}
|
||||
|
||||
uint64_t Wddm::getExternalHeapBase() const {
|
||||
return alignUp(gfxPartition.Heap32[static_cast<uint32_t>(HeapIndex::HEAP_EXTERNAL)].Base, MemoryConstants::pageSize);
|
||||
}
|
||||
|
||||
uint64_t Wddm::getExternalHeapSize() const {
|
||||
return alignDown(gfxPartition.Heap32[static_cast<uint32_t>(HeapIndex::HEAP_EXTERNAL)].Limit - gfxPartition.Heap32[static_cast<uint32_t>(HeapIndex::HEAP_EXTERNAL)].Base, MemoryConstants::pageSize);
|
||||
}
|
||||
|
||||
VOID *Wddm::registerTrimCallback(PFND3DKMT_TRIMNOTIFICATIONCALLBACK callback, WddmResidencyController &residencyController) {
|
||||
if (DebugManager.flags.DoNotRegisterTrimCallback.get()) {
|
||||
return nullptr;
|
||||
|
||||
@@ -129,9 +129,6 @@ class Wddm {
|
||||
return static_cast<uint32_t>(hwContextId);
|
||||
}
|
||||
|
||||
uint64_t getExternalHeapBase() const;
|
||||
uint64_t getExternalHeapSize() const;
|
||||
|
||||
std::unique_ptr<SettingsReader> registryReader;
|
||||
|
||||
GmmPageTableMngr *getPageTableManager() const { return pageTableManager.get(); }
|
||||
|
||||
@@ -39,7 +39,6 @@ WddmMemoryManager::WddmMemoryManager(ExecutionEnvironment &executionEnvironment)
|
||||
wddm(executionEnvironment.osInterface->get()->getWddm()) {
|
||||
DEBUG_BREAK_IF(wddm == nullptr);
|
||||
|
||||
allocator32Bit = std::unique_ptr<Allocator32bit>(new Allocator32bit(wddm->getExternalHeapBase(), wddm->getExternalHeapSize()));
|
||||
asyncDeleterEnabled = DebugManager.flags.EnableDeferredDeleter.get();
|
||||
if (asyncDeleterEnabled)
|
||||
deferredDeleter = createDeferredDeleter();
|
||||
@@ -478,11 +477,15 @@ uint64_t WddmMemoryManager::getMaxApplicationAddress() {
|
||||
}
|
||||
|
||||
uint64_t WddmMemoryManager::getInternalHeapBaseAddress() {
|
||||
return wddm->getGfxPartition().Heap32[static_cast<uint32_t>(internalHeapIndex)].Base;
|
||||
return gfxPartition.getHeapBase(internalHeapIndex);
|
||||
}
|
||||
|
||||
uint64_t WddmMemoryManager::getExternalHeapBaseAddress() {
|
||||
return allocator32Bit->getBase();
|
||||
return gfxPartition.getHeapBase(HeapIndex::HEAP_EXTERNAL);
|
||||
}
|
||||
|
||||
void WddmMemoryManager::setForce32BitAllocations(bool newValue) {
|
||||
force32bitAllocations = newValue;
|
||||
}
|
||||
|
||||
bool WddmMemoryManager::mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) {
|
||||
@@ -547,7 +550,7 @@ uint32_t WddmMemoryManager::mapGpuVirtualAddress(WddmAllocation *graphicsAllocat
|
||||
for (auto handleId = startingIndex; handleId < graphicsAllocation->getNumHandles(); handleId++) {
|
||||
|
||||
if (!wddm->mapGpuVirtualAddress(graphicsAllocation->getGmm(handleId), graphicsAllocation->getHandles()[handleId],
|
||||
gfxPartition.getHeapBase(heapIndex), gfxPartition.getHeapLimit(heapIndex),
|
||||
gfxPartition.getHeapMinimalAddress(heapIndex), gfxPartition.getHeapLimit(heapIndex),
|
||||
addressToMap, graphicsAllocation->getGpuAddressToModify())) {
|
||||
return numMappedAllocations;
|
||||
}
|
||||
@@ -559,8 +562,8 @@ uint32_t WddmMemoryManager::mapGpuVirtualAddress(WddmAllocation *graphicsAllocat
|
||||
void WddmMemoryManager::obtainGpuAddressIfNeeded(WddmAllocation *allocation) {
|
||||
if (allocation->getNumHandles() > 1u) {
|
||||
auto heapIndex = selectHeap(allocation, false, executionEnvironment.isFullRangeSvm());
|
||||
allocation->preferredGpuAddress = wddm->reserveGpuVirtualAddress(gfxPartition.getHeapBase(heapIndex), gfxPartition.getHeapLimit(heapIndex),
|
||||
allocation->getAlignedSize());
|
||||
allocation->preferredGpuAddress = wddm->reserveGpuVirtualAddress(gfxPartition.getHeapMinimalAddress(heapIndex),
|
||||
gfxPartition.getHeapLimit(heapIndex), allocation->getAlignedSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,13 @@ class WddmMemoryManager : public MemoryManager {
|
||||
|
||||
uint64_t getSystemSharedMemory() override;
|
||||
uint64_t getMaxApplicationAddress() override;
|
||||
|
||||
uint64_t getInternalHeapBaseAddress() override;
|
||||
|
||||
uint64_t getExternalHeapBaseAddress() override;
|
||||
|
||||
void setForce32BitAllocations(bool newValue) override;
|
||||
|
||||
bool tryDeferDeletions(const D3DKMT_HANDLE *handles, uint32_t allocationCount, D3DKMT_HANDLE resourceHandle);
|
||||
|
||||
bool isMemoryBudgetExhausted() const override;
|
||||
|
||||
Reference in New Issue
Block a user