feature: add Drm-specific memoryBanks computation logic

Related-To: NEO-9754

Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
This commit is contained in:
Maciej Bielski
2024-06-11 17:00:04 +00:00
committed by Compute-Runtime-Automation
parent 9513df52a6
commit 11f7166c5a
7 changed files with 127 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
*/
#pragma once
#include "shared/source/helpers/driver_model_type.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/linux/drm_memory_manager.h"
#include "shared/source/os_interface/linux/drm_neo.h"
@@ -97,6 +98,8 @@ class DrmMockTime : public DrmMockSuccess {
class DrmMockCustom : public Drm {
public:
static constexpr NEO::DriverModelType driverModelType = NEO::DriverModelType::drm;
using Drm::bindAvailable;
using Drm::cacheInfo;
using Drm::checkToDisableScratchPage;

View File

@@ -13,6 +13,7 @@
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
#include "shared/test/common/mocks/mock_builtins.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/os_interface/linux/drm_mock_memory_info.h"
#include "shared/test/common/os_interface/linux/sys_calls_linux_ult.h"
#include "hw_cmds_default.h"
@@ -112,7 +113,10 @@ void DrmMemoryManagerWithLocalMemoryFixture::setUp() {
MemoryManagementFixture::setUp();
executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), numRootDevices - 1);
DrmMemoryManagerFixture::setUp(new DrmMockCustom(*executionEnvironment->rootDeviceEnvironments[0]), true);
auto drmMock = new DrmMockCustom{*executionEnvironment->rootDeviceEnvironments[1]};
drmMock->memoryInfo.reset(new MockMemoryInfo{*drmMock});
DrmMemoryManagerFixture::setUp(drmMock, true);
drmMock->reset();
} // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
void DrmMemoryManagerWithLocalMemoryFixture::tearDown() {
DrmMemoryManagerFixture::tearDown();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Intel Corporation
* Copyright (C) 2022-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -103,6 +103,7 @@ class DrmMemoryManagerLocalMemoryWithCustomPrelimMockTest : public ::testing::Te
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
mock = new DrmMockCustomPrelim(*executionEnvironment->rootDeviceEnvironments[0]);
mock->memoryInfo.reset(new MockMemoryInfo{*mock});
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,6 +18,8 @@ const std::vector<NEO::MemoryRegion> memoryRegions = {
{{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}, 8 * MemoryConstants::gigaByte, 0}};
struct MockMemoryInfo : public NEO::MemoryInfo {
using NEO::MemoryInfo::localMemoryRegions;
MockMemoryInfo(const NEO::Drm &drm) : MemoryInfo(memoryRegions, drm) {}
};