mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
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:
committed by
sys_ocldev
parent
e3b1ba2112
commit
32825e203e
@@ -260,6 +260,8 @@ IndirectHeap &CommandQueue::getIndirectHeap(IndirectHeap::Type heapType,
|
||||
finalHeapSize = std::max(heapMemory->getUnderlyingBufferSize(), finalHeapSize);
|
||||
}
|
||||
|
||||
heapMemory->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM);
|
||||
|
||||
if (IndirectHeap::SURFACE_STATE == heapType) {
|
||||
DEBUG_BREAK_IF(minRequiredSize > maxSshSize);
|
||||
finalHeapSize = maxSshSize;
|
||||
@@ -324,6 +326,8 @@ LinearStream &CommandQueue::getCS(size_t minRequiredSize) {
|
||||
allocation = memoryManager->allocateGraphicsMemory(requiredSize, MemoryConstants::pageSize);
|
||||
}
|
||||
|
||||
allocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM);
|
||||
|
||||
// Deallocate the old block, if not null
|
||||
auto oldAllocation = commandStream->getGraphicsAllocation();
|
||||
|
||||
|
||||
@@ -144,6 +144,8 @@ LinearStream &CommandStreamReceiver::getCS(size_t minRequiredSize) {
|
||||
allocation = memoryManager->allocateGraphicsMemory(requiredSize, MemoryConstants::pageSize);
|
||||
}
|
||||
|
||||
allocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM);
|
||||
|
||||
//pass current allocation to reusable list
|
||||
if (commandStream.getCpuBase()) {
|
||||
memoryManager->storeAllocation(std::unique_ptr<GraphicsAllocation>(commandStream.getGraphicsAllocation()), REUSABLE_ALLOCATION);
|
||||
|
||||
@@ -57,6 +57,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
ALLOCATION_TYPE_BUFFER,
|
||||
ALLOCATION_TYPE_IMAGE,
|
||||
ALLOCATION_TYPE_TAG_BUFFER,
|
||||
ALLOCATION_TYPE_LINEAR_STREAM,
|
||||
ALLOCATION_TYPE_NON_AUB_WRITABLE = 0x40000000,
|
||||
ALLOCATION_TYPE_WRITABLE = 0x80000000
|
||||
};
|
||||
@@ -107,8 +108,8 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
void setSize(size_t size) { this->size = size; }
|
||||
osHandle peekSharedHandle() { return sharedHandle; }
|
||||
|
||||
void setAllocationType(int allocationType) { this->allocationType = allocationType; }
|
||||
int getAllocationType() const { return allocationType; }
|
||||
void setAllocationType(uint32_t allocationType) { this->allocationType = allocationType; }
|
||||
uint32_t getAllocationType() const { return allocationType; }
|
||||
|
||||
uint32_t taskCount = ObjectNotUsed;
|
||||
OsHandleStorage fragmentsStorage;
|
||||
@@ -130,7 +131,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
bool cpuPtrAllocated = false; // flag indicating if cpuPtr is driver-allocated
|
||||
|
||||
private:
|
||||
int allocationType;
|
||||
uint32_t allocationType;
|
||||
|
||||
//this variable can only be modified from SubmissionAggregator
|
||||
friend class SubmissionAggregator;
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -54,6 +54,7 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
|
||||
|
||||
protected:
|
||||
void initPageTableManagerRegisters(LinearStream &csr) override;
|
||||
void kmDafLockAllocations(ResidencyContainer *allocationsForResidency);
|
||||
GmmPageTableMngr *createPageTableManager();
|
||||
|
||||
Wddm *wddm;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user