mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Fix DirectSubmission residency handling
- allocations should be resident within OsContext Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e9f56e7d96
commit
f2eb7f3aea
@@ -9,7 +9,7 @@
|
||||
#include "shared/source/direct_submission/direct_submission_hw.h"
|
||||
#include "shared/source/direct_submission/direct_submission_hw_diagnostic_mode.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
|
||||
#include "shared/test/common/mocks/mock_memory_operations_handler.h"
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
@@ -73,6 +73,9 @@ struct MockDirectSubmissionHw : public DirectSubmissionHw<GfxFamily, Dispatcher>
|
||||
}
|
||||
|
||||
bool makeResourcesResident(DirectSubmissionAllocations &allocations) override {
|
||||
if (callBaseResident) {
|
||||
return BaseClass::makeResourcesResident(allocations);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -122,5 +125,6 @@ struct MockDirectSubmissionHw : public DirectSubmissionHw<GfxFamily, Dispatcher>
|
||||
bool allocateOsResourcesReturn = true;
|
||||
bool submitReturn = true;
|
||||
bool handleResidencyReturn = true;
|
||||
bool callBaseResident = false;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/memory_manager/memory_operations_handler.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
@@ -20,6 +21,8 @@ class MockMemoryOperationsHandler : public MemoryOperationsHandler {
|
||||
MemoryOperationsStatus makeResident(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; }
|
||||
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override { return MemoryOperationsStatus::UNSUPPORTED; }
|
||||
};
|
||||
|
||||
class MockMemoryOperationsHandlerTests : public MemoryOperationsHandler {
|
||||
@@ -31,6 +34,10 @@ class MockMemoryOperationsHandlerTests : public MemoryOperationsHandler {
|
||||
(Device * device, GraphicsAllocation &gfxAllocation), (override));
|
||||
MOCK_METHOD(MemoryOperationsStatus, isResident,
|
||||
(Device * device, GraphicsAllocation &gfxAllocation), (override));
|
||||
MOCK_METHOD(MemoryOperationsStatus, makeResidentWithinOsContext,
|
||||
(OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable), (override));
|
||||
MOCK_METHOD(MemoryOperationsStatus, evictWithinOsContext,
|
||||
(OsContext * osContext, GraphicsAllocation &gfxAllocation), (override));
|
||||
};
|
||||
|
||||
class MockMemoryOperations : public MemoryOperationsHandler {
|
||||
@@ -49,8 +56,21 @@ class MockMemoryOperations : public MemoryOperationsHandler {
|
||||
return MemoryOperationsStatus::SUCCESS;
|
||||
}
|
||||
|
||||
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
|
||||
makeResidentCalledCount++;
|
||||
if (osContext) {
|
||||
makeResidentContextId = osContext->getContextId();
|
||||
}
|
||||
return MemoryOperationsStatus::SUCCESS;
|
||||
}
|
||||
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override {
|
||||
evictCalledCount++;
|
||||
return MemoryOperationsStatus::SUCCESS;
|
||||
}
|
||||
|
||||
int makeResidentCalledCount = 0;
|
||||
int evictCalledCount = 0;
|
||||
uint32_t makeResidentContextId = std::numeric_limits<uint32_t>::max();
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user