Revert "fix: Set vmbind user fence when makeMemoryResident"

This reverts commit 80dc4fb43a.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2025-01-31 10:53:44 +01:00
committed by Compute-Runtime-Automation
parent 635f69e54a
commit d23249b061
51 changed files with 266 additions and 687 deletions

View File

@@ -98,11 +98,11 @@ void DebuggerL0::initialize() {
NEO::MemoryOperationsHandler *memoryOperationsIface = rootDeviceEnvironment.memoryOperationsInterface.get();
if (memoryOperationsIface) {
memoryOperationsIface->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&moduleDebugArea, 1), false, false);
memoryOperationsIface->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&moduleDebugArea, 1), false);
auto numSubDevices = device->getNumSubDevices();
for (uint32_t i = 0; i < numSubDevices; i++) {
auto subDevice = device->getSubDevice(i);
memoryOperationsIface->makeResident(subDevice, ArrayRef<NEO::GraphicsAllocation *>(&moduleDebugArea, 1), false, false);
memoryOperationsIface->makeResident(subDevice, ArrayRef<NEO::GraphicsAllocation *>(&moduleDebugArea, 1), false);
}
}
@@ -142,7 +142,7 @@ void DebuggerL0::notifyModuleLoadAllocations(Device *device, const StackVec<NEO:
NEO::MemoryOperationsHandler *memoryOperationsIface = device->getRootDeviceEnvironment().memoryOperationsInterface.get();
if (memoryOperationsIface) {
for (auto gfxAlloc : allocs) {
memoryOperationsIface->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&gfxAlloc, 1), false, false);
memoryOperationsIface->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&gfxAlloc, 1), false);
}
}
}

View File

@@ -420,7 +420,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::allocateResources() {
template <typename GfxFamily, typename Dispatcher>
bool DirectSubmissionHw<GfxFamily, Dispatcher>::makeResourcesResident(DirectSubmissionAllocations &allocations) {
auto ret = memoryOperationHandler->makeResidentWithinOsContext(&this->osContext, ArrayRef<GraphicsAllocation *>(allocations), false, false) == MemoryOperationsStatus::success;
auto ret = memoryOperationHandler->makeResidentWithinOsContext(&this->osContext, ArrayRef<GraphicsAllocation *>(allocations), false) == MemoryOperationsStatus::success;
return ret;
}
@@ -1140,7 +1140,7 @@ inline GraphicsAllocation *DirectSubmissionHw<GfxFamily, Dispatcher>::switchRing
nextAllocation = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
this->currentRingBuffer = static_cast<uint32_t>(this->ringBuffers.size());
this->ringBuffers.emplace_back(0ull, nextAllocation);
auto ret = memoryOperationHandler->makeResidentWithinOsContext(&this->osContext, ArrayRef<GraphicsAllocation *>(&nextAllocation, 1u), false, false) == MemoryOperationsStatus::success;
auto ret = memoryOperationHandler->makeResidentWithinOsContext(&this->osContext, ArrayRef<GraphicsAllocation *>(&nextAllocation, 1u), false) == MemoryOperationsStatus::success;
UNRECOVERABLE_IF(!ret);
}
}

View File

@@ -153,7 +153,7 @@ GraphicsAllocation *BindlessHeapsHelper::getHeapAllocation(size_t heapSize, size
GraphicsAllocation *allocation = memManager->allocateGraphicsMemoryWithProperties(properties);
MemoryOperationsHandler *memoryOperationsIface = rootDevice->getRootDeviceEnvironmentRef().memoryOperationsInterface.get();
auto result = memoryOperationsIface->makeResident(rootDevice, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false, false);
auto result = memoryOperationsIface->makeResident(rootDevice, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false);
if (result != NEO::MemoryOperationsStatus::success) {
memManager->freeGraphicsMemory(allocation);
return nullptr;

View File

@@ -20,13 +20,13 @@ class MemoryOperationsHandler {
MemoryOperationsHandler() = default;
virtual ~MemoryOperationsHandler() = default;
virtual MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) = 0;
virtual MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) = 0;
virtual MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) = 0;
virtual MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) = 0;
virtual MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) = 0;
virtual MemoryOperationsStatus free(Device *device, GraphicsAllocation &gfxAllocation) { return MemoryOperationsStatus::success; }
virtual MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) = 0;
virtual MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) = 0;
virtual MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) = 0;
virtual void processFlushResidency(CommandStreamReceiver *csr) {}
};

View File

@@ -26,7 +26,7 @@ AubMemoryOperationsHandler::AubMemoryOperationsHandler(aub_stream::AubManager *a
this->aubManager = aubManager;
}
MemoryOperationsStatus AubMemoryOperationsHandler::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) {
MemoryOperationsStatus AubMemoryOperationsHandler::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) {
if (!aubManager) {
return MemoryOperationsStatus::deviceUninitialized;
}
@@ -76,7 +76,7 @@ MemoryOperationsStatus AubMemoryOperationsHandler::makeResident(Device *device,
}
MemoryOperationsStatus AubMemoryOperationsHandler::lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) {
return makeResident(device, gfxAllocations, false, false);
return makeResident(device, gfxAllocations, false);
}
MemoryOperationsStatus AubMemoryOperationsHandler::evict(Device *device, GraphicsAllocation &gfxAllocation) {
@@ -98,8 +98,8 @@ MemoryOperationsStatus AubMemoryOperationsHandler::free(Device *device, Graphics
return MemoryOperationsStatus::success;
}
MemoryOperationsStatus AubMemoryOperationsHandler::makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) {
return makeResident(nullptr, gfxAllocations, false, forcePagingFence);
MemoryOperationsStatus AubMemoryOperationsHandler::makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) {
return makeResident(nullptr, gfxAllocations, false);
}
MemoryOperationsStatus AubMemoryOperationsHandler::evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) {

View File

@@ -22,13 +22,13 @@ class AubMemoryOperationsHandler : public MemoryOperationsHandler {
AubMemoryOperationsHandler(aub_stream::AubManager *aubManager);
~AubMemoryOperationsHandler() override = default;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override;
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override;
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override;
MemoryOperationsStatus free(Device *device, GraphicsAllocation &gfxAllocation) override;
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override;
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override;
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override;
void processFlushResidency(CommandStreamReceiver *csr) override;

View File

@@ -241,11 +241,11 @@ bool DrmAllocation::prefetchBOWithChunking(Drm *drm) {
return success;
}
int DrmAllocation::makeBOsResident(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence) {
int DrmAllocation::makeBOsResident(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind) {
if (this->fragmentsStorage.fragmentCount) {
for (unsigned int f = 0; f < this->fragmentsStorage.fragmentCount; f++) {
if (!this->fragmentsStorage.fragmentStorageData[f].residency->resident[osContext->getContextId()]) {
int retVal = bindBO(static_cast<OsHandleLinux *>(this->fragmentsStorage.fragmentStorageData[f].osHandleStorage)->bo, osContext, vmHandleId, bufferObjects, bind, forcePagingFence);
int retVal = bindBO(static_cast<OsHandleLinux *>(this->fragmentsStorage.fragmentStorageData[f].osHandleStorage)->bo, osContext, vmHandleId, bufferObjects, bind);
if (retVal) {
return retVal;
}
@@ -253,7 +253,7 @@ int DrmAllocation::makeBOsResident(OsContext *osContext, uint32_t vmHandleId, st
}
}
} else {
int retVal = bindBOs(osContext, vmHandleId, bufferObjects, bind, forcePagingFence);
int retVal = bindBOs(osContext, vmHandleId, bufferObjects, bind);
if (retVal) {
return retVal;
}
@@ -262,7 +262,7 @@ int DrmAllocation::makeBOsResident(OsContext *osContext, uint32_t vmHandleId, st
return 0;
}
int DrmAllocation::bindBO(BufferObject *bo, OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence) {
int DrmAllocation::bindBO(BufferObject *bo, OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind) {
auto retVal = 0;
if (bo) {
bo->requireExplicitResidency(bo->peekDrm()->hasPageFaultSupport() && !shouldAllocationPageFault(bo->peekDrm()));
@@ -279,7 +279,7 @@ int DrmAllocation::bindBO(BufferObject *bo, OsContext *osContext, uint32_t vmHan
} else {
if (bind) {
retVal = bo->bind(osContext, vmHandleId, forcePagingFence);
retVal = bo->bind(osContext, vmHandleId);
} else {
retVal = bo->unbind(osContext, vmHandleId);
}
@@ -288,19 +288,19 @@ int DrmAllocation::bindBO(BufferObject *bo, OsContext *osContext, uint32_t vmHan
return retVal;
}
int DrmAllocation::bindBOs(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence) {
int DrmAllocation::bindBOs(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind) {
int retVal = 0;
if (this->storageInfo.getNumBanks() > 1) {
auto &bos = this->getBOs();
if (this->storageInfo.tileInstanced) {
auto bo = bos[vmHandleId];
retVal = bindBO(bo, osContext, vmHandleId, bufferObjects, bind, forcePagingFence);
retVal = bindBO(bo, osContext, vmHandleId, bufferObjects, bind);
if (retVal) {
return retVal;
}
} else {
for (auto bo : bos) {
retVal = bindBO(bo, osContext, vmHandleId, bufferObjects, bind, forcePagingFence);
retVal = bindBO(bo, osContext, vmHandleId, bufferObjects, bind);
if (retVal) {
return retVal;
}
@@ -308,7 +308,7 @@ int DrmAllocation::bindBOs(OsContext *osContext, uint32_t vmHandleId, std::vecto
}
} else {
auto bo = this->getBO();
retVal = bindBO(bo, osContext, vmHandleId, bufferObjects, bind, forcePagingFence);
retVal = bindBO(bo, osContext, vmHandleId, bufferObjects, bind);
if (retVal) {
return retVal;
}

View File

@@ -130,9 +130,9 @@ class DrmAllocation : public GraphicsAllocation {
}
bool prefetchBOWithChunking(Drm *drm);
MOCKABLE_VIRTUAL int makeBOsResident(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence);
MOCKABLE_VIRTUAL int bindBO(BufferObject *bo, OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence);
MOCKABLE_VIRTUAL int bindBOs(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence);
MOCKABLE_VIRTUAL int makeBOsResident(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind);
MOCKABLE_VIRTUAL int bindBO(BufferObject *bo, OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind);
MOCKABLE_VIRTUAL int bindBOs(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind);
MOCKABLE_VIRTUAL bool prefetchBO(BufferObject *bo, uint32_t vmHandleId, uint32_t subDeviceId);
MOCKABLE_VIRTUAL void registerBOBindExtHandle(Drm *drm);
void addRegisteredBoBindHandle(uint32_t handle) { registeredBoBindHandles.push_back(handle); }

View File

@@ -262,11 +262,11 @@ void BufferObject::printBOBindingResult(OsContext *osContext, uint32_t vmHandleI
}
}
int BufferObject::bind(OsContext *osContext, uint32_t vmHandleId, const bool forcePagingFence) {
int BufferObject::bind(OsContext *osContext, uint32_t vmHandleId) {
int retVal = 0;
auto contextId = getOsContextId(osContext);
if (!this->bindInfo[contextId][vmHandleId]) {
retVal = this->drm->bindBufferObject(osContext, vmHandleId, this, forcePagingFence);
retVal = this->drm->bindBufferObject(osContext, vmHandleId, this);
if (debugManager.flags.PrintBOBindingResult.get()) {
printBOBindingResult(osContext, vmHandleId, true, retVal);
}
@@ -307,13 +307,13 @@ void BufferObject::printExecutionBuffer(ExecBuffer &execbuf, const size_t &resid
printf("%s\n", logger.str().c_str());
}
int bindBOsWithinContext(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId, const bool forcePagingFence) {
int bindBOsWithinContext(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId) {
auto retVal = 0;
for (auto drmIterator = 0u; drmIterator < osContext->getDeviceBitfield().size(); drmIterator++) {
if (osContext->getDeviceBitfield().test(drmIterator)) {
for (size_t i = 0; i < numberOfBos; i++) {
retVal |= boToPin[i]->bind(osContext, drmIterator, forcePagingFence);
retVal |= boToPin[i]->bind(osContext, drmIterator);
}
}
}
@@ -325,7 +325,7 @@ int BufferObject::pin(BufferObject *const boToPin[], size_t numberOfBos, OsConte
auto retVal = 0;
if (this->drm->isVmBindAvailable()) {
retVal = bindBOsWithinContext(boToPin, numberOfBos, osContext, vmHandleId, false);
retVal = bindBOsWithinContext(boToPin, numberOfBos, osContext, vmHandleId);
} else {
StackVec<ExecObject, maxFragmentsCount + 1> execObject(numberOfBos + 1);
retVal = this->exec(4u, 0u, 0u, false, osContext, vmHandleId, drmContextId, boToPin, numberOfBos, &execObject[0], 0, 0);
@@ -339,7 +339,7 @@ int BufferObject::validateHostPtr(BufferObject *const boToPin[], size_t numberOf
if (this->drm->isVmBindAvailable()) {
for (size_t i = 0; i < numberOfBos; i++) {
retVal = boToPin[i]->bind(osContext, vmHandleId, false);
retVal = boToPin[i]->bind(osContext, vmHandleId);
if (retVal) {
break;
}

View File

@@ -114,7 +114,7 @@ class BufferObject {
MOCKABLE_VIRTUAL int exec(uint32_t used, size_t startOffset, unsigned int flags, bool requiresCoherency, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId,
BufferObject *const residency[], size_t residencyCount, ExecObject *execObjectsStorage, uint64_t completionGpuAddress, TaskCountType completionValue);
int bind(OsContext *osContext, uint32_t vmHandleId, const bool forcePagingFence);
int bind(OsContext *osContext, uint32_t vmHandleId);
int unbind(OsContext *osContext, uint32_t vmHandleId);
void printExecutionBuffer(ExecBuffer &execbuf, const size_t &residencyCount, ExecObject *execObjectsStorage, BufferObject *const residency[]);

View File

@@ -190,13 +190,13 @@ SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::printBOsForSubmit(Residenc
if (osContext->getDeviceBitfield().test(drmIterator)) {
for (auto gfxAllocation = allocationsForResidency.begin(); gfxAllocation != allocationsForResidency.end(); gfxAllocation++) {
auto drmAllocation = static_cast<DrmAllocation *>(*gfxAllocation);
auto retCode = drmAllocation->makeBOsResident(osContext, drmIterator, &bosForSubmit, true, false);
auto retCode = drmAllocation->makeBOsResident(osContext, drmIterator, &bosForSubmit, true);
if (retCode) {
return Drm::getSubmissionStatusFromReturnCode(retCode);
}
}
auto drmCmdBufferAllocation = static_cast<DrmAllocation *>(&cmdBufferAllocation);
auto retCode = drmCmdBufferAllocation->makeBOsResident(osContext, drmIterator, &bosForSubmit, true, false);
auto retCode = drmCmdBufferAllocation->makeBOsResident(osContext, drmIterator, &bosForSubmit, true);
if (retCode) {
return Drm::getSubmissionStatusFromReturnCode(retCode);
}
@@ -260,7 +260,7 @@ SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::processResidency(Residency
int ret = 0;
for (auto &alloc : inputAllocationsForResidency) {
auto drmAlloc = static_cast<DrmAllocation *>(alloc);
ret = drmAlloc->makeBOsResident(osContext, handleId, &this->residency, false, false);
ret = drmAlloc->makeBOsResident(osContext, handleId, &this->residency, false);
if (ret != 0) {
break;
}
@@ -389,4 +389,4 @@ template <typename GfxFamily>
bool DrmCommandStreamReceiver<GfxFamily>::isKmdWaitOnTaskCountAllowed() const {
return this->isDirectSubmissionEnabled();
}
} // namespace NEO
} // namespace NEO

View File

@@ -306,7 +306,7 @@ bool DrmMemoryManager::setMemPrefetch(GraphicsAllocation *gfxAllocation, SubDevi
for (auto subDeviceId : subDeviceIds) {
auto vmHandleId = subDeviceId;
auto retVal = drmAllocation->bindBOs(osContextLinux, vmHandleId, nullptr, true, false);
auto retVal = drmAllocation->bindBOs(osContextLinux, vmHandleId, nullptr, true);
if (retVal != 0) {
DEBUG_BREAK_IF(true);
return false;
@@ -736,7 +736,7 @@ bool DrmMemoryManager::mapPhysicalHostMemoryToVirtualMemory(RootDeviceIndicesCon
bo->setMmapOffset(mmapOffset);
bo->setAddress(gpuRange);
bo->bind(getDefaultOsContext(drmPhysicalAllocation->getRootDeviceIndex()), 0, false);
bo->bind(getDefaultOsContext(drmPhysicalAllocation->getRootDeviceIndex()), 0);
auto drmAllocation = new DrmAllocation(drmPhysicalAllocation->getRootDeviceIndex(), 1u, AllocationType::bufferHostMemory, bo, addrToPtr(bo->peekAddress()), bo->peekSize(),
static_cast<osHandle>(internalHandle), memoryPool, getGmmHelper(drmPhysicalAllocation->getRootDeviceIndex())->canonize(bo->peekAddress()));
@@ -1669,7 +1669,7 @@ bool DrmMemoryManager::makeAllocationResident(GraphicsAllocation *allocation) {
auto drmAllocation = static_cast<DrmAllocation *>(allocation);
auto rootDeviceIndex = allocation->getRootDeviceIndex();
for (uint32_t i = 0; getDrm(rootDeviceIndex).getVirtualMemoryAddressSpace(i) > 0u; i++) {
if (drmAllocation->makeBOsResident(getDefaultOsContext(rootDeviceIndex), i, nullptr, true, false)) {
if (drmAllocation->makeBOsResident(getDefaultOsContext(rootDeviceIndex), i, nullptr, true)) {
return false;
}
getDrm(rootDeviceIndex).waitForBind(i);

View File

@@ -26,12 +26,12 @@ DrmMemoryOperationsHandlerBind::DrmMemoryOperationsHandlerBind(const RootDeviceE
DrmMemoryOperationsHandlerBind::~DrmMemoryOperationsHandlerBind() = default;
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) {
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) {
auto &engines = device->getAllEngines();
MemoryOperationsStatus result = MemoryOperationsStatus::success;
for (const auto &engine : engines) {
engine.commandStreamReceiver->initializeResources(false, device->getPreemptionMode());
result = this->makeResidentWithinOsContext(engine.osContext, gfxAllocations, false, forcePagingFence);
result = this->makeResidentWithinOsContext(engine.osContext, gfxAllocations, false);
if (result != MemoryOperationsStatus::success) {
break;
}
@@ -43,10 +43,10 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::lock(Device *device, Arra
for (auto gfxAllocation = gfxAllocations.begin(); gfxAllocation != gfxAllocations.end(); gfxAllocation++) {
(*gfxAllocation)->setLockedMemory(true);
}
return makeResident(device, gfxAllocations, false, false);
return makeResident(device, gfxAllocations, false);
}
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) {
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) {
auto deviceBitfield = osContext->getDeviceBitfield();
std::lock_guard<std::mutex> lock(mutex);
@@ -68,8 +68,7 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResidentWithinOsConte
if (!bo->getBindInfo()[bo->getOsContextId(osContext)][drmIterator]) {
bo->requireExplicitLockedMemory(drmAllocation->isLockedMemory());
bo->requireImmediateBinding(true);
int result = drmAllocation->makeBOsResident(osContext, drmIterator, nullptr, true, forcePagingFence);
int result = drmAllocation->makeBOsResident(osContext, drmIterator, nullptr, true);
if (result) {
return MemoryOperationsStatus::outOfMemory;
}
@@ -109,7 +108,7 @@ int DrmMemoryOperationsHandlerBind::evictImpl(OsContext *osContext, GraphicsAllo
auto drmAllocation = static_cast<DrmAllocation *>(&gfxAllocation);
for (auto drmIterator = 0u; drmIterator < deviceBitfield.size(); drmIterator++) {
if (deviceBitfield.test(drmIterator)) {
int retVal = drmAllocation->makeBOsResident(osContext, drmIterator, nullptr, false, false);
int retVal = drmAllocation->makeBOsResident(osContext, drmIterator, nullptr, false);
if (retVal) {
return retVal;
}
@@ -144,11 +143,11 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::mergeWithResidencyContain
auto memoryManager = static_cast<DrmMemoryManager *>(this->rootDeviceEnvironment.executionEnvironment.memoryManager.get());
auto allocLock = memoryManager->acquireAllocLock();
this->makeResidentWithinOsContext(osContext, ArrayRef<GraphicsAllocation *>(memoryManager->getSysMemAllocs()), true, false);
this->makeResidentWithinOsContext(osContext, ArrayRef<GraphicsAllocation *>(memoryManager->getLocalMemAllocs(this->rootDeviceIndex)), true, false);
this->makeResidentWithinOsContext(osContext, ArrayRef<GraphicsAllocation *>(memoryManager->getSysMemAllocs()), true);
this->makeResidentWithinOsContext(osContext, ArrayRef<GraphicsAllocation *>(memoryManager->getLocalMemAllocs(this->rootDeviceIndex)), true);
}
auto retVal = this->makeResidentWithinOsContext(osContext, ArrayRef<GraphicsAllocation *>(residencyContainer), true, false);
auto retVal = this->makeResidentWithinOsContext(osContext, ArrayRef<GraphicsAllocation *>(residencyContainer), true);
if (retVal != MemoryOperationsStatus::success) {
return retVal;
}

View File

@@ -16,8 +16,8 @@ class DrmMemoryOperationsHandlerBind : public DrmMemoryOperationsHandler {
DrmMemoryOperationsHandlerBind(const RootDeviceEnvironment &rootDeviceEnvironment, uint32_t rootDeviceIndex);
~DrmMemoryOperationsHandlerBind() override;
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override;
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override;
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override;
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override;

View File

@@ -23,15 +23,15 @@ DrmMemoryOperationsHandlerDefault::DrmMemoryOperationsHandlerDefault(uint32_t ro
;
DrmMemoryOperationsHandlerDefault::~DrmMemoryOperationsHandlerDefault() = default;
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) {
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) {
std::lock_guard<std::mutex> lock(mutex);
this->residency.insert(gfxAllocations.begin(), gfxAllocations.end());
return MemoryOperationsStatus::success;
}
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) {
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) {
OsContext *osContext = nullptr;
auto ret = this->makeResidentWithinOsContext(osContext, gfxAllocations, false, forcePagingFence);
auto ret = this->makeResidentWithinOsContext(osContext, gfxAllocations, false);
if (!isDummyExecNeeded || ret != MemoryOperationsStatus::success) {
return ret;
}
@@ -53,7 +53,7 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::lock(Device *device, A
bo->requireExplicitLockedMemory(true);
}
}
return this->makeResidentWithinOsContext(osContext, gfxAllocations, false, false);
return this->makeResidentWithinOsContext(osContext, gfxAllocations, false);
}
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) {

View File

@@ -19,8 +19,8 @@ class DrmMemoryOperationsHandlerDefault : public DrmMemoryOperationsHandler {
DrmMemoryOperationsHandlerDefault(const RootDeviceEnvironment &rootDeviceEnvironment, uint32_t rootDeviceIndex) : DrmMemoryOperationsHandlerDefault(rootDeviceIndex) {}
~DrmMemoryOperationsHandlerDefault() override;
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override;
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override;
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override;
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override;

View File

@@ -36,13 +36,13 @@ class DrmMemoryOperationsHandlerWithAubDump : public BaseOperationsHandler {
~DrmMemoryOperationsHandlerWithAubDump() override = default;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override {
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, isDummyExecNeeded, forcePagingFence);
return BaseOperationsHandler::makeResident(device, gfxAllocations, isDummyExecNeeded, forcePagingFence);
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override {
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, isDummyExecNeeded);
return BaseOperationsHandler::makeResident(device, gfxAllocations, isDummyExecNeeded);
}
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override {
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, false, false);
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, false);
return BaseOperationsHandler::lock(device, gfxAllocations);
}
@@ -61,9 +61,9 @@ class DrmMemoryOperationsHandlerWithAubDump : public BaseOperationsHandler {
return BaseOperationsHandler::isResident(device, gfxAllocation);
}
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override {
aubMemoryOperationsHandler->makeResidentWithinOsContext(osContext, gfxAllocations, evictable, forcePagingFence);
return BaseOperationsHandler::makeResidentWithinOsContext(osContext, gfxAllocations, evictable, forcePagingFence);
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
aubMemoryOperationsHandler->makeResidentWithinOsContext(osContext, gfxAllocations, evictable);
return BaseOperationsHandler::makeResidentWithinOsContext(osContext, gfxAllocations, evictable);
}
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override {

View File

@@ -1282,15 +1282,6 @@ void Drm::waitForBind(uint32_t vmHandleId) {
waitUserFence(0u, fenceAddress, fenceValue, ValueWidth::u64, -1, ioctlHelper->getWaitUserFenceSoftFlag(), false, NEO::InterruptId::notUsed, nullptr);
}
void Drm::waitForBindGivenFenceVal(uint32_t vmHandleId, uint64_t fenceValToWait) {
if (*ioctlHelper->getPagingFenceAddress(vmHandleId, nullptr) >= fenceValToWait) {
return;
}
auto fenceAddress = castToUint64(ioctlHelper->getPagingFenceAddress(vmHandleId, nullptr));
waitUserFence(0u, fenceAddress, fenceValToWait, ValueWidth::u64, -1, ioctlHelper->getWaitUserFenceSoftFlag(), false, NEO::InterruptId::notUsed, nullptr);
}
bool Drm::isSetPairAvailable() {
if (debugManager.flags.EnableSetPair.get() == 1) {
std::call_once(checkSetPairOnce, [this]() {
@@ -1419,7 +1410,7 @@ void programUserFence(Drm *drm, OsContext *osContext, BufferObject *bo, VmBindEx
ioctlHelper->fillVmBindExtUserFence(vmBindExtUserFence, address, value, nextExtension);
}
int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, bool bind, const bool forcePagingFence) {
int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, bool bind) {
auto vmId = drm->getVirtualMemoryAddressSpace(vmHandleId);
auto ioctlHelper = drm->getIoctlHelper();
@@ -1431,9 +1422,6 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
vmId = osContextLinux->getDrmVmIds()[vmHandleId];
}
// Use only when debugger is disabled
const bool guaranteePagingFence = forcePagingFence && !drm->getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled();
std::unique_ptr<uint8_t[]> extensions;
if (bind) {
bool allowUUIDsForDebug = !osContext->isInternalEngine() && !EngineHelpers::isBcs(osContext->getEngineType());
@@ -1445,7 +1433,7 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
bool bindMakeResident = false;
bool readOnlyResource = bo->isReadOnlyGpuResource();
if (drm->useVMBindImmediate() || guaranteePagingFence) {
if (drm->useVMBindImmediate()) {
bindMakeResident = bo->isExplicitResidencyRequired();
bindImmediate = true;
}
@@ -1495,12 +1483,11 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
}
std::unique_lock<std::mutex> lock;
VmBindExtUserFenceT vmBindExtUserFence{};
bool incrementFenceValue = false;
if (ioctlHelper->isWaitBeforeBindRequired(bind)) {
if (drm->useVMBindImmediate() || guaranteePagingFence) {
if (drm->useVMBindImmediate()) {
lock = drm->lockBindFenceMutex();
auto nextExtension = vmBind.extensions;
incrementFenceValue = true;
@@ -1508,7 +1495,6 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
ioctlHelper->setVmBindUserFence(vmBind, vmBindExtUserFence);
}
}
if (bind) {
ret = ioctlHelper->vmBind(vmBind);
if (ret) {
@@ -1523,46 +1509,38 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
break;
}
}
bool waitOnUserFenceAfterBindAndUnbind = false;
if (debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.get() != -1) {
waitOnUserFenceAfterBindAndUnbind = !!debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.get();
}
if (ioctlHelper->isWaitBeforeBindRequired(bind) && waitOnUserFenceAfterBindAndUnbind && drm->useVMBindImmediate()) {
auto osContextLinux = static_cast<OsContextLinux *>(osContext);
osContextLinux->waitForPagingFence();
}
if (incrementFenceValue) {
uint64_t fenceValToWait = 0;
if (drm->isPerContextVMRequired()) {
auto osContextLinux = static_cast<OsContextLinux *>(osContext);
fenceValToWait = osContextLinux->getNextFenceVal(vmHandleId);
osContextLinux->incFenceVal(vmHandleId);
} else {
fenceValToWait = drm->getNextFenceVal(vmHandleId);
drm->incFenceVal(vmHandleId);
}
lock.unlock();
bool waitOnUserFenceAfterBindAndUnbind = false;
if (debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.get() != -1) {
waitOnUserFenceAfterBindAndUnbind = !!debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.get();
}
if ((ioctlHelper->isWaitBeforeBindRequired(bind) && waitOnUserFenceAfterBindAndUnbind && drm->useVMBindImmediate()) || guaranteePagingFence) {
auto osContextLinux = static_cast<OsContextLinux *>(osContext);
osContextLinux->waitForPagingFenceGivenFenceVal(fenceValToWait);
}
}
}
return ret;
}
int Drm::bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, const bool forcePagingFence) {
auto ret = changeBufferObjectBinding(this, osContext, vmHandleId, bo, true, forcePagingFence);
int Drm::bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) {
auto ret = changeBufferObjectBinding(this, osContext, vmHandleId, bo, true);
if (ret != 0) {
static_cast<DrmMemoryOperationsHandlerBind *>(this->rootDeviceEnvironment.memoryOperationsInterface.get())->evictUnusedAllocations(false, false);
ret = changeBufferObjectBinding(this, osContext, vmHandleId, bo, true, forcePagingFence);
ret = changeBufferObjectBinding(this, osContext, vmHandleId, bo, true);
}
return ret;
}
int Drm::unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) {
return changeBufferObjectBinding(this, osContext, vmHandleId, bo, false, false);
return changeBufferObjectBinding(this, osContext, vmHandleId, bo, false);
}
int Drm::createDrmVirtualMemory(uint32_t &drmVmId) {

View File

@@ -121,7 +121,7 @@ class Drm : public DriverModel {
bool createVirtualMemoryAddressSpace(uint32_t vmCount);
void destroyVirtualMemoryAddressSpace();
uint32_t getVirtualMemoryAddressSpace(uint32_t vmId) const;
MOCKABLE_VIRTUAL int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, const bool forcePagingFence);
MOCKABLE_VIRTUAL int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo);
MOCKABLE_VIRTUAL int unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo);
int setupHardwareInfo(const DeviceDescriptor *, bool);
void setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo);
@@ -218,7 +218,6 @@ class Drm : public DriverModel {
std::string getDeviceNode() { return hwDeviceId->getDeviceNode(); }
void waitForBind(uint32_t vmHandleId);
void waitForBindGivenFenceVal(uint32_t vmHandleId, uint64_t fenceValToWait);
uint64_t getNextFenceVal(uint32_t vmHandleId) { return fenceVal[vmHandleId] + 1; }
void incFenceVal(uint32_t vmHandleId) { fenceVal[vmHandleId]++; }
uint64_t *getFenceAddr(uint32_t vmHandleId) { return &pagingFence[vmHandleId]; }

View File

@@ -124,28 +124,6 @@ void OsContextLinux::waitForBind(uint32_t drmIterator) {
}
}
void OsContextLinux::waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) {
for (auto drmIterator = 0u; drmIterator < this->deviceBitfield.size(); drmIterator++) {
if (this->deviceBitfield.test(drmIterator)) {
this->waitForBindGivenFenceVal(drmIterator, fenceValToWait);
}
}
}
void OsContextLinux::waitForBindGivenFenceVal(uint32_t drmIterator, uint64_t fenceValToWait) {
if (drm.isPerContextVMRequired()) {
if (pagingFence[drmIterator] >= fenceValToWait) {
return;
}
auto fenceAddress = castToUint64(&this->pagingFence[drmIterator]);
drm.waitUserFence(0u, fenceAddress, fenceValToWait, Drm::ValueWidth::u64, -1, drm.getIoctlHelper()->getWaitUserFenceSoftFlag(), false, NEO::InterruptId::notUsed, nullptr);
} else {
drm.waitForBindGivenFenceVal(drmIterator, fenceValToWait);
}
}
void OsContextLinux::reInitializeContext() {}
uint64_t OsContextLinux::getOfflineDumpContextId(uint32_t deviceIndex) const {

View File

@@ -30,7 +30,6 @@ class OsContextLinux : public OsContext {
bool isDirectSubmissionSupported() const override;
Drm &getDrm() const;
virtual void waitForPagingFence();
virtual void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait);
static OsContext *create(OSInterface *osInterface, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor);
void reInitializeContext() override;
void setHangDetected() {
@@ -46,7 +45,6 @@ class OsContextLinux : public OsContext {
void incFenceVal(uint32_t deviceIndex) { fenceVal[deviceIndex]++; }
uint64_t *getFenceAddr(uint32_t deviceIndex) { return &pagingFence[deviceIndex]; }
void waitForBind(uint32_t drmIterator);
void waitForBindGivenFenceVal(uint32_t drmIterator, uint64_t fenceValToWait);
protected:
bool initializeContext(bool allocateInterrupt) override;

View File

@@ -20,7 +20,7 @@ WddmMemoryOperationsHandler::WddmMemoryOperationsHandler(Wddm *wddm) : wddm(wddm
WddmMemoryOperationsHandler::~WddmMemoryOperationsHandler() = default;
MemoryOperationsStatus WddmMemoryOperationsHandler::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) {
MemoryOperationsStatus WddmMemoryOperationsHandler::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) {
uint32_t totalHandlesCount = 0;
constexpr uint32_t stackAllocations = 64;
constexpr uint32_t stackHandlesCount = NEO::maxFragmentsCount * EngineLimits::maxHandleCount * stackAllocations;
@@ -45,7 +45,7 @@ MemoryOperationsStatus WddmMemoryOperationsHandler::makeResident(Device *device,
totalHandlesCount += wddmAllocation->getNumGmms();
}
}
return residentAllocations->makeResidentResources(handlesForResidency.begin(), totalHandlesCount, totalSize, forcePagingFence);
return residentAllocations->makeResidentResources(handlesForResidency.begin(), totalHandlesCount, totalSize);
}
MemoryOperationsStatus WddmMemoryOperationsHandler::evict(Device *device, GraphicsAllocation &gfxAllocation) {

View File

@@ -23,15 +23,15 @@ class WddmMemoryOperationsHandler : public MemoryOperationsHandler {
static std::unique_ptr<WddmMemoryOperationsHandler> create(Wddm *wddm, RootDeviceEnvironment *rootDeviceEnvironment, bool withAubDump);
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override;
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override;
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override;
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override {
return MemoryOperationsStatus::unsupported;
}
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override {
return makeResident(nullptr, gfxAllocations, false, forcePagingFence);
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
return makeResident(nullptr, gfxAllocations, false);
}
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override {
return evict(nullptr, gfxAllocation);

View File

@@ -36,9 +36,9 @@ class WddmMemoryOperationsHandlerWithAubDump : public BaseOperationsHandler {
~WddmMemoryOperationsHandlerWithAubDump() override = default;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override {
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, isDummyExecNeeded, forcePagingFence);
return BaseOperationsHandler::makeResident(device, gfxAllocations, isDummyExecNeeded, forcePagingFence);
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override {
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, isDummyExecNeeded);
return BaseOperationsHandler::makeResident(device, gfxAllocations, isDummyExecNeeded);
}
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override {
@@ -56,9 +56,9 @@ class WddmMemoryOperationsHandlerWithAubDump : public BaseOperationsHandler {
return BaseOperationsHandler::isResident(device, gfxAllocation);
}
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override {
aubMemoryOperationsHandler->makeResidentWithinOsContext(osContext, gfxAllocations, evictable, forcePagingFence);
return BaseOperationsHandler::makeResidentWithinOsContext(osContext, gfxAllocations, evictable, forcePagingFence);
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
aubMemoryOperationsHandler->makeResidentWithinOsContext(osContext, gfxAllocations, evictable);
return BaseOperationsHandler::makeResidentWithinOsContext(osContext, gfxAllocations, evictable);
}
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override {

View File

@@ -61,10 +61,10 @@ MemoryOperationsStatus WddmResidentAllocationsContainer::evictResources(const D3
}
MemoryOperationsStatus WddmResidentAllocationsContainer::makeResidentResource(const D3DKMT_HANDLE &handle, size_t size) {
return makeResidentResources(&handle, 1u, size, false);
return makeResidentResources(&handle, 1u, size);
}
MemoryOperationsStatus WddmResidentAllocationsContainer::makeResidentResources(const D3DKMT_HANDLE *handles, const uint32_t count, size_t size, const bool forcePagingFence) {
MemoryOperationsStatus WddmResidentAllocationsContainer::makeResidentResources(const D3DKMT_HANDLE *handles, const uint32_t count, size_t size) {
while (!wddm->makeResident(handles, count, false, nullptr, size)) {
if (evictAllResources() == MemoryOperationsStatus::success) {
continue;
@@ -80,7 +80,7 @@ MemoryOperationsStatus WddmResidentAllocationsContainer::makeResidentResources(c
resourceHandles.push_back(handles[i]);
}
lock.unlock();
wddm->waitOnPagingFenceFromCpu(forcePagingFence);
wddm->waitOnPagingFenceFromCpu(false);
return MemoryOperationsStatus::success;
}

View File

@@ -26,7 +26,7 @@ class WddmResidentAllocationsContainer {
MOCKABLE_VIRTUAL MemoryOperationsStatus evictResource(const D3DKMT_HANDLE &handle);
MemoryOperationsStatus evictResources(const D3DKMT_HANDLE *handles, const uint32_t count);
MOCKABLE_VIRTUAL MemoryOperationsStatus makeResidentResource(const D3DKMT_HANDLE &handle, size_t size);
MemoryOperationsStatus makeResidentResources(const D3DKMT_HANDLE *handles, const uint32_t count, size_t size, const bool forcePagingFence);
MemoryOperationsStatus makeResidentResources(const D3DKMT_HANDLE *handles, const uint32_t count, size_t size);
MOCKABLE_VIRTUAL void removeResource(const D3DKMT_HANDLE &handle);
protected:

View File

@@ -88,9 +88,9 @@ class MockDrmAllocation : public DrmAllocation {
DrmAllocation::markForCapture();
}
int bindBOs(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence) override {
int bindBOs(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind) override {
bindBOsCalled = true;
DrmAllocation::bindBOs(osContext, vmHandleId, bufferObjects, bind, forcePagingFence);
DrmAllocation::bindBOs(osContext, vmHandleId, bufferObjects, bind);
return bindBOsRetValue;
}
@@ -101,7 +101,7 @@ class MockDrmAllocation : public DrmAllocation {
return DrmAllocation::prefetchBO(bo, vmHandleId, subDeviceId);
}
ADDMETHOD_NOBASE(makeBOsResident, int, 0, (OsContext * osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence));
ADDMETHOD_NOBASE(makeBOsResident, int, 0, (OsContext * osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind));
bool registerBOBindExtHandleCalled = false;
bool markedForCapture = false;

View File

@@ -21,9 +21,9 @@ struct MockAubMemoryOperationsHandler : public AubMemoryOperationsHandler {
using AubMemoryOperationsHandler::getMemoryBanksBitfield;
using AubMemoryOperationsHandler::residentAllocations;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override {
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override {
makeResidentCalled = true;
return AubMemoryOperationsHandler::makeResident(device, gfxAllocations, isDummyExecNeeded, forcePagingFence);
return AubMemoryOperationsHandler::makeResident(device, gfxAllocations, isDummyExecNeeded);
}
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override {
@@ -36,9 +36,9 @@ struct MockAubMemoryOperationsHandler : public AubMemoryOperationsHandler {
return AubMemoryOperationsHandler::isResident(device, gfxAllocation);
}
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override {
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
makeResidentWithinOsContextCalled = true;
return AubMemoryOperationsHandler::makeResidentWithinOsContext(osContext, gfxAllocations, evictable, forcePagingFence);
return AubMemoryOperationsHandler::makeResidentWithinOsContext(osContext, gfxAllocations, evictable);
}
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override {

View File

@@ -20,22 +20,22 @@ class GraphicsAllocation;
class MockMemoryOperationsHandler : public MemoryOperationsHandler {
public:
MockMemoryOperationsHandler() {}
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override { return MemoryOperationsStatus::unsupported; }
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override { return MemoryOperationsStatus::unsupported; }
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override { return MemoryOperationsStatus::unsupported; }
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override { return MemoryOperationsStatus::unsupported; }
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override { return MemoryOperationsStatus::unsupported; }
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override { return MemoryOperationsStatus::unsupported; }
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override { return MemoryOperationsStatus::unsupported; }
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override { return MemoryOperationsStatus::unsupported; }
};
class MockMemoryOperationsHandlerTests : public MemoryOperationsHandler {
public:
MockMemoryOperationsHandlerTests() {}
ADDMETHOD_NOBASE(makeResident, MemoryOperationsStatus, MemoryOperationsStatus::unsupported, (Device * device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence));
ADDMETHOD_NOBASE(makeResident, MemoryOperationsStatus, MemoryOperationsStatus::unsupported, (Device * device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded));
ADDMETHOD_NOBASE(lock, MemoryOperationsStatus, MemoryOperationsStatus::unsupported, (Device * device, ArrayRef<GraphicsAllocation *> gfxAllocations));
ADDMETHOD_NOBASE(evict, MemoryOperationsStatus, MemoryOperationsStatus::unsupported, (Device * device, GraphicsAllocation &gfxAllocation));
ADDMETHOD_NOBASE(isResident, MemoryOperationsStatus, MemoryOperationsStatus::unsupported, (Device * device, GraphicsAllocation &gfxAllocation));
ADDMETHOD_NOBASE(makeResidentWithinOsContext, MemoryOperationsStatus, MemoryOperationsStatus::unsupported, (OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence));
ADDMETHOD_NOBASE(makeResidentWithinOsContext, MemoryOperationsStatus, MemoryOperationsStatus::unsupported, (OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable));
ADDMETHOD_NOBASE(evictWithinOsContext, MemoryOperationsStatus, MemoryOperationsStatus::unsupported, (OsContext * osContext, GraphicsAllocation &gfxAllocation));
};
@@ -43,7 +43,7 @@ class MockMemoryOperations : public MemoryOperationsHandler {
public:
MockMemoryOperations() {}
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override {
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override {
makeResidentCalledCount++;
if (captureGfxAllocationsForMakeResident) {
for (auto &gfxAllocation : gfxAllocations) {
@@ -85,7 +85,7 @@ class MockMemoryOperations : public MemoryOperationsHandler {
return MemoryOperationsStatus::success;
}
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override {
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
makeResidentCalledCount++;
if (osContext) {
makeResidentContextId = osContext->getContextId();

View File

@@ -157,7 +157,7 @@ class DrmCommandStreamEnhancedTemplate : public ::testing::Test {
template <typename GfxFamily>
void makeResidentBufferObjects(OsContext *osContext, DrmAllocation *drmAllocation) {
drmAllocation->bindBOs(osContext, 0u, &static_cast<TestedDrmCommandStreamReceiver<GfxFamily> *>(csr)->residency, false, false);
drmAllocation->bindBOs(osContext, 0u, &static_cast<TestedDrmCommandStreamReceiver<GfxFamily> *>(csr)->residency, false);
}
template <typename GfxFamily>
@@ -237,7 +237,7 @@ class DrmCommandStreamEnhancedWithFailingExecTemplate : public ::testing::Test {
template <typename GfxFamily>
void makeResidentBufferObjects(OsContext *osContext, DrmAllocation *drmAllocation) {
drmAllocation->bindBOs(osContext, 0u, &static_cast<TestedDrmCommandStreamReceiver<GfxFamily> *>(csr)->residency, false, false);
drmAllocation->bindBOs(osContext, 0u, &static_cast<TestedDrmCommandStreamReceiver<GfxFamily> *>(csr)->residency, false);
}
template <typename GfxFamily>

View File

@@ -363,7 +363,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrAndResidentAllocationWhenProc
MockGraphicsAllocation allocation2(reinterpret_cast<void *>(0x5000), 0x5000, 0x1000);
GraphicsAllocation *allocPtr = &allocation2;
memoryOperationsHandler->makeResident(pDevice, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
memoryOperationsHandler->makeResident(pDevice, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_TRUE(mockManager->writeMemory2Called);
mockManager->storeAllocationParams = true;

View File

@@ -379,7 +379,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrAndResidentAllocationWhenProcessR
MockGraphicsAllocation allocation2(reinterpret_cast<void *>(0x5000), 0x5000, 0x1000);
GraphicsAllocation *allocPtr = &allocation2;
memoryOperationsHandler->makeResident(pDevice, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
memoryOperationsHandler->makeResident(pDevice, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_TRUE(mockManager->writeMemory2Called);
mockManager->storeAllocationParams = true;

View File

@@ -3313,7 +3313,7 @@ TEST(MemoryManagerTest, givenMemoryAllocationWhenFreedThenFreeCalledOnMemoryOper
auto memoryAllocation = memoryManager.allocateGraphicsMemoryWithProperties(allocationProperties);
EXPECT_NE(nullptr, memoryAllocation);
memoryOperationsHandler->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&memoryAllocation, 1), false, false);
memoryOperationsHandler->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&memoryAllocation, 1), false);
EXPECT_EQ(1u, memoryOperationsHandler->residentAllocations.size());

View File

@@ -23,7 +23,7 @@
TEST_F(AubMemoryOperationsHandlerTests, givenNullPtrAsAubManagerWhenMakeResidentCalledThenFalseReturned) {
getMemoryOperationsHandler()->setAubManager(nullptr);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::deviceUninitialized);
}
@@ -31,7 +31,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledThe
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager.writeMemory2Called);
@@ -41,7 +41,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledThe
aubManager.writeMemory2Called = false;
result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager.writeMemory2Called);
@@ -80,7 +80,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerAndAllocationOfOneTimeAub
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager.writeMemory2Called);
@@ -90,7 +90,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerAndAllocationOfOneTimeAub
aubManager.writeMemory2Called = false;
result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_FALSE(aubManager.writeMemory2Called);
@@ -106,7 +106,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledOnW
allocPtr->setWriteMemoryOnly(true);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager.writeMemory2Called);
@@ -115,7 +115,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledOnW
EXPECT_EQ(0u, memoryOperationsInterface->residentAllocations.size());
aubManager.writeMemory2Called = false;
result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager.writeMemory2Called);
@@ -140,7 +140,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerAndAllocationInLocalMemor
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_FALSE(aubManager.writeMemory2Called);
EXPECT_EQ(1u, csr->writeMemoryAubCalled);
@@ -163,7 +163,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledThe
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_EQ(1u, csr->initializeEngineCalled);
@@ -185,7 +185,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledWit
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_EQ(0u, csr->initializeEngineCalled);
@@ -204,7 +204,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledOnC
gmm.setCompressionEnabled(true);
allocPtr->setDefaultGmm(&gmm);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager.writeMemory2Called);
@@ -228,7 +228,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledOnU
gmm.setCompressionEnabled(false);
allocPtr->setDefaultGmm(&gmm);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager.writeMemory2Called);
@@ -241,7 +241,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAllocationWhenMakeResidentCalledThe
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(aubManager.hintToWriteMemory, AubMemDump::DataTypeHintValues::TraceNotype);
}
TEST_F(AubMemoryOperationsHandlerTests, givenNonResidentAllocationWhenIsResidentCalledThenFalseReturned) {
@@ -255,7 +255,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenResidentAllocationWhenIsResidentCal
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
auto result = memoryOperationsInterface->isResident(nullptr, allocation);
EXPECT_EQ(result, MemoryOperationsStatus::success);
}
@@ -270,7 +270,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenResidentAllocationWhenEvictCalledTh
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
auto result = memoryOperationsInterface->evict(nullptr, allocation);
EXPECT_EQ(result, MemoryOperationsStatus::success);
}
@@ -320,7 +320,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenNonLocalMemoryAllocationWithStorage
auto memoryOperationsInterface = getMemoryOperationsHandler();
allocPtr = &allocation;
memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_TRUE(aubManager.writeMemory2Called);
EXPECT_EQ(0u, aubManager.storedAllocationParams[0].memoryBanks);
@@ -510,7 +510,7 @@ HWTEST_F(AubMemoryOperationsHandlerTests, givenCloningOfPageTablesWhenProcessing
allocPtr->storageInfo.cloningOfPageTables = true;
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager->writeMemory2Called);
@@ -540,7 +540,7 @@ HWTEST_F(AubMemoryOperationsHandlerTests, givenNonLocalGfxAllocationWriteableWhe
allocPtr = &allocation;
allocPtr->storageInfo.cloningOfPageTables = false;
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager->writeMemory2Called);
@@ -575,7 +575,7 @@ HWTEST_F(AubMemoryOperationsHandlerTests, givenLocalGfxAllocationWriteableWhenPr
auto backupDefaultCsr = std::make_unique<VariableBackup<NEO::CommandStreamReceiver *>>(&device->getDefaultEngine().commandStreamReceiver);
device->getDefaultEngine().commandStreamReceiver = csr.get();
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_FALSE(aubManager->writeMemory2Called);
@@ -611,7 +611,7 @@ HWTEST_F(AubMemoryOperationsHandlerTests, givenGfxAllocationWriteableWithGmmPres
executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(mockAubCenter.release());
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
aubManager->writeMemory2Called = false;
@@ -644,7 +644,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenDeviceNullWhenProcessingFlushReside
memoryOperationsInterface->setAubWritable(true, allocation, device.get());
EXPECT_TRUE(memoryOperationsInterface->isAubWritable(allocation, device.get()));
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
auto result = memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(result, MemoryOperationsStatus::success);
EXPECT_TRUE(aubManager.writeMemory2Called);

View File

@@ -55,45 +55,6 @@ TEST(DrmBindTest, givenBindNotCompleteWhenWaitForBindThenWaitUserFenceIoctlIsCal
EXPECT_EQ(-1, drm.waitUserFenceParams[0].timeout);
}
TEST(DrmBindTest, givenBindAlreadyCompleteWhenwaitForBindGivenFenceValThenWaitUserFenceIoctlIsNotCalled) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
drm.pagingFence[0] = 31u;
uint64_t fenceValToWait = 31u;
drm.waitForBindGivenFenceVal(0u, fenceValToWait);
EXPECT_EQ(0u, drm.waitUserFenceParams.size());
drm.pagingFence[0] = 49u;
drm.waitForBindGivenFenceVal(0u, fenceValToWait);
EXPECT_EQ(0u, drm.waitUserFenceParams.size());
}
TEST(DrmBindTest, givenBindNotCompleteWhenwaitForBindGivenFenceValThenWaitUserFenceIoctlIsCalled) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
drm.pagingFence[0] = 26u;
uint64_t fenceValToWait = 31u;
drm.waitForBindGivenFenceVal(0u, fenceValToWait);
EXPECT_EQ(1u, drm.waitUserFenceParams.size());
EXPECT_EQ(0u, drm.waitUserFenceParams[0].ctxId);
EXPECT_EQ(castToUint64(&drm.pagingFence[0]), drm.waitUserFenceParams[0].address);
EXPECT_EQ(drm.ioctlHelper->getWaitUserFenceSoftFlag(), drm.waitUserFenceParams[0].flags);
EXPECT_EQ(fenceValToWait, drm.waitUserFenceParams[0].value);
EXPECT_EQ(-1, drm.waitUserFenceParams[0].timeout);
}
TEST(DrmBindTest, whenCheckingVmBindAvailabilityThenIoctlHelperSupportIsUsed) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};

View File

@@ -450,7 +450,7 @@ TEST(DrmBufferObject, givenPerContextVmRequiredWhenBoBoundAndUnboundThenCorrectB
auto osContext = engines[contextId].osContext;
osContext->ensureContextInitialized(false);
bo.bind(osContext, 0, false);
bo.bind(osContext, 0);
EXPECT_TRUE(bo.bindInfo[contextId][0]);
bo.unbind(osContext, 0);
@@ -461,7 +461,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindSucceedsThenPr
struct DrmMockToSucceedBindBufferObject : public DrmMock {
DrmMockToSucceedBindBufferObject(RootDeviceEnvironment &rootDeviceEnvironment)
: DrmMock(rootDeviceEnvironment) {}
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, const bool forcePagingFence) override { return 0; }
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) override { return 0; }
int unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) override { return 0; }
};
@@ -496,7 +496,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindSucceedsThenPr
testing::internal::CaptureStdout();
bo.bind(osContext, 0, false);
bo.bind(osContext, 0);
EXPECT_TRUE(bo.bindInfo[contextId][0]);
std::string bindOutput = testing::internal::GetCapturedStdout();
@@ -518,7 +518,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindFailsThenPrint
struct DrmMockToFailBindBufferObject : public DrmMock {
DrmMockToFailBindBufferObject(RootDeviceEnvironment &rootDeviceEnvironment)
: DrmMock(rootDeviceEnvironment) {}
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, const bool forcePagingFence) override { return -1; }
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) override { return -1; }
int unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) override { return -1; }
int getErrno() override { return EINVAL; }
};
@@ -554,7 +554,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindFailsThenPrint
testing::internal::CaptureStderr();
bo.bind(osContext, 0, false);
bo.bind(osContext, 0);
EXPECT_FALSE(bo.bindInfo[contextId][0]);
std::string bindOutput = testing::internal::GetCapturedStderr();
@@ -600,7 +600,7 @@ TEST(DrmBufferObject, givenDrmWhenBindOperationFailsThenFenceValueNotGrow) {
auto contextId = osContextCount / 2;
auto osContext = engines[contextId].osContext;
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
drm->bindBufferObject(osContext, 0, &bo, false);
drm->bindBufferObject(osContext, 0, &bo);
EXPECT_EQ(drm->fenceVal[0], initFenceValue);
}
@@ -631,299 +631,11 @@ TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsThenFenceValueGrow) {
auto contextId = osContextCount / 2;
auto osContext = engines[contextId].osContext;
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
drm->bindBufferObject(osContext, 0, &bo, false);
drm->bindBufferObject(osContext, 0, &bo);
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
}
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceThenFenceValueGrow) {
DebugManagerStateRestore restorer;
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(1);
class MockOsContextLinuxUnbind : public OsContextLinux {
public:
using OsContextLinux::drmContextIds;
using OsContextLinux::fenceVal;
using OsContextLinux::pagingFence;
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
waitForPagingFenceGivenFenceValCalled = true;
}
bool waitForPagingFenceGivenFenceValCalled = false;
};
auto executionEnvironment = new ExecutionEnvironment;
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drm->requirePerContextVM = false;
drm->isVMBindImmediateSupported = true;
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
ioctlHelper->isWaitBeforeBindRequiredResult = true;
drm->ioctlHelper.reset(ioctlHelper.release());
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext->ensureContextInitialized(false);
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
// Make sure to disable the debugging mode
executionEnvironment->setDebuggingMode(DebuggingMode::disabled);
uint64_t initFenceValue = 10u;
drm->fenceVal[0] = initFenceValue;
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
auto osContextCount = engines.size();
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
drm->bindBufferObject(osContext, 0, &bo, true);
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
delete osContext;
}
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceNotWaitOnUserFenceAfterBindAndUnbindThenFenceValueGrow) {
DebugManagerStateRestore restorer;
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(0);
class MockOsContextLinuxUnbind : public OsContextLinux {
public:
using OsContextLinux::drmContextIds;
using OsContextLinux::fenceVal;
using OsContextLinux::pagingFence;
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
waitForPagingFenceGivenFenceValCalled = true;
}
bool waitForPagingFenceGivenFenceValCalled = false;
};
auto executionEnvironment = new ExecutionEnvironment;
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drm->requirePerContextVM = false;
drm->isVMBindImmediateSupported = true;
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
ioctlHelper->isWaitBeforeBindRequiredResult = true;
drm->ioctlHelper.reset(ioctlHelper.release());
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext->ensureContextInitialized(false);
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
// Make sure to disable the debugging mode
executionEnvironment->setDebuggingMode(DebuggingMode::disabled);
uint64_t initFenceValue = 10u;
drm->fenceVal[0] = initFenceValue;
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
auto osContextCount = engines.size();
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
drm->bindBufferObject(osContext, 0, &bo, true);
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
delete osContext;
}
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceWithWaitOnUserFenceAfterBindAndUnbindAndNotUseVMBindImmediateThenFenceValueGrow) {
DebugManagerStateRestore restorer;
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(1);
class MockOsContextLinuxUnbind : public OsContextLinux {
public:
using OsContextLinux::drmContextIds;
using OsContextLinux::fenceVal;
using OsContextLinux::pagingFence;
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
waitForPagingFenceGivenFenceValCalled = true;
}
bool waitForPagingFenceGivenFenceValCalled = false;
};
auto executionEnvironment = new ExecutionEnvironment;
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drm->requirePerContextVM = false;
// Making the useVMBindImmediate() false
drm->isVMBindImmediateSupported = false;
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
ioctlHelper->isWaitBeforeBindRequiredResult = true;
drm->ioctlHelper.reset(ioctlHelper.release());
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext->ensureContextInitialized(false);
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
// Make sure to disable the debugging mode
executionEnvironment->setDebuggingMode(DebuggingMode::disabled);
uint64_t initFenceValue = 10u;
drm->fenceVal[0] = initFenceValue;
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
auto osContextCount = engines.size();
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
drm->bindBufferObject(osContext, 0, &bo, true);
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
delete osContext;
}
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceWithDebuggingEnabledWithWaitOnUserFenceAfterBindAndUnbindAndNotUseVMBindImmediateThenFenceValueDoesNotGrow) {
DebugManagerStateRestore restorer;
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(1);
class MockOsContextLinuxUnbind : public OsContextLinux {
public:
using OsContextLinux::drmContextIds;
using OsContextLinux::fenceVal;
using OsContextLinux::pagingFence;
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
waitForPagingFenceGivenFenceValCalled = true;
}
bool waitForPagingFenceGivenFenceValCalled = false;
};
auto executionEnvironment = new ExecutionEnvironment;
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drm->requirePerContextVM = false;
// Making the useVMBindImmediate() false
drm->isVMBindImmediateSupported = false;
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
ioctlHelper->isWaitBeforeBindRequiredResult = true;
drm->ioctlHelper.reset(ioctlHelper.release());
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext->ensureContextInitialized(false);
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
// Make sure to enable the debugging mode
executionEnvironment->setDebuggingMode(DebuggingMode::online);
uint64_t initFenceValue = 10u;
drm->fenceVal[0] = initFenceValue;
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
auto osContextCount = engines.size();
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
drm->bindBufferObject(osContext, 0, &bo, true);
EXPECT_EQ(drm->fenceVal[0], initFenceValue);
EXPECT_FALSE(osContext->waitForPagingFenceGivenFenceValCalled);
delete osContext;
}
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceNotWaitOnUserFenceAfterBindAndUnbindAndNotUseVMBindImmediateThenFenceValueGrow) {
DebugManagerStateRestore restorer;
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(0);
class MockOsContextLinuxUnbind : public OsContextLinux {
public:
using OsContextLinux::drmContextIds;
using OsContextLinux::fenceVal;
using OsContextLinux::pagingFence;
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
waitForPagingFenceGivenFenceValCalled = true;
}
bool waitForPagingFenceGivenFenceValCalled = false;
};
auto executionEnvironment = new ExecutionEnvironment;
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drm->requirePerContextVM = false;
// Making the useVMBindImmediate() false
drm->isVMBindImmediateSupported = false;
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
ioctlHelper->isWaitBeforeBindRequiredResult = true;
drm->ioctlHelper.reset(ioctlHelper.release());
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext->ensureContextInitialized(false);
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
// Make sure to disable the debugging mode
executionEnvironment->setDebuggingMode(DebuggingMode::disabled);
uint64_t initFenceValue = 10u;
drm->fenceVal[0] = initFenceValue;
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
auto osContextCount = engines.size();
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
drm->bindBufferObject(osContext, 0, &bo, true);
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
delete osContext;
}
TEST(DrmBufferObject, givenDrmWhenUnBindOperationFailsThenFenceValueNotGrow) {
auto executionEnvironment = new ExecutionEnvironment;
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
@@ -1036,11 +748,11 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsAndForceFenceWaitThenFe
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
waitForPagingFenceGivenFenceValCalled = true;
void waitForPagingFence() override {
waitForPagingFenceCalled = true;
}
bool waitForPagingFenceGivenFenceValCalled = false;
bool waitForPagingFenceCalled = false;
};
auto executionEnvironment = new ExecutionEnvironment;
@@ -1073,7 +785,7 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsAndForceFenceWaitThenFe
drm->unbindBufferObject(static_cast<OsContext *>(osContext), 0, &bo);
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
EXPECT_TRUE(osContext->waitForPagingFenceCalled);
delete osContext;
}
@@ -1091,11 +803,11 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsWaitBeforeBindFalseAndF
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
waitForPagingFenceGivenFenceValCalled = true;
void waitForPagingFence() override {
waitForPagingFenceCalled = true;
}
bool waitForPagingFenceGivenFenceValCalled = false;
bool waitForPagingFenceCalled = false;
};
auto executionEnvironment = new ExecutionEnvironment;
@@ -1128,7 +840,7 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsWaitBeforeBindFalseAndF
drm->unbindBufferObject(static_cast<OsContext *>(osContext), 0, &bo);
EXPECT_EQ(drm->fenceVal[0], initFenceValue);
EXPECT_FALSE(osContext->waitForPagingFenceGivenFenceValCalled);
EXPECT_FALSE(osContext->waitForPagingFenceCalled);
delete osContext;
}
@@ -1146,11 +858,11 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsWaitBeforeBindTrueAndFo
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
waitForPagingFenceGivenFenceValCalled = true;
void waitForPagingFence() override {
waitForPagingFenceCalled = true;
}
bool waitForPagingFenceGivenFenceValCalled = false;
bool waitForPagingFenceCalled = false;
};
auto executionEnvironment = new ExecutionEnvironment;
@@ -1183,7 +895,7 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsWaitBeforeBindTrueAndFo
drm->unbindBufferObject(static_cast<OsContext *>(osContext), 0, &bo);
EXPECT_EQ(drm->fenceVal[0], initFenceValue);
EXPECT_FALSE(osContext->waitForPagingFenceGivenFenceValCalled);
EXPECT_FALSE(osContext->waitForPagingFenceCalled);
delete osContext;
}

View File

@@ -835,7 +835,7 @@ struct MockDrmAllocationBindBO : public DrmAllocation {
}
ADDMETHOD_NOBASE(bindBO, int, 0,
(BufferObject * bo, OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence));
(BufferObject * bo, OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind));
};
struct MockDrmAllocationBindBOs : public DrmAllocation {
@@ -844,7 +844,7 @@ struct MockDrmAllocationBindBOs : public DrmAllocation {
}
ADDMETHOD_NOBASE(bindBOs, int, 0,
(OsContext * osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence));
(OsContext * osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind));
};
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOsFailsThenMakeBOsResidentReturnsError) {
@@ -855,7 +855,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOsFailsThenMakeBOsRes
auto allocation = new MockDrmAllocationBindBOs(0, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
allocation->bindBOsResult = -1;
auto res = allocation->makeBOsResident(&csr->getOsContext(), 0, nullptr, true, false);
auto res = allocation->makeBOsResident(&csr->getOsContext(), 0, nullptr, true);
EXPECT_NE(res, 0);
EXPECT_EQ(allocation->fragmentsStorage.fragmentCount, 0u);
EXPECT_GT(allocation->bindBOsCalled, 0u);
@@ -884,7 +884,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFragmentStorageAndBindBOFa
memcpy(&prevStorage, &allocation->fragmentsStorage, sizeof(OsHandleStorage));
memcpy(&allocation->fragmentsStorage, &storage, sizeof(OsHandleStorage));
auto res = allocation->makeBOsResident(&csr->getOsContext(), 0, nullptr, true, false);
auto res = allocation->makeBOsResident(&csr->getOsContext(), 0, nullptr, true);
EXPECT_NE(res, 0);
EXPECT_EQ(allocation->fragmentsStorage.fragmentCount, 1u);
EXPECT_GT(allocation->bindBOCalled, 0u);
@@ -902,7 +902,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOFailsThenBindBOsRetu
auto allocation = new MockDrmAllocationBindBO(0, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
allocation->bindBOResult = -1;
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false, false);
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false);
EXPECT_NE(res, 0);
EXPECT_GT(allocation->bindBOCalled, 0u);
@@ -920,7 +920,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOFailsWithMultipleMem
allocation->storageInfo.memoryBanks = 0b11;
EXPECT_EQ(allocation->storageInfo.getNumBanks(), 2u);
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false, false);
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false);
EXPECT_NE(res, 0);
EXPECT_GT(allocation->bindBOCalled, 0u);
@@ -939,7 +939,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOFailsWithMultipleMem
allocation->storageInfo.memoryBanks = 0b11;
EXPECT_EQ(allocation->storageInfo.getNumBanks(), 2u);
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false, false);
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false);
EXPECT_NE(res, 0);
EXPECT_GT(allocation->bindBOCalled, 0u);
@@ -1417,7 +1417,7 @@ struct MockMergeResidencyContainerMemoryOperationsHandler : public DrmMemoryOper
(OsContext * osContext, ResidencyContainer &residencyContainer));
ADDMETHOD_NOBASE(makeResidentWithinOsContext, NEO::MemoryOperationsStatus, NEO::MemoryOperationsStatus::success,
(OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence));
(OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable));
};
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMergeWithResidencyContainerFailsThenFlushReturnsError) {
@@ -1534,7 +1534,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocsInMemoryOperationHan
PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo)));
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
LinearStream cs(commandBuffer);
@@ -1558,7 +1558,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocInMemoryOperationsInt
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
csr->flush(batchBuffer, csr->getResidencyAllocations());

View File

@@ -678,7 +678,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenProcessResidencyFailingOnO
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
testedCsr->processResidencyCallBase = false;
@@ -700,7 +700,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenProcessResidencyFailingOnO
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
testedCsr->processResidencyCallBase = false;
@@ -722,7 +722,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingExecWhenFlushingThe
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
testedCsr->processResidencyCallBase = true;
@@ -1085,9 +1085,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenPrintBOsForSubmitWhenPrint
std::string output = testing::internal::GetCapturedStdout();
std::vector<BufferObject *> bos;
allocation1.makeBOsResident(&csr->getOsContext(), 0, &bos, true, false);
allocation2.makeBOsResident(&csr->getOsContext(), 0, &bos, true, false);
cmdBuffer.makeBOsResident(&csr->getOsContext(), 0, &bos, true, false);
allocation1.makeBOsResident(&csr->getOsContext(), 0, &bos, true);
allocation2.makeBOsResident(&csr->getOsContext(), 0, &bos, true);
cmdBuffer.makeBOsResident(&csr->getOsContext(), 0, &bos, true);
std::stringstream expected;
expected << "Buffer object for submit\n";

View File

@@ -351,7 +351,7 @@ TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinDefaultE
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
bo.bind(&osContext, 0, false);
bo.bind(&osContext, 0);
EXPECT_NE(0u, drm.context.receivedVmBind->extensions);
@@ -371,7 +371,7 @@ TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinInternal
OsContextLinux osContext(drm, 0, 0u, {{aub_stream::EngineType::ENGINE_RCS, EngineUsage::internal}, 1 /*deviceBitfield*/, PreemptionMode::Disabled, true /* isRootDevice*/});
osContext.ensureContextInitialized(false);
bo.bind(&osContext, 0, false);
bo.bind(&osContext, 0);
EXPECT_FALSE(drm.context.receivedVmBindUuidExt[0]);
}
@@ -387,7 +387,7 @@ TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinCopyEngi
OsContextLinux osContext(drm, 0, 0u, {{aub_stream::EngineType::ENGINE_BCS, EngineUsage::regular}, 1 /*deviceBitfield*/, PreemptionMode::Disabled, true /* isRootDevice*/});
osContext.ensureContextInitialized(false);
bo.bind(&osContext, 0, false);
bo.bind(&osContext, 0);
EXPECT_FALSE(drm.context.receivedVmBindUuidExt[0]);
}
@@ -402,7 +402,7 @@ HWTEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenUnbindingThenExtens
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
bo.bind(&osContext, 0, false);
bo.bind(&osContext, 0);
EXPECT_NE(0u, drm.context.receivedVmBind.value().extensions);
bo.unbind(&osContext, 0);

View File

@@ -5937,7 +5937,7 @@ TEST_F(DrmMemoryManagerTest, givenPageFaultIsUnSupportedWhenCallingBindBoOnBuffe
allocation.bufferObjects[0] = &bo;
std::vector<BufferObject *> bufferObjects;
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true, false);
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true);
EXPECT_FALSE(allocation.shouldAllocationPageFault(&drm));
EXPECT_FALSE(bo.isExplicitResidencyRequired());
@@ -5966,7 +5966,7 @@ TEST_F(DrmMemoryManagerTest, givenPageFaultIsSupportedAndKmdMigrationEnabledForB
debugManager.flags.UseKmdMigrationForBuffers.set(useKmdMigrationForBuffers);
std::vector<BufferObject *> bufferObjects;
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true, false);
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true);
if (useKmdMigrationForBuffers > 0) {
EXPECT_TRUE(allocation.shouldAllocationPageFault(&drm));
@@ -6005,7 +6005,7 @@ TEST_F(DrmMemoryManagerTest, givenPageFaultIsSupportedWhenCallingBindBoOnAllocat
allocation.shouldPageFault = shouldAllocationPageFault;
std::vector<BufferObject *> bufferObjects;
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true, false);
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true);
EXPECT_EQ(shouldAllocationPageFault, allocation.shouldAllocationPageFault(&drm));
EXPECT_EQ(!shouldAllocationPageFault, bo.isExplicitResidencyRequired());

View File

@@ -261,8 +261,8 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest2, givenOperationHandler
EXPECT_EQ(operationHandlerDefault->getRootDeviceIndex(), 0u);
EXPECT_EQ(operationHandler->getRootDeviceIndex(), 1u);
operationHandlerDefault->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationDefault, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
operationHandlerDefault->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationDefault, 1), false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
operationHandlerDefault->setRootDeviceIndex(1u);
operationHandler->setRootDeviceIndex(0u);
@@ -294,7 +294,7 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest2, whenNoSpaceLeftOnDevi
EXPECT_EQ(allocationDefault, registeredAllocations[1]);
EXPECT_EQ(operationHandler->evictUnusedCalled, 0u);
auto res = operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
auto res = operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
EXPECT_EQ(MemoryOperationsStatus::outOfMemory, res);
EXPECT_EQ(operationHandler->evictUnusedCalled, 1u);
@@ -309,17 +309,17 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenObjectAlwaysResidentAndNotUsedWh
for (auto &engine : device->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 10;
allocation->updateTaskCount(GraphicsAllocation::objectNotUsed, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
for (auto &engine : device->getSubDevice(0u)->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 10;
allocation->updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
for (auto &engine : device->getSubDevice(1u)->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 10;
allocation->updateTaskCount(GraphicsAllocation::objectNotUsed, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
EXPECT_EQ(mock->context.vmBindCalled, 2u);
@@ -375,17 +375,17 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, whenEvictUnusedResourcesWithWaitFor
for (auto &engine : device->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 10;
allocation->updateTaskCount(8u, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
for (auto &engine : device->getSubDevice(0u)->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 10;
allocation->updateTaskCount(8u, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
for (auto &engine : device->getSubDevice(1u)->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 10;
allocation->updateTaskCount(8u, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
*device->getSubDevice(1u)->getDefaultEngine().commandStreamReceiver->getTagAddress() = 5;
@@ -420,17 +420,17 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenRunningOutOfMemoryThenUnusedAlloc
for (auto &engine : device->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 10;
allocation->updateTaskCount(8u, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
for (auto &engine : device->getSubDevice(0u)->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 10;
allocation->updateTaskCount(8u, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
for (auto &engine : device->getSubDevice(1u)->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 10;
allocation->updateTaskCount(8u, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
*device->getSubDevice(1u)->getDefaultEngine().commandStreamReceiver->getTagAddress() = 5;
@@ -450,17 +450,17 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenUsedAllocationInBothSubdevicesWh
for (auto &engine : device->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 5;
allocation->updateTaskCount(8u, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
for (auto &engine : device->getSubDevice(0u)->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 5;
allocation->updateTaskCount(8u, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
for (auto &engine : device->getSubDevice(1u)->getAllEngines()) {
*engine.commandStreamReceiver->getTagAddress() = 5;
allocation->updateTaskCount(8u, engine.osContext->getContextId());
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
}
EXPECT_EQ(mock->context.vmBindCalled, 2u);
@@ -473,12 +473,12 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenUsedAllocationInBothSubdevicesWh
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(DrmMemoryOperationsHandlerBindTest, givenResidencyWithinOsContextFailsThenMergeWithResidencyContainertReturnsError) {
TEST_F(DrmMemoryOperationsHandlerBindTest, givenResidencyWithinOsContextFailsThenThenMergeWithResidencyContainertReturnsError) {
struct MockDrmMemoryOperationsHandlerBindResidencyFail : public DrmMemoryOperationsHandlerBind {
MockDrmMemoryOperationsHandlerBindResidencyFail(RootDeviceEnvironment &rootDeviceEnvironment, uint32_t rootDeviceIndex)
: DrmMemoryOperationsHandlerBind(rootDeviceEnvironment, rootDeviceIndex) {}
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override {
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
return NEO::MemoryOperationsStatus::failed;
}
};
@@ -539,7 +539,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenMakeBOsResidentFailsThenMakeResi
: DrmAllocation(rootDeviceIndex, 1u /*num gmms*/, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
}
int makeBOsResident(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence) override {
int makeBOsResident(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind) override {
return -1;
}
};
@@ -552,7 +552,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenMakeBOsResidentFailsThenMakeResi
auto allocation = new MockDrmAllocationBOsResident(0, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
auto graphicsAllocation = static_cast<GraphicsAllocation *>(allocation);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&graphicsAllocation, 1), false, false), MemoryOperationsStatus::outOfMemory);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&graphicsAllocation, 1), false), MemoryOperationsStatus::outOfMemory);
delete allocation;
}
@@ -581,19 +581,19 @@ TEST_F(DrmMemoryOperationsHandlerBindTest,
allocation->storageInfo.subDeviceBitfield = 0b0011;
auto graphicsAllocation = static_cast<GraphicsAllocation *>(allocation);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&graphicsAllocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&graphicsAllocation, 1), false), MemoryOperationsStatus::success);
delete allocation;
}
TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenMakeResidentWithinOsContextEvictableAllocationThenAllocationIsNotMarkedAsAlwaysResident) {
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
EXPECT_TRUE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
EXPECT_EQ(operationHandler->evict(device, *allocation), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
EXPECT_FALSE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
memoryManager->freeGraphicsMemory(allocation);
@@ -603,12 +603,12 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenMakeRe
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
allocation->storageInfo.isChunked = true;
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
EXPECT_TRUE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
EXPECT_EQ(operationHandler->evict(device, *allocation), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
EXPECT_FALSE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
memoryManager->freeGraphicsMemory(allocation);
@@ -619,12 +619,12 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenMakeRe
allocation->storageInfo.isChunked = true;
allocation->storageInfo.memoryBanks = 0x5;
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
EXPECT_TRUE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
EXPECT_EQ(operationHandler->evict(device, *allocation), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
EXPECT_FALSE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
memoryManager->freeGraphicsMemory(allocation);
@@ -634,7 +634,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenChangi
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::memoryNotFound);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->evict(device, *allocation), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::memoryNotFound);
@@ -649,7 +649,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDeviceWithMultipleSubdevicesWhen
EXPECT_EQ(operationHandler->isResident(device->getSubDevice(0u), *allocation), MemoryOperationsStatus::memoryNotFound);
EXPECT_EQ(operationHandler->isResident(device->getSubDevice(1u), *allocation), MemoryOperationsStatus::memoryNotFound);
auto retVal = operationHandler->makeResident(device->getSubDevice(1u), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
auto retVal = operationHandler->makeResident(device->getSubDevice(1u), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
EXPECT_EQ(retVal, MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::memoryNotFound);
@@ -677,7 +677,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenIoctlFailDuringEvictingThenUnreco
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::memoryNotFound);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::success);
mock->context.vmUnbindReturn = -1;
@@ -691,8 +691,8 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenIoctlFailDuringEvictingThenUnreco
TEST_F(DrmMemoryOperationsHandlerBindTest, whenMakeResidentTwiceThenAllocIsBoundOnlyOnce) {
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::success);
EXPECT_EQ(mock->context.vmBindCalled, 2u);
@@ -712,7 +712,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenNoVmBindSupportInDrmWhenCheckFor
mock->context.vmBindCalled = 0u;
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
EXPECT_FALSE(mock->context.vmBindCalled);
memoryManager->freeGraphicsMemory(allocation);
@@ -727,7 +727,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenVmBindSupportAndNoMultiTileWhenC
mock->context.vmBindCalled = 0u;
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
EXPECT_FALSE(mock->context.vmBindCalled);
memoryManager->freeGraphicsMemory(allocation);
@@ -741,7 +741,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDisabledVmBindWhenCreateDrmHandl
mock->context.vmBindCalled = false;
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
EXPECT_FALSE(mock->context.vmBindCalled);
memoryManager->freeGraphicsMemory(allocation);
@@ -1072,9 +1072,9 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenCsrTagAllocatorsWhenDestructin
auto hwTimeStampsAlloc = csr->getEventTsAllocator()->getTag()->getBaseGraphicsAllocation()->getDefaultGraphicsAllocation();
auto hwPerfCounterAlloc = csr->getEventPerfCountAllocator(4)->getTag()->getBaseGraphicsAllocation()->getDefaultGraphicsAllocation();
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&timestampStorageAlloc, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&hwTimeStampsAlloc, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&hwPerfCounterAlloc, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&timestampStorageAlloc, 1), false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&hwTimeStampsAlloc, 1), false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&hwPerfCounterAlloc, 1), false);
csr.reset();
@@ -1113,7 +1113,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexProgrammingEnabledWhen
bo.setPatIndex(mock->getPatIndex(allocation.getDefaultGmm(), allocation.getAllocationType(), CacheRegion::defaultRegion, CachePolicy::writeBack, (debugFlag == 1 && closSupported), true));
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false);
if (!patIndexProgrammingSupported) {
EXPECT_FALSE(mock->context.receivedVmBindPatIndex);
@@ -1184,7 +1184,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenUncachedDebugFlagSetWhenVmBind
mock->context.receivedVmUnbindPatIndex.reset();
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
auto expectedIndex = productHelper.overridePatIndex(true, static_cast<uint64_t>(MockGmmClientContextBase::MockPatIndex::uncached), allocation->getAllocationType());
@@ -1214,7 +1214,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenDebugFlagSetWhenVmBindCalledTh
GTEST_SKIP();
}
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&timestampStorageAlloc, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&timestampStorageAlloc, 1), false);
EXPECT_EQ(1u, mock->context.receivedVmBindPatIndex.value());
@@ -1245,7 +1245,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenDebugFlagSetWhenVmBindCalledTh
GraphicsAllocation *allocPtr = &allocation;
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(2u, mock->context.receivedVmBindPatIndex.value());
@@ -1276,7 +1276,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenDebugFlagSetWhenVmBindCalledTh
GraphicsAllocation *allocPtr = &allocation;
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
EXPECT_EQ(3u, mock->context.receivedVmBindPatIndex.value());
@@ -1308,7 +1308,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenClosEnabledAndAllocationToBeCach
EXPECT_TRUE(static_cast<DrmAllocation *>(allocation)->setCacheAdvice(mock, 32 * MemoryConstants::kiloByte, cacheRegion, false));
mock->context.receivedVmBindPatIndex.reset();
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
auto patIndex = productHelper.getPatIndex(cacheRegion, CachePolicy::writeBack);
@@ -1375,7 +1375,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenPreviouslyLockedMemoryWhenCallin
EXPECT_EQ(operationHandler->isResident(device, *mockDrmAllocation), MemoryOperationsStatus::memoryNotFound);
EXPECT_FALSE(mockDrmAllocation->isLockedMemory());
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&mockDrmAllocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&mockDrmAllocation, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->isResident(device, *mockDrmAllocation), MemoryOperationsStatus::success);
EXPECT_FALSE(mockDrmAllocation->isLockedMemory());
EXPECT_FALSE(mockBo.isExplicitLockedMemoryRequired());
@@ -1393,7 +1393,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenLockedAndResidentAllocationsWhen
EXPECT_EQ(operationHandler->lock(device, ArrayRef<GraphicsAllocation *>(&allocation1, 1)), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->isResident(device, *allocation1), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation2, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation2, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->isResident(device, *allocation2), MemoryOperationsStatus::success);
operationHandler->useBaseEvictUnused = true;
@@ -1410,7 +1410,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenLockedAndResidentAllocationsWhen
TEST_F(DrmMemoryOperationsHandlerBindTest, whenCallingMakeResidentThenVerifyImmediateBindingIsRequired) {
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
auto bo = static_cast<DrmAllocation *>(allocation)->getBO();
EXPECT_TRUE(bo->isImmediateBindingRequired());
@@ -1420,7 +1420,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenCallingMakeResidentThenVerifyImme
TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenCallingEvictAfterCallingResidentThenVerifyImmediateBindingIsNotRequired) {
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
auto bo = static_cast<DrmAllocation *>(allocation)->getBO();
EXPECT_TRUE(bo->isImmediateBindingRequired());

View File

@@ -23,7 +23,7 @@ struct MockDrmMemoryOperationsHandlerDefault : public DrmMemoryOperationsHandler
using BaseClass = DrmMemoryOperationsHandlerDefault;
using DrmMemoryOperationsHandlerDefault::DrmMemoryOperationsHandlerDefault;
using DrmMemoryOperationsHandlerDefault::residency;
ADDMETHOD(makeResidentWithinOsContext, MemoryOperationsStatus, true, MemoryOperationsStatus::success, (OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence), (osContext, gfxAllocations, evictable, forcePagingFence));
ADDMETHOD(makeResidentWithinOsContext, MemoryOperationsStatus, true, MemoryOperationsStatus::success, (OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable), (osContext, gfxAllocations, evictable));
ADDMETHOD(flushDummyExec, MemoryOperationsStatus, true, MemoryOperationsStatus::success, (Device * device, ArrayRef<GraphicsAllocation *> gfxAllocations), (device, gfxAllocations));
ADDMETHOD(evictWithinOsContext, MemoryOperationsStatus, true, MemoryOperationsStatus::success, (OsContext * osContext, GraphicsAllocation &gfxAllocation), (osContext, gfxAllocation));
};
@@ -73,7 +73,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, whenMakingAllocationResidentThenAlloc
initializeAllocation(1);
EXPECT_EQ(1u, drmAllocation->storageInfo.getNumBanks());
EXPECT_EQ(drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandler->residency.size(), 1u);
EXPECT_TRUE(drmMemoryOperationsHandler->residency.find(allocationPtr) != drmMemoryOperationsHandler->residency.end());
EXPECT_EQ(drmMemoryOperationsHandler->isResident(nullptr, *allocationPtr), MemoryOperationsStatus::success);
@@ -84,7 +84,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, whenEvictingResidentAllocationThenAll
EXPECT_EQ(1u, drmAllocation->storageInfo.getNumBanks());
EXPECT_EQ(drmMemoryOperationsHandler->residency.size(), 0u);
EXPECT_EQ(drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandler->isResident(nullptr, *allocationPtr), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandler->residency.size(), 1u);
EXPECT_TRUE(drmMemoryOperationsHandler->residency.find(allocationPtr) != drmMemoryOperationsHandler->residency.end());
@@ -174,7 +174,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenCallingMake
drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false;
initializeAllocation(1);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false);
EXPECT_EQ(drmMemoryOperationsHandler->flushDummyExecCalled, 0u);
}
TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenMakeResidentWithinOsContextReturnFailhenFlushDummyExecNotCalled) {
@@ -183,7 +183,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenMakeResiden
drmMemoryOperationsHandler->makeResidentWithinOsContextResult = MemoryOperationsStatus::failed;
initializeAllocation(1);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true, false);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true);
EXPECT_EQ(drmMemoryOperationsHandler->flushDummyExecCalled, 0u);
}
@@ -192,7 +192,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenCallingMake
drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false;
initializeAllocation(1);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true, false);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true);
EXPECT_EQ(drmMemoryOperationsHandler->flushDummyExecCalled, 1u);
}
@@ -202,7 +202,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenFlushReturn
drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false;
initializeAllocation(1);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true, false);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true);
EXPECT_EQ(drmMemoryOperationsHandler->evictWithinOsContextCalled, 1u);
}
@@ -212,7 +212,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenFlushReturn
drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false;
initializeAllocation(1);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true, false);
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true);
EXPECT_EQ(drmMemoryOperationsHandler->evictWithinOsContextCalled, 0u);
}

View File

@@ -53,7 +53,7 @@ struct DrmMemoryOperationsHandlerWithAubDumpTest : public ::testing::Test {
};
TEST_F(DrmMemoryOperationsHandlerWithAubDumpTest, whenMakingAllocationResidentThenAllocationIsResident) {
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->residency.size(), 1u);
EXPECT_TRUE(drmMemoryOperationsHandlerWithAubDumpMock->residency.find(allocationPtr) != drmMemoryOperationsHandlerWithAubDumpMock->residency.end());
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, graphicsAllocation), MemoryOperationsStatus::success);
@@ -66,7 +66,7 @@ TEST_F(DrmMemoryOperationsHandlerWithAubDumpTest, givenRegularAllocationWhenFree
mockAubMemoryOperationsHandler->setAubManager(&aubManager);
allocationPtr->setAubWritable(true, 0xff);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->residency.size(), 1u);
EXPECT_TRUE(drmMemoryOperationsHandlerWithAubDumpMock->residency.find(allocationPtr) != drmMemoryOperationsHandlerWithAubDumpMock->residency.end());
EXPECT_EQ(1u, mockAubMemoryOperationsHandler->residentAllocations.size());
@@ -90,7 +90,7 @@ TEST_F(DrmMemoryOperationsHandlerWithAubDumpTest, whenEvictingResidentAllocation
GraphicsAllocation *mockDrmAllocation = new MockDrmAllocation(AllocationType::unknown, MemoryPool::localMemory, bos);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->residency.size(), 0u);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&mockDrmAllocation, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&mockDrmAllocation, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, *mockDrmAllocation), MemoryOperationsStatus::success);
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->residency.size(), 1u);
EXPECT_TRUE(drmMemoryOperationsHandlerWithAubDumpMock->residency.find(mockDrmAllocation) != drmMemoryOperationsHandlerWithAubDumpMock->residency.end());

