mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
Add device callback for GMM library to notify AUB subcapture
This commit adds a new callback to be called by GMM library when it allocates/deallocates compressed resources to collect data about their addresses and sizes and handle their AUB residency. Change-Id: I075d3ff4cb049cfe626da82892069c4460ea585c
This commit is contained in:
@@ -37,6 +37,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
typedef CommandStreamReceiverHw<GfxFamily> BaseClass;
|
||||
typedef typename AUBFamilyMapper<GfxFamily>::AUB AUB;
|
||||
typedef typename AUB::MiContextDescriptorReg MiContextDescriptorReg;
|
||||
using ExternalAllocationsContainer = std::vector<AllocationView>;
|
||||
|
||||
public:
|
||||
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) override;
|
||||
@@ -45,7 +46,11 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
|
||||
void processResidency(ResidencyContainer *allocationsForResidency) override;
|
||||
|
||||
void makeResidentExternal(AllocationView &allocationView);
|
||||
void makeNonResidentExternal(uint64_t gpuAddress);
|
||||
|
||||
MOCKABLE_VIRTUAL bool writeMemory(GraphicsAllocation &gfxAllocation);
|
||||
MOCKABLE_VIRTUAL bool writeMemory(AllocationView &allocationView);
|
||||
|
||||
void activateAubSubCapture(const MultiDispatchInfo &dispatchInfo) override;
|
||||
|
||||
@@ -114,5 +119,6 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
|
||||
protected:
|
||||
bool dumpAubNonWritable = false;
|
||||
ExternalAllocationsContainer externalAllocations;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -518,6 +518,21 @@ void AUBCommandStreamReceiverHw<GfxFamily>::makeResident(GraphicsAllocation &gfx
|
||||
gfxAllocation.residencyTaskCount = submissionTaskCount;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void AUBCommandStreamReceiverHw<GfxFamily>::makeResidentExternal(AllocationView &allocationView) {
|
||||
externalAllocations.push_back(allocationView);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void AUBCommandStreamReceiverHw<GfxFamily>::makeNonResidentExternal(uint64_t gpuAddress) {
|
||||
for (auto it = externalAllocations.begin(); it != externalAllocations.end(); it++) {
|
||||
if (it->first == gpuAddress) {
|
||||
externalAllocations.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxAllocation) {
|
||||
auto cpuAddress = gfxAllocation.getUnderlyingBuffer();
|
||||
@@ -555,6 +570,12 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(AllocationView &allocationView) {
|
||||
GraphicsAllocation gfxAllocation(reinterpret_cast<void *>(allocationView.first), allocationView.second);
|
||||
return writeMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void AUBCommandStreamReceiverHw<GfxFamily>::processResidency(ResidencyContainer *allocationsForResidency) {
|
||||
if (subCaptureManager->isSubCaptureMode()) {
|
||||
@@ -563,6 +584,12 @@ void AUBCommandStreamReceiverHw<GfxFamily>::processResidency(ResidencyContainer
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &externalAllocation : externalAllocations) {
|
||||
if (!writeMemory(externalAllocation)) {
|
||||
DEBUG_BREAK_IF(externalAllocation.second != 0);
|
||||
}
|
||||
}
|
||||
|
||||
auto &residencyAllocations = allocationsForResidency ? *allocationsForResidency : this->getMemoryManager()->getResidencyAllocations();
|
||||
|
||||
for (auto &gfxAllocation : residencyAllocations) {
|
||||
|
||||
@@ -42,6 +42,7 @@ class GraphicsAllocation;
|
||||
class IndirectHeap;
|
||||
class LinearStream;
|
||||
class MemoryManager;
|
||||
class GmmPageTableMngr;
|
||||
class OSInterface;
|
||||
class ExecutionEnvironment;
|
||||
|
||||
@@ -87,6 +88,8 @@ class CommandStreamReceiver {
|
||||
virtual MemoryManager *createMemoryManager(bool enable64kbPages) { return nullptr; }
|
||||
void setMemoryManager(MemoryManager *mm);
|
||||
|
||||
virtual GmmPageTableMngr *createPageTableManager() { return nullptr; }
|
||||
|
||||
GraphicsAllocation *createAllocationAndHandleResidency(const void *address, size_t size, bool addToDefferFreeList = true);
|
||||
void waitForTaskCountAndCleanAllocationList(uint32_t requiredTaskCount, uint32_t allocationType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user