mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 15:03:02 +08:00
feature: support explicit memory locking
Added lockMemory in context to explicitly locking memory, Added a boolean flag in graphics_allocation to indicate the allocation is locked, and modified memory_operations_handler to add lock(). Related-To: NEO-8277 Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
15420aa094
commit
d6a14d4ed5
@@ -21,6 +21,7 @@ class MockMemoryOperationsHandler : public MemoryOperationsHandler {
|
||||
public:
|
||||
MockMemoryOperationsHandler() {}
|
||||
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) 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) override { return MemoryOperationsStatus::unsupported; }
|
||||
@@ -31,6 +32,7 @@ class MockMemoryOperationsHandlerTests : public MemoryOperationsHandler {
|
||||
public:
|
||||
MockMemoryOperationsHandlerTests() {}
|
||||
ADDMETHOD_NOBASE(makeResident, MemoryOperationsStatus, MemoryOperationsStatus::unsupported, (Device * device, ArrayRef<GraphicsAllocation *> gfxAllocations));
|
||||
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));
|
||||
@@ -52,6 +54,12 @@ class MockMemoryOperations : public MemoryOperationsHandler {
|
||||
}
|
||||
return MemoryOperationsStatus::success;
|
||||
}
|
||||
|
||||
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override {
|
||||
lockCalledCount++;
|
||||
return MemoryOperationsStatus::success;
|
||||
}
|
||||
|
||||
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override {
|
||||
evictCalledCount++;
|
||||
if (captureGfxAllocationsForMakeResident) {
|
||||
@@ -98,6 +106,7 @@ class MockMemoryOperations : public MemoryOperationsHandler {
|
||||
int makeResidentCalledCount = 0;
|
||||
int evictCalledCount = 0;
|
||||
uint32_t isResidentCalledCount = 0;
|
||||
uint32_t lockCalledCount = 0;
|
||||
uint32_t makeResidentContextId = std::numeric_limits<uint32_t>::max();
|
||||
bool captureGfxAllocationsForMakeResident = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user