Add memory prefetch modes for single and multiple subdevices

Single-subdevice prefetch for cmd list copy-only (with bcs) and acc mode.
Multi-subdevice prefetch (default) for shared allocation with multiple BOs.

Related-To: NEO-6740

Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
Slawomir Milczarek
2022-11-30 00:48:56 +00:00
committed by Compute-Runtime-Automation
parent e3ede4bb92
commit 5c1b50bccf
22 changed files with 228 additions and 59 deletions

View File

@@ -14,8 +14,8 @@ using namespace NEO;
class MockPrefetchManager : public PrefetchManager {
public:
void migrateAllocationsToGpu(PrefetchContext &prefetchContext, SVMAllocsManager &unifiedMemoryManager, Device &device) override {
PrefetchManager::migrateAllocationsToGpu(prefetchContext, unifiedMemoryManager, device);
void migrateAllocationsToGpu(PrefetchContext &prefetchContext, SVMAllocsManager &unifiedMemoryManager, Device &device, CommandStreamReceiver &csr) override {
PrefetchManager::migrateAllocationsToGpu(prefetchContext, unifiedMemoryManager, device, csr);
migrateAllocationsToGpuCalled = true;
}

View File

@@ -66,10 +66,11 @@ class MockDrmAllocation : public DrmAllocation {
return bindBOsRetValue;
}
bool prefetchBO(BufferObject *bo, uint32_t subDeviceId) override {
bool prefetchBO(BufferObject *bo, uint32_t vmHandleId, uint32_t subDeviceId) override {
prefetchBOCalled = true;
vmHandleIdsReceived.push_back(vmHandleId);
subDeviceIdsReceived.push_back(subDeviceId);
return DrmAllocation::prefetchBO(bo, subDeviceId);
return DrmAllocation::prefetchBO(bo, vmHandleId, subDeviceId);
}
ADDMETHOD_NOBASE(makeBOsResident, int, 0, (OsContext * osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind));
@@ -79,6 +80,7 @@ class MockDrmAllocation : public DrmAllocation {
bool bindBOsCalled = false;
int bindBOsRetValue = 0;
bool prefetchBOCalled = false;
std::vector<uint32_t> vmHandleIdsReceived;
std::vector<uint32_t> subDeviceIdsReceived;
};

View File

@@ -157,10 +157,10 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
return MemoryManager::setMemAdvise(gfxAllocation, flags, rootDeviceIndex);
}
bool setMemPrefetch(GraphicsAllocation *gfxAllocation, uint32_t subDeviceId, uint32_t rootDeviceIndex) override {
memPrefetchSubDeviceId = subDeviceId;
bool setMemPrefetch(GraphicsAllocation *gfxAllocation, SubDeviceIdsVec &subDeviceIds, uint32_t rootDeviceIndex) override {
memPrefetchSubDeviceIds = subDeviceIds;
setMemPrefetchCalled = true;
return MemoryManager::setMemPrefetch(gfxAllocation, subDeviceId, rootDeviceIndex);
return MemoryManager::setMemPrefetch(gfxAllocation, subDeviceIds, rootDeviceIndex);
}
bool isKmdMigrationAvailable(uint32_t rootDeviceIndex) override {
@@ -258,7 +258,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
std::unique_ptr<MockExecutionEnvironment> mockExecutionEnvironment;
DeviceBitfield recentlyPassedDeviceBitfield{};
std::unique_ptr<MultiGraphicsAllocation> waitAllocations = nullptr;
uint32_t memPrefetchSubDeviceId = 0;
SubDeviceIdsVec memPrefetchSubDeviceIds;
MemAdviseFlags memAdviseFlags{};
MemoryManager::AllocationStatus populateOsHandlesResult = MemoryManager::AllocationStatus::Success;
GraphicsAllocation *allocateGraphicsMemoryForNonSvmHostPtrResult = nullptr;