Always query memory info
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
parent
3e96e513b1
commit
8e2e9595a2
|
@ -98,14 +98,12 @@ Drm *Drm::create(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &
|
|||
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to request OCL Turbo Boost\n");
|
||||
}
|
||||
|
||||
if (!drmObject->queryEngineInfo()) {
|
||||
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to query engine info\n");
|
||||
if (!drmObject->queryMemoryInfo()) {
|
||||
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to query memory info\n");
|
||||
}
|
||||
|
||||
if (HwHelper::get(device->pHwInfo->platform.eRenderCoreFamily).getEnableLocalMemory(*device->pHwInfo)) {
|
||||
if (!drmObject->queryMemoryInfo()) {
|
||||
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to query memory info\n");
|
||||
}
|
||||
if (!drmObject->queryEngineInfo()) {
|
||||
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to query engine info\n");
|
||||
}
|
||||
|
||||
drmObject->checkContextDebugSupport();
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace NEO;
|
||||
std::vector<void *> mmapVector;
|
||||
|
||||
TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenAllocateInDevicePoolIsCalledThenNullptrAndStatusRetryIsReturned) {
|
||||
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
|
||||
|
@ -131,9 +130,6 @@ class DrmMemoryManagerLocalMemoryTest : public ::testing::Test {
|
|||
device.reset(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, rootDeviceIndex));
|
||||
memoryManager = std::make_unique<TestedDrmMemoryManager>(localMemoryEnabled, false, false, *executionEnvironment);
|
||||
}
|
||||
void TearDown() override {
|
||||
mmapVector.clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace NEO {
|
||||
|
||||
extern StackVec<void *, 10> mmapVector;
|
||||
extern std::vector<void *> mmapVector;
|
||||
|
||||
class DrmMemoryManagerBasic : public ::testing::Test {
|
||||
public:
|
||||
|
|
|
@ -39,9 +39,8 @@ Drm *Drm::create(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &
|
|||
auto drm = new DrmMockDefault(rootDeviceEnvironment);
|
||||
|
||||
const HardwareInfo *hwInfo = rootDeviceEnvironment.getHardwareInfo();
|
||||
if (HwHelper::get(hwInfo->platform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo)) {
|
||||
drm->queryMemoryInfo();
|
||||
}
|
||||
|
||||
drm->queryMemoryInfo();
|
||||
|
||||
if (drm->isVmBindAvailable() && rootDeviceEnvironment.executionEnvironment.isDebuggingEnabled()) {
|
||||
drm->setPerContextVMRequired(true);
|
||||
|
|
|
@ -26,7 +26,7 @@ DrmMemoryOperationsHandlerBind::DrmMemoryOperationsHandlerBind(RootDeviceEnviron
|
|||
DrmMemoryOperationsHandlerBind::~DrmMemoryOperationsHandlerBind() = default;
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) {
|
||||
auto engines = device->getEngines();
|
||||
auto &engines = device->getEngines();
|
||||
for (const auto &engine : engines) {
|
||||
this->makeResidentWithinOsContext(engine.osContext, gfxAllocations, false);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResidentWithinOsConte
|
|||
}
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::evict(Device *device, GraphicsAllocation &gfxAllocation) {
|
||||
auto engines = device->getEngines();
|
||||
auto &engines = device->getEngines();
|
||||
auto retVal = MemoryOperationsStatus::SUCCESS;
|
||||
for (const auto &engine : engines) {
|
||||
retVal = this->evictWithinOsContext(engine.osContext, gfxAllocation);
|
||||
|
@ -80,7 +80,7 @@ void DrmMemoryOperationsHandlerBind::evictImpl(OsContext *osContext, GraphicsAll
|
|||
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::isResident(Device *device, GraphicsAllocation &gfxAllocation) {
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
bool isResident = true;
|
||||
auto engines = device->getEngines();
|
||||
auto &engines = device->getEngines();
|
||||
for (const auto &engine : engines) {
|
||||
isResident &= gfxAllocation.isAlwaysResident(engine.osContext->getContextId());
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ off_t lseekReturn = 4096u;
|
|||
std::atomic<int> lseekCalledCount(0);
|
||||
int closeInputFd = 0;
|
||||
std::atomic<int> closeCalledCount(0);
|
||||
StackVec<void *, 10> mmapVector;
|
||||
std::vector<void *> mmapVector(64);
|
||||
|
||||
TestedDrmMemoryManager::TestedDrmMemoryManager(ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(gemCloseWorkerMode::gemCloseWorkerInactive,
|
||||
false,
|
||||
|
|
|
@ -17,7 +17,7 @@ extern off_t lseekReturn;
|
|||
extern std::atomic<int> lseekCalledCount;
|
||||
extern int closeInputFd;
|
||||
extern std::atomic<int> closeCalledCount;
|
||||
extern StackVec<void *, 10> mmapVector;
|
||||
extern std::vector<void *> mmapVector;
|
||||
|
||||
inline void *mmapMock(void *addr, size_t length, int prot, int flags, int fd, off_t offset) noexcept {
|
||||
if (addr) {
|
||||
|
@ -35,6 +35,7 @@ inline int munmapMock(void *addr, size_t length) noexcept {
|
|||
if (length > 0) {
|
||||
auto ptrIt = std::find(mmapVector.begin(), mmapVector.end(), addr);
|
||||
if (ptrIt != mmapVector.end()) {
|
||||
mmapVector.erase(ptrIt);
|
||||
alignedFree(addr);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue