Improve control of explicit residency flag

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2021-11-08 21:42:07 +00:00
committed by Compute-Runtime-Automation
parent 3e5d68deab
commit 8cf3e8ca94
11 changed files with 83 additions and 8 deletions

View File

@@ -73,6 +73,7 @@ void DrmAllocation::makeBOsResident(OsContext *osContext, uint32_t vmHandleId, s
void DrmAllocation::bindBO(BufferObject *bo, OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind) {
if (bo) {
bo->requireExplicitResidency(bo->peekDrm()->hasPageFaultSupport() && !shouldAllocationPageFault(bo->peekDrm()));
if (bufferObjects) {
if (bo->peekIsReusableAllocation()) {
for (auto bufferObject : *bufferObjects) {
@@ -138,7 +139,6 @@ void DrmAllocation::registerBOBindExtHandle(Drm *drm) {
}
bo->requireImmediateBinding(true);
bo->requireExplicitResidency(!shouldAllocationPageFault(drm));
}
}
}

View File

@@ -88,7 +88,7 @@ class DrmAllocation : public GraphicsAllocation {
void freeRegisteredBOBindExtHandles(Drm *drm);
void linkWithRegisteredHandle(uint32_t handle);
MOCKABLE_VIRTUAL void markForCapture();
bool shouldAllocationPageFault(Drm *drm);
MOCKABLE_VIRTUAL bool shouldAllocationPageFault(const Drm *drm);
protected:
BufferObjects bufferObjects{};

View File

@@ -42,7 +42,7 @@ bool DrmAllocation::setMemAdvise(Drm *drm, MemAdviseFlags flags) {
return true;
}
bool DrmAllocation::shouldAllocationPageFault(Drm *drm) {
bool DrmAllocation::shouldAllocationPageFault(const Drm *drm) {
return false;
}

View File

@@ -37,6 +37,7 @@ BufferObject::BufferObject(Drm *drm, int handle, size_t size, size_t maxOsContex
this->lockedAddress = nullptr;
perContextVmsUsed = drm->isPerContextVMRequired();
requiresExplicitResidency = drm->hasPageFaultSupport();
if (perContextVmsUsed) {
bindInfo.resize(maxOsContextCount);

View File

@@ -876,4 +876,8 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
return getMaxGpuFrequencyOfDevice(*this, sysFsPciPath, maxGpuFrequency);
}
bool Drm::hasPageFaultSupport() const {
return pageFaultSupported;
}
} // namespace NEO

View File

@@ -173,7 +173,7 @@ class Drm : public DriverModel {
MOCKABLE_VIRTUAL bool registerResourceClasses();
void queryPageFaultSupport();
bool hasPageFaultSupport();
bool hasPageFaultSupport() const;
MOCKABLE_VIRTUAL uint32_t registerResource(ResourceClass classType, const void *data, size_t size);
MOCKABLE_VIRTUAL void unregisterResource(uint32_t handle);

View File

@@ -74,8 +74,4 @@ void Drm::appendDrmContextFlags(drm_i915_gem_context_create_ext &gcc, bool isSpe
void Drm::queryPageFaultSupport() {
}
bool Drm::hasPageFaultSupport() {
return false;
}
} // namespace NEO