Add alternative residency model on Linux

Related-To: NEO-4732

Change-Id: I79e165d2b647af200ca314e1183ecf05903de644
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2020-07-02 11:49:46 +02:00
parent 519e75e3d6
commit ff0add74e3
50 changed files with 521 additions and 272 deletions

View File

@@ -73,4 +73,5 @@ uint32_t GraphicsAllocation::getUsedPageSize() const {
constexpr uint32_t GraphicsAllocation::objectNotUsed;
constexpr uint32_t GraphicsAllocation::objectNotResident;
constexpr uint32_t GraphicsAllocation::objectAlwaysResident;
} // namespace NEO

View File

@@ -183,7 +183,12 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
void setInspectionId(uint32_t newInspectionId, uint32_t contextId) { usageInfos[contextId].inspectionId = newInspectionId; }
bool isResident(uint32_t contextId) const { return GraphicsAllocation::objectNotResident != getResidencyTaskCount(contextId); }
void updateResidencyTaskCount(uint32_t newTaskCount, uint32_t contextId) { usageInfos[contextId].residencyTaskCount = newTaskCount; }
bool isAlwaysResident(uint32_t contextId) const { return GraphicsAllocation::objectAlwaysResident == getResidencyTaskCount(contextId); }
void updateResidencyTaskCount(uint32_t newTaskCount, uint32_t contextId) {
if (usageInfos[contextId].residencyTaskCount != GraphicsAllocation::objectAlwaysResident || newTaskCount == GraphicsAllocation::objectNotResident) {
usageInfos[contextId].residencyTaskCount = newTaskCount;
}
}
uint32_t getResidencyTaskCount(uint32_t contextId) const { return usageInfos[contextId].residencyTaskCount; }
void releaseResidencyInOsContext(uint32_t contextId) { updateResidencyTaskCount(objectNotResident, contextId); }
bool isResidencyTaskCountBelow(uint32_t taskCount, uint32_t contextId) const { return !isResident(contextId) || getResidencyTaskCount(contextId) < taskCount; }
@@ -242,6 +247,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
static constexpr uint32_t allBanks = 0xffffffff;
constexpr static uint32_t objectNotResident = std::numeric_limits<uint32_t>::max();
constexpr static uint32_t objectNotUsed = std::numeric_limits<uint32_t>::max();
constexpr static uint32_t objectAlwaysResident = std::numeric_limits<uint32_t>::max() - 1;
protected:
struct UsageInfo {

View File

@@ -9,8 +9,10 @@
#include "shared/source/memory_manager/memory_operations_status.h"
#include "shared/source/utilities/arrayref.h"
namespace NEO {
#include <vector>
namespace NEO {
class Device;
class GraphicsAllocation;
class MemoryOperationsHandler {
@@ -18,8 +20,8 @@ class MemoryOperationsHandler {
MemoryOperationsHandler() = default;
virtual ~MemoryOperationsHandler() = default;
virtual MemoryOperationsStatus makeResident(ArrayRef<GraphicsAllocation *> gfxAllocations) = 0;
virtual MemoryOperationsStatus evict(GraphicsAllocation &gfxAllocation) = 0;
virtual MemoryOperationsStatus isResident(GraphicsAllocation &gfxAllocation) = 0;
virtual MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) = 0;
virtual MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) = 0;
virtual MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) = 0;
};
} // namespace NEO