KM DAF AubCapture to recapture command streams and heap allocations

This commit introduces a recapture of CS and Heap resources on every submit.

Change-Id: I2a5a763e8988de804da1a6c2c8042154b0786b2e
This commit is contained in:
Milczarek, Slawomir
2018-03-22 21:13:45 +01:00
committed by sys_ocldev
parent e3b1ba2112
commit 32825e203e
12 changed files with 197 additions and 3 deletions

View File

@@ -708,6 +708,10 @@ void Wddm::unlockResource(WddmAllocation *wddmAllocation) {
kmDafListener->notifyUnlock(featureTable->ftrKmdDaf, adapter, device, &wddmAllocation->handle, 1, gdi->escape);
}
void Wddm::kmDafLock(WddmAllocation *wddmAllocation) {
kmDafListener->notifyLock(featureTable->ftrKmdDaf, adapter, device, wddmAllocation->handle, 0, gdi->escape);
}
D3DKMT_HANDLE Wddm::createContext() {
NTSTATUS status = STATUS_UNSUCCESSFUL;
D3DKMT_CREATECONTEXTVIRTUAL CreateContext = {0};

View File

@@ -87,6 +87,8 @@ class Wddm {
bool openNTHandle(HANDLE handle, WddmAllocation *alloc);
MOCKABLE_VIRTUAL void *lockResource(WddmAllocation *wddmAllocation);
MOCKABLE_VIRTUAL void unlockResource(WddmAllocation *wddmAllocation);
MOCKABLE_VIRTUAL void kmDafLock(WddmAllocation *wddmAllocation);
MOCKABLE_VIRTUAL bool isKmDafEnabled() { return featureTable->ftrKmdDaf; };
MOCKABLE_VIRTUAL bool destroyContext(D3DKMT_HANDLE context);
MOCKABLE_VIRTUAL bool queryAdapterInfo();

View File

@@ -54,6 +54,7 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
protected:
void initPageTableManagerRegisters(LinearStream &csr) override;
void kmDafLockAllocations(ResidencyContainer *allocationsForResidency);
GmmPageTableMngr *createPageTableManager();
Wddm *wddm;

View File

@@ -123,7 +123,12 @@ FlushStamp WddmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer,
break;
}
if (wddm->isKmDafEnabled()) {
this->kmDafLockAllocations(allocationsForResidency);
}
wddm->submit(commandStreamAddress, batchBuffer.usedSize - batchBuffer.startOffset, commandBufferHeader);
return wddm->getMonitoredFence().lastSubmittedFence;
}
@@ -208,4 +213,15 @@ void WddmCommandStreamReceiver<GfxFamily>::initPageTableManagerRegisters(LinearS
pageTableManagerInitialized = true;
}
}
template <typename GfxFamily>
void WddmCommandStreamReceiver<GfxFamily>::kmDafLockAllocations(ResidencyContainer *allocationsForResidency) {
auto &residencyAllocations = allocationsForResidency ? *allocationsForResidency : getMemoryManager()->getResidencyAllocations();
for (uint32_t i = 0; i < residencyAllocations.size(); i++) {
if (GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM == residencyAllocations[i]->getAllocationType()) {
wddm->kmDafLock(static_cast<WddmAllocation *>(residencyAllocations[i]));
}
}
}
} // namespace OCLRT