View File

@@ -426,7 +426,7 @@ TEST(DrmBufferObjectTestPrelim, givenBufferObjectSetToColourWithBindWhenBindingT
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
bo.bind(&osContext, 0, false);
bo.bind(&osContext, 0);
ASSERT_TRUE(drm.context.receivedVmBind);
EXPECT_EQ(drm.context.receivedVmBind->length, MemoryConstants::pageSize64k);
EXPECT_EQ(drm.context.receivedVmBind->start, 0xffeeffee);
@@ -498,7 +498,7 @@ TEST(DrmBufferObjectTestPrelim, givenBufferObjectMarkedForCaptureWhenBindingThen
osContext.ensureContextInitialized(false);
bo.markForCapture();
bo.bind(&osContext, 0, false);
bo.bind(&osContext, 0);
ASSERT_TRUE(drm.context.receivedVmBind);
EXPECT_TRUE(drm.context.receivedVmBind->flags & DrmPrelimHelper::getCaptureVmBindFlag());
}
@@ -515,7 +515,7 @@ TEST(DrmBufferObjectTestPrelim, givenNoActiveDirectSubmissionAndForceUseImmediat
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
bo.bind(&osContext, 0, false);
bo.bind(&osContext, 0);
ASSERT_TRUE(drm.context.receivedVmBind);
EXPECT_TRUE(drm.context.receivedVmBind->flags & DrmPrelimHelper::getImmediateVmBindFlag());
EXPECT_NE(drm.context.receivedVmBind->extensions, 0u);
@@ -532,7 +532,7 @@ TEST(DrmBufferObjectTestPrelim, whenBindingThenImmediateFlagIsSetAndExtensionLis
osContext.ensureContextInitialized(false);
osContext.setDirectSubmissionActive();
bo.bind(&osContext, 0, false);
bo.bind(&osContext, 0);
ASSERT_TRUE(drm.context.receivedVmBind);
EXPECT_TRUE(drm.context.receivedVmBind->flags & DrmPrelimHelper::getImmediateVmBindFlag());
EXPECT_NE(drm.context.receivedVmBind->extensions, 0u);

View File

@@ -30,7 +30,7 @@ TEST(DrmVmBindTest, givenBoRequiringImmediateBindWhenBindingThenImmediateFlagIsP
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
bo.bind(&osContext, 0, false);
bo.bind(&osContext, 0);
EXPECT_EQ(DrmPrelimHelper::getImmediateVmBindFlag(), drm.context.receivedVmBind->flags);
}
@@ -49,7 +49,7 @@ TEST(DrmVmBindTest, givenBoRequiringExplicitResidencyWhenBindingThenMakeResident
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
uint32_t vmHandleId = 0;
bo.bind(&osContext, vmHandleId, false);
bo.bind(&osContext, vmHandleId);
if (requireResidency) {
EXPECT_EQ(DrmPrelimHelper::getImmediateVmBindFlag() | DrmPrelimHelper::getMakeResidentVmBindFlag(), drm.context.receivedVmBind->flags);
@@ -78,7 +78,7 @@ TEST(DrmVmBindTest,
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
uint32_t vmHandleId = 0;
bo.bind(&osContext, vmHandleId, false);
bo.bind(&osContext, vmHandleId);
if (requireResidency) {
EXPECT_EQ(DrmPrelimHelper::getImmediateVmBindFlag() | DrmPrelimHelper::getMakeResidentVmBindFlag(), drm.context.receivedVmBind->flags);
@@ -106,7 +106,7 @@ TEST(DrmVmBindTest, givenPerContextVmsAndBoRequiringExplicitResidencyWhenBinding
MockOsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
uint32_t vmHandleId = 0;
bo.bind(&osContext, vmHandleId, false);
bo.bind(&osContext, vmHandleId);
if (requireResidency) {
EXPECT_EQ(DrmPrelimHelper::getImmediateVmBindFlag() | DrmPrelimHelper::getMakeResidentVmBindFlag(), drm.context.receivedVmBind->flags);
@@ -145,7 +145,7 @@ TEST(DrmVmBindTest, whenCallingWaitForBindThenWaitUserFenceIsCalled) {
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
uint32_t vmHandleId = 0;
bo.bind(&osContext, vmHandleId, false);
bo.bind(&osContext, vmHandleId);
drm.waitForBind(vmHandleId);
@@ -172,7 +172,7 @@ TEST(DrmVmBindTest, givenUseKmdMigrationWhenCallingBindBoOnUnifiedSharedMemoryTh
MockDrmAllocation allocation(0u, AllocationType::unifiedSharedMemory, MemoryPool::localMemory);
allocation.bufferObjects[0] = &bo;
allocation.bindBO(&bo, &osContext, vmHandleId, nullptr, true, false);
allocation.bindBO(&bo, &osContext, vmHandleId, nullptr, true);
EXPECT_TRUE(allocation.shouldAllocationPageFault(&drm));
EXPECT_FALSE(bo.isExplicitResidencyRequired());
@@ -198,7 +198,7 @@ TEST(DrmVmBindTest, givenDrmWithPageFaultSupportWhenCallingBindBoOnUnifiedShared
MockDrmAllocation allocation(rootDeviceIndex, AllocationType::unifiedSharedMemory, MemoryPool::localMemory);
allocation.bufferObjects[0] = &bo;
allocation.bindBO(&bo, &osContext, vmHandleId, nullptr, true, false);
allocation.bindBO(&bo, &osContext, vmHandleId, nullptr, true);
const bool isKmdMigrationAvailable{executionEnvironment->memoryManager->isKmdMigrationAvailable(rootDeviceIndex)};

View File

@@ -116,49 +116,3 @@ TEST(OSContextLinux, givenPerContextVmsAndBindCompleteWhenWaitForPagingFenceThen
EXPECT_EQ(0u, drm.waitUserFenceParams.size());
}
TEST(OSContextLinux, givenPerContextVmsAndBindNotCompleteWhenWaitForPagingFenceGivenFenceValThenContextFenceIsPassedToWaitUserFenceIoctl) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.requirePerContextVM = true;
MockOsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
drm.pagingFence[0] = 26u;
osContext.pagingFence[0] = 46u;
uint64_t fenceValToWait = 51u;
osContext.waitForPagingFenceGivenFenceVal(fenceValToWait);
EXPECT_EQ(1u, drm.waitUserFenceParams.size());
EXPECT_EQ(0u, drm.waitUserFenceParams[0].ctxId);
EXPECT_EQ(castToUint64(&osContext.pagingFence[0]), drm.waitUserFenceParams[0].address);
EXPECT_EQ(drm.ioctlHelper->getWaitUserFenceSoftFlag(), drm.waitUserFenceParams[0].flags);
EXPECT_EQ(fenceValToWait, drm.waitUserFenceParams[0].value);
EXPECT_EQ(-1, drm.waitUserFenceParams[0].timeout);
drm.requirePerContextVM = false;
osContext.waitForPagingFenceGivenFenceVal(fenceValToWait);
EXPECT_EQ(castToUint64(&drm.pagingFence[0]), drm.waitUserFenceParams[1].address);
EXPECT_EQ(drm.ioctlHelper->getWaitUserFenceSoftFlag(), drm.waitUserFenceParams[1].flags);
EXPECT_EQ(fenceValToWait, drm.waitUserFenceParams[1].value);
}
TEST(OSContextLinux, givenPerContextVmsAndBindCompleteWhenWaitForPagingFenceGivenFenceValThenWaitUserFenceIoctlIsNotCalled) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.requirePerContextVM = true;
MockOsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized(false);
osContext.pagingFence[0] = 3u;
uint64_t fenceValToWait = 3u;
osContext.waitForPagingFenceGivenFenceVal(fenceValToWait);
EXPECT_EQ(0u, drm.waitUserFenceParams.size());
}

View File

@@ -66,7 +66,7 @@ struct WddmMemoryOperationsHandlerWithAubDumpTest : public WddmTest {
};
TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenRegularAllocationWhenMakingResidentAllocationThenMakeResidentCalled) {
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, *wddmAllocation), MemoryOperationsStatus::success);
EXPECT_TRUE(mockAubMemoryOperationsHandler->makeResidentCalled);
EXPECT_TRUE(mockAubMemoryOperationsHandler->isResidentCalled);
@@ -74,14 +74,14 @@ TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenRegularAllocationWhenMak
TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenFragmentedAllocationWhenMakingResidentAllocationThenMakeResidentCalled) {
allocationPtr = wddmFragmentedAllocation.get();
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, *wddmFragmentedAllocation), MemoryOperationsStatus::success);
EXPECT_TRUE(mockAubMemoryOperationsHandler->makeResidentCalled);
EXPECT_TRUE(mockAubMemoryOperationsHandler->isResidentCalled);
}
TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenVariousAllocationsWhenMakingResidentAllocationThenMakeResidentCalled) {
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(allocationData), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(allocationData), false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, *wddmAllocation), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, *wddmFragmentedAllocation), MemoryOperationsStatus::success);
EXPECT_TRUE(mockAubMemoryOperationsHandler->makeResidentCalled);
@@ -90,7 +90,7 @@ TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenVariousAllocationsWhenMa
TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenRegularAllocationWhenEvictingResidentAllocationThenEvictCalled) {
wddm->callBaseEvict = true;
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->evict(nullptr, *wddmAllocation), MemoryOperationsStatus::success);
EXPECT_EQ(0u, gdi->getEvictArg().Flags.EvictOnlyIfNecessary);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, *wddmAllocation), MemoryOperationsStatus::memoryNotFound);
@@ -108,7 +108,7 @@ TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenRegularAllocationWhenFre
device->executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
allocationPtr->setAubWritable(true, 0xff);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(1u, mockAubMemoryOperationsHandler->residentAllocations.size());
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->free(device.get(), *wddmAllocation), MemoryOperationsStatus::success);
@@ -120,7 +120,7 @@ TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenRegularAllocationWhenFre
TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenFragmentedAllocationWhenEvictingResidentAllocationThenEvictCalled) {
allocationPtr = wddmFragmentedAllocation.get();
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->evict(nullptr, *wddmFragmentedAllocation), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, *wddmFragmentedAllocation), MemoryOperationsStatus::memoryNotFound);
EXPECT_TRUE(mockAubMemoryOperationsHandler->makeResidentCalled);
@@ -128,7 +128,7 @@ TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenFragmentedAllocationWhen
}
TEST_F(WddmMemoryOperationsHandlerWithAubDumpTest, givenVariousAllocationsWhenEvictingResidentAllocationThenEvictCalled) {
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(allocationData), false, false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(allocationData), false), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->evict(nullptr, *wddmAllocation), MemoryOperationsStatus::success);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, *wddmAllocation), MemoryOperationsStatus::memoryNotFound);
EXPECT_EQ(wddmMemoryOperationsHandlerWithAubDumpMock->evict(nullptr, *wddmFragmentedAllocation), MemoryOperationsStatus::success);