Rename i915 dg1 specific files to exp

Related-To: NEO-6149

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek 2021-10-01 13:20:52 +00:00 committed by Compute-Runtime-Automation
parent 068832d178
commit e8cb4f2634
12 changed files with 83 additions and 82 deletions

View File

@ -341,6 +341,7 @@ endif()
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "") if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
get_filename_component(I915_INCLUDES_DIR "${NEO_SOURCE_DIR}/third_party/uapi/dg1" ABSOLUTE) get_filename_component(I915_INCLUDES_DIR "${NEO_SOURCE_DIR}/third_party/uapi/dg1" ABSOLUTE)
set(I915_LOCAL_MEM_EXP TRUE)
else() else()
get_filename_component(I915_INCLUDES_DIR "${NEO_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}uapi" ABSOLUTE) get_filename_component(I915_INCLUDES_DIR "${NEO_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}uapi" ABSOLUTE)
endif() endif()

View File

@ -45,9 +45,9 @@ set(IGDRCL_SRCS_tests_os_interface_linux
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/self_lib_lin.cpp ${CMAKE_CURRENT_SOURCE_DIR}/self_lib_lin.cpp
) )
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "") if(I915_LOCAL_MEM_EXP)
list(APPEND IGDRCL_SRCS_tests_os_interface_linux list(APPEND IGDRCL_SRCS_tests_os_interface_linux
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_info_tests_dg1.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_info_tests_exp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_localmem_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_localmem_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_mock_drm_tip.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_mock_drm_tip.cpp
) )

View File

@ -8,11 +8,11 @@
#pragma once #pragma once
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h" #include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h"
class DrmMockCustomDg1 : public DrmMockCustom { class DrmMockCustomExp : public DrmMockCustom {
public: public:
using Drm::memoryInfo; using Drm::memoryInfo;
class IoctlsDg1 { class IoctlsExp {
public: public:
void reset() { void reset() {
gemCreateExt = 0; gemCreateExt = 0;
@ -22,13 +22,13 @@ class DrmMockCustomDg1 : public DrmMockCustom {
std::atomic<int32_t> gemMmapOffset; std::atomic<int32_t> gemMmapOffset;
}; };
IoctlsDg1 ioctlDg1_cnt; IoctlsExp ioctlExp_cnt;
IoctlsDg1 ioctlDg1_expected; IoctlsExp ioctlExp_expected;
void testIoctlsDg1() { void testIoctlsExp() {
#define NEO_IOCTL_EXPECT_EQ(PARAM) \ #define NEO_IOCTL_EXPECT_EQ(PARAM) \
if (this->ioctlDg1_expected.PARAM >= 0) { \ if (this->ioctlExp_expected.PARAM >= 0) { \
EXPECT_EQ(this->ioctlDg1_expected.PARAM, this->ioctlDg1_cnt.PARAM); \ EXPECT_EQ(this->ioctlExp_expected.PARAM, this->ioctlExp_cnt.PARAM); \
} }
NEO_IOCTL_EXPECT_EQ(gemMmapOffset); NEO_IOCTL_EXPECT_EQ(gemMmapOffset);
#undef NEO_IOCTL_EXPECT_EQ #undef NEO_IOCTL_EXPECT_EQ
@ -54,7 +54,7 @@ class DrmMockCustomDg1 : public DrmMockCustom {
createExtSize = createExtParams->size; createExtSize = createExtParams->size;
createExtHandle = createExtParams->handle; createExtHandle = createExtParams->handle;
createExtExtensions = createExtParams->extensions; createExtExtensions = createExtParams->extensions;
ioctlDg1_cnt.gemCreateExt++; ioctlExp_cnt.gemCreateExt++;
} break; } break;
case DRM_IOCTL_I915_GEM_MMAP_OFFSET: { case DRM_IOCTL_I915_GEM_MMAP_OFFSET: {
auto mmapOffsetParams = reinterpret_cast<drm_i915_gem_mmap_offset *>(arg); auto mmapOffsetParams = reinterpret_cast<drm_i915_gem_mmap_offset *>(arg);
@ -62,7 +62,7 @@ class DrmMockCustomDg1 : public DrmMockCustom {
mmapOffsetPad = mmapOffsetParams->pad; mmapOffsetPad = mmapOffsetParams->pad;
mmapOffsetOffset = mmapOffsetParams->offset; mmapOffsetOffset = mmapOffsetParams->offset;
mmapOffsetFlags = mmapOffsetParams->flags; mmapOffsetFlags = mmapOffsetParams->flags;
ioctlDg1_cnt.gemMmapOffset++; ioctlExp_cnt.gemMmapOffset++;
if (failOnMmapOffset == true) { if (failOnMmapOffset == true) {
return -1; return -1;
} }
@ -80,8 +80,8 @@ class DrmMockCustomDg1 : public DrmMockCustom {
int ioctlGemCreateExt(unsigned long request, void *arg); int ioctlGemCreateExt(unsigned long request, void *arg);
DrmMockCustomDg1() : DrmMockCustom() { DrmMockCustomExp() : DrmMockCustom() {
ioctlDg1_cnt.reset(); ioctlExp_cnt.reset();
ioctlDg1_expected.reset(); ioctlExp_expected.reset();
} }
}; };

View File

@ -11,7 +11,7 @@
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/default_hw_info.h"
#include "opencl/test/unit_test/os_interface/linux/drm_mock_dg1.h" #include "opencl/test/unit_test/os_interface/linux/drm_mock_exp.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -22,7 +22,7 @@ TEST(MemoryInfo, givenMemoryRegionQuerySupportedWhenQueryingMemoryInfoThenMemory
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
for (auto onDrmTip : {false, true}) { for (auto onDrmTip : {false, true}) {
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]); auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm); ASSERT_NE(nullptr, drm);
drm->queryMemoryRegionOnDrmTip = onDrmTip; drm->queryMemoryRegionOnDrmTip = onDrmTip;
@ -40,7 +40,7 @@ TEST(MemoryInfo, givenMemoryRegionQuerySupportedWhenQueryingMemoryInfoThenMemory
TEST(MemoryInfo, givenMemoryRegionQueryNotSupportedWhenQueryingMemoryInfoThenMemoryInfoIsNotCreated) { TEST(MemoryInfo, givenMemoryRegionQueryNotSupportedWhenQueryingMemoryInfoThenMemoryInfoIsNotCreated) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>(); auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]); auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm); ASSERT_NE(nullptr, drm);
drm->i915QuerySuccessCount = 0; drm->i915QuerySuccessCount = 0;
@ -53,7 +53,7 @@ TEST(MemoryInfo, givenMemoryRegionQueryNotSupportedWhenQueryingMemoryInfoThenMem
TEST(MemoryInfo, givenMemoryRegionQueryWhenQueryingFailsThenMemoryInfoIsNotCreated) { TEST(MemoryInfo, givenMemoryRegionQueryWhenQueryingFailsThenMemoryInfoIsNotCreated) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>(); auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]); auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm); ASSERT_NE(nullptr, drm);
drm->queryMemoryRegionInfoSuccessCount = 0; drm->queryMemoryRegionInfoSuccessCount = 0;
@ -61,14 +61,14 @@ TEST(MemoryInfo, givenMemoryRegionQueryWhenQueryingFailsThenMemoryInfoIsNotCreat
EXPECT_EQ(nullptr, drm->getMemoryInfo()); EXPECT_EQ(nullptr, drm->getMemoryInfo());
EXPECT_EQ(1u, drm->ioctlCallsCount); EXPECT_EQ(1u, drm->ioctlCallsCount);
drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]); drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm); ASSERT_NE(nullptr, drm);
drm->i915QuerySuccessCount = 1; drm->i915QuerySuccessCount = 1;
drm->queryMemoryInfo(); drm->queryMemoryInfo();
EXPECT_EQ(nullptr, drm->getMemoryInfo()); EXPECT_EQ(nullptr, drm->getMemoryInfo());
EXPECT_EQ(2u, drm->ioctlCallsCount); EXPECT_EQ(2u, drm->ioctlCallsCount);
drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]); drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm); ASSERT_NE(nullptr, drm);
drm->queryMemoryRegionInfoSuccessCount = 1; drm->queryMemoryRegionInfoSuccessCount = 1;
drm->queryMemoryInfo(); drm->queryMemoryInfo();
@ -236,7 +236,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemWithExtensionsThenRetu
auto executionEnvironment = std::make_unique<ExecutionEnvironment>(); auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]); auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
auto memoryInfo = std::make_unique<MemoryInfoImpl>(regionInfo, 2); auto memoryInfo = std::make_unique<MemoryInfoImpl>(regionInfo, 2);
ASSERT_NE(nullptr, memoryInfo); ASSERT_NE(nullptr, memoryInfo);
@ -262,7 +262,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingleRegionThe
auto executionEnvironment = std::make_unique<ExecutionEnvironment>(); auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]); auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
uint32_t handle = 0; uint32_t handle = 0;
auto ret = memoryInfo->createGemExtWithSingleRegion(drm.get(), 1, 1024, handle); auto ret = memoryInfo->createGemExtWithSingleRegion(drm.get(), 1, 1024, handle);
EXPECT_EQ(1u, handle); EXPECT_EQ(1u, handle);

View File

@ -18,8 +18,8 @@
#include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_gmm.h" #include "opencl/test/unit_test/mocks/mock_gmm.h"
#include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests_dg1.h" #include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests_exp.h"
#include "opencl/test/unit_test/os_interface/linux/drm_mock_dg1.h" #include "opencl/test/unit_test/os_interface/linux/drm_mock_exp.h"
#include "opencl/test/unit_test/os_interface/linux/drm_mock_memory_info.h" #include "opencl/test/unit_test/os_interface/linux/drm_mock_memory_info.h"
#include "test.h" #include "test.h"
@ -31,14 +31,14 @@ BufferObject *createBufferObjectInMemoryRegion(Drm *drm, uint64_t gpuAddress, si
class DrmMemoryManagerLocalMemoryTest : public ::testing::Test { class DrmMemoryManagerLocalMemoryTest : public ::testing::Test {
public: public:
DrmMockDg1 *mock; DrmMockExp *mock;
void SetUp() override { void SetUp() override {
const bool localMemoryEnabled = true; const bool localMemoryEnabled = true;
executionEnvironment = new ExecutionEnvironment; executionEnvironment = new ExecutionEnvironment;
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]); mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
mock->memoryInfo.reset(new MockMemoryInfo()); mock->memoryInfo.reset(new MockMemoryInfo());
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique<OSInterface>(); executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique<OSInterface>();
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock)); executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));
@ -66,14 +66,14 @@ class DrmMemoryManagerLocalMemoryTest : public ::testing::Test {
class DrmMemoryManagerLocalMemoryWithCustomMockTest : public ::testing::Test { class DrmMemoryManagerLocalMemoryWithCustomMockTest : public ::testing::Test {
public: public:
DrmMockCustomDg1 *mock; DrmMockCustomExp *mock;
void SetUp() override { void SetUp() override {
const bool localMemoryEnabled = true; const bool localMemoryEnabled = true;
executionEnvironment = new ExecutionEnvironment; executionEnvironment = new ExecutionEnvironment;
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
mock = new DrmMockCustomDg1(); mock = new DrmMockCustomExp();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>(); executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock)); executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));
@ -206,7 +206,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber); executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
for (uint32_t i = 0; i < rootDevicesNumber; i++) { for (uint32_t i = 0; i < rootDevicesNumber; i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
auto mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[i]); auto mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[i]);
drm_i915_memory_region_info regionInfo[2] = {}; drm_i915_memory_region_info regionInfo[2] = {};
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0}; regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
@ -225,7 +225,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
size_t size = 4096u; size_t size = 4096u;
AllocationProperties properties(rootDeviceIndex, true, size, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false, {}); AllocationProperties properties(rootDeviceIndex, true, size, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false, {});
static_cast<DrmMockDg1 *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>())->outputFd = 7; static_cast<DrmMockExp *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>())->outputFd = 7;
auto ptr = memoryManager->createMultiGraphicsAllocationInSystemMemoryPool(rootDeviceIndices, properties, multiGraphics); auto ptr = memoryManager->createMultiGraphicsAllocationInSystemMemoryPool(rootDeviceIndices, properties, multiGraphics);
@ -233,7 +233,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
EXPECT_NE(static_cast<DrmAllocation *>(multiGraphics.getDefaultGraphicsAllocation())->getMmapPtr(), nullptr); EXPECT_NE(static_cast<DrmAllocation *>(multiGraphics.getDefaultGraphicsAllocation())->getMmapPtr(), nullptr);
for (uint32_t i = 0; i < rootDevicesNumber; i++) { for (uint32_t i = 0; i < rootDevicesNumber; i++) {
if (i != 0) { if (i != 0) {
EXPECT_EQ(static_cast<DrmMockDg1 *>(executionEnvironment->rootDeviceEnvironments[i]->osInterface->getDriverModel()->as<Drm>())->inputFd, 7); EXPECT_EQ(static_cast<DrmMockExp *>(executionEnvironment->rootDeviceEnvironments[i]->osInterface->getDriverModel()->as<Drm>())->inputFd, 7);
} }
EXPECT_NE(multiGraphics.getGraphicsAllocation(i), nullptr); EXPECT_NE(multiGraphics.getGraphicsAllocation(i), nullptr);
memoryManager->freeGraphicsMemory(multiGraphics.getGraphicsAllocation(i)); memoryManager->freeGraphicsMemory(multiGraphics.getGraphicsAllocation(i));
@ -251,7 +251,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber); executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
for (uint32_t i = 0; i < rootDevicesNumber; i++) { for (uint32_t i = 0; i < rootDevicesNumber; i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
auto mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[i]); auto mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[i]);
drm_i915_memory_region_info regionInfo[2] = {}; drm_i915_memory_region_info regionInfo[2] = {};
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0}; regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
@ -310,7 +310,7 @@ TEST_F(DrmMemoryManagerUsmSharedHandleTest, givenMultiRootDeviceEnvironmentAndMe
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber); executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
auto mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]); auto mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
drm_i915_memory_region_info regionInfo[2] = {}; drm_i915_memory_region_info regionInfo[2] = {};
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0}; regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
@ -346,7 +346,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndNoMemo
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber); executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
for (uint32_t i = 0; i < rootDevicesNumber; i++) { for (uint32_t i = 0; i < rootDevicesNumber; i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
auto mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[i]); auto mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[i]);
mock->memoryInfo.reset(nullptr); mock->memoryInfo.reset(nullptr);
mock->ioctlCallsCount = 0; mock->ioctlCallsCount = 0;
@ -521,14 +521,14 @@ class DrmMemoryManagerLocalMemoryMemoryBankMock : public TestedDrmMemoryManager
class DrmMemoryManagerLocalMemoryMemoryBankTest : public ::testing::Test { class DrmMemoryManagerLocalMemoryMemoryBankTest : public ::testing::Test {
public: public:
DrmMockDg1 *mock; DrmMockExp *mock;
void SetUp() override { void SetUp() override {
const bool localMemoryEnabled = true; const bool localMemoryEnabled = true;
executionEnvironment = new ExecutionEnvironment; executionEnvironment = new ExecutionEnvironment;
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]); mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
mock->memoryInfo.reset(new MockMemoryInfo()); mock->memoryInfo.reset(new MockMemoryInfo());
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique<OSInterface>(); executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique<OSInterface>();
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock)); executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));
@ -1216,7 +1216,7 @@ TEST_F(DrmMemoryManagerLocalMemoryWithCustomMockTest, givenDrmMemoryManagerWithL
EXPECT_EQ(nullptr, bo.peekLockedAddress()); EXPECT_EQ(nullptr, bo.peekLockedAddress());
} }
using DrmMemoryManagerFailInjectionTest = Test<DrmMemoryManagerFixtureDg1>; using DrmMemoryManagerFailInjectionTest = Test<DrmMemoryManagerFixtureExp>;
TEST_F(DrmMemoryManagerFailInjectionTest, givenEnabledLocalMemoryWhenNewFailsThenAllocateInDevicePoolReturnsStatusErrorAndNullallocation) { TEST_F(DrmMemoryManagerFailInjectionTest, givenEnabledLocalMemoryWhenNewFailsThenAllocateInDevicePoolReturnsStatusErrorAndNullallocation) {
mock->ioctl_expected.total = -1; //don't care mock->ioctl_expected.total = -1; //don't care
@ -1362,14 +1362,14 @@ TEST_F(DrmMemoryManagerCopyMemoryToAllocationTest, givenDrmMemoryManagerWhenCopy
drmMemoryManger.freeGraphicsMemory(allocation); drmMemoryManger.freeGraphicsMemory(allocation);
} }
using DrmMemoryManagerTestDg1 = Test<DrmMemoryManagerFixtureDg1>; using DrmMemoryManagerTestExp = Test<DrmMemoryManagerFixtureExp>;
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryThenCallIoctlGemMapOffsetAndReturnLockedPtr) { TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryThenCallIoctlGemMapOffsetAndReturnLockedPtr) {
mockDg1->ioctlDg1_expected.gemCreateExt = 1; mockExp->ioctlExp_expected.gemCreateExt = 1;
mockDg1->ioctl_expected.gemWait = 1; mockExp->ioctl_expected.gemWait = 1;
mockDg1->ioctl_expected.gemClose = 1; mockExp->ioctl_expected.gemClose = 1;
mockDg1->ioctlDg1_expected.gemMmapOffset = 1; mockExp->ioctlExp_expected.gemMmapOffset = 1;
mockDg1->memoryInfo.reset(new MockMemoryInfo()); mockExp->memoryInfo.reset(new MockMemoryInfo());
AllocationData allocData; AllocationData allocData;
allocData.allFlags = 0; allocData.allFlags = 0;
@ -1389,10 +1389,10 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
auto drmAllocation = static_cast<DrmAllocation *>(allocation); auto drmAllocation = static_cast<DrmAllocation *>(allocation);
EXPECT_NE(nullptr, drmAllocation->getBO()->peekLockedAddress()); EXPECT_NE(nullptr, drmAllocation->getBO()->peekLockedAddress());
EXPECT_EQ(static_cast<uint32_t>(drmAllocation->getBO()->peekHandle()), mockDg1->mmapOffsetHandle); EXPECT_EQ(static_cast<uint32_t>(drmAllocation->getBO()->peekHandle()), mockExp->mmapOffsetHandle);
EXPECT_EQ(0u, mockDg1->mmapOffsetPad); EXPECT_EQ(0u, mockExp->mmapOffsetPad);
EXPECT_EQ(0u, mockDg1->mmapOffsetOffset); EXPECT_EQ(0u, mockExp->mmapOffsetOffset);
EXPECT_EQ(4u, mockDg1->mmapOffsetFlags); EXPECT_EQ(4u, mockExp->mmapOffsetFlags);
memoryManager->unlockResource(allocation); memoryManager->unlockResource(allocation);
EXPECT_EQ(nullptr, drmAllocation->getBO()->peekLockedAddress()); EXPECT_EQ(nullptr, drmAllocation->getBO()->peekLockedAddress());
@ -1400,12 +1400,12 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
memoryManager->freeGraphicsMemory(allocation); memoryManager->freeGraphicsMemory(allocation);
} }
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButFailsOnMmapThenReturnNullPtr) { TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButFailsOnMmapThenReturnNullPtr) {
mockDg1->ioctlDg1_expected.gemMmapOffset = 2; mockExp->ioctlExp_expected.gemMmapOffset = 2;
this->ioctlResExt = {mockDg1->ioctl_cnt.total, -1}; this->ioctlResExt = {mockExp->ioctl_cnt.total, -1};
mockDg1->ioctl_res_ext = &ioctlResExt; mockExp->ioctl_res_ext = &ioctlResExt;
BufferObject bo(mockDg1, 1, 0, 0); BufferObject bo(mockExp, 1, 0, 0);
DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory); DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory);
EXPECT_NE(nullptr, drmAllocation.getBO()); EXPECT_NE(nullptr, drmAllocation.getBO());
@ -1413,15 +1413,15 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
EXPECT_EQ(nullptr, ptr); EXPECT_EQ(nullptr, ptr);
memoryManager->unlockResource(&drmAllocation); memoryManager->unlockResource(&drmAllocation);
mockDg1->ioctl_res_ext = &mockDg1->NONE; mockExp->ioctl_res_ext = &mockExp->NONE;
} }
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButFailsOnIoctlMmapFunctionOffsetThenReturnNullPtr) { TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButFailsOnIoctlMmapFunctionOffsetThenReturnNullPtr) {
mockDg1->ioctlDg1_expected.gemMmapOffset = 2; mockExp->ioctlExp_expected.gemMmapOffset = 2;
mockDg1->returnIoctlExtraErrorValue = true; mockExp->returnIoctlExtraErrorValue = true;
mockDg1->failOnMmapOffset = true; mockExp->failOnMmapOffset = true;
BufferObject bo(mockDg1, 1, 0, 0); BufferObject bo(mockExp, 1, 0, 0);
DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory); DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory);
EXPECT_NE(nullptr, drmAllocation.getBO()); EXPECT_NE(nullptr, drmAllocation.getBO());
@ -1429,10 +1429,10 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
EXPECT_EQ(nullptr, ptr); EXPECT_EQ(nullptr, ptr);
memoryManager->unlockResource(&drmAllocation); memoryManager->unlockResource(&drmAllocation);
mockDg1->ioctl_res_ext = &mockDg1->NONE; mockExp->ioctl_res_ext = &mockExp->NONE;
} }
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButBufferObjectIsNullThenReturnNullPtr) { TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButBufferObjectIsNullThenReturnNullPtr) {
DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 0u, 0u, MemoryPool::LocalMemory); DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 0u, 0u, MemoryPool::LocalMemory);
auto ptr = memoryManager->lockResource(&drmAllocation); auto ptr = memoryManager->lockResource(&drmAllocation);
@ -1441,7 +1441,7 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
memoryManager->unlockResource(&drmAllocation); memoryManager->unlockResource(&drmAllocation);
} }
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledForMemoryInfoThenReturnMemoryRegionSize) { TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledForMemoryInfoThenReturnMemoryRegionSize) {
MockExecutionEnvironment executionEnvironment; MockExecutionEnvironment executionEnvironment;
executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>(); executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto drm = new DrmMock(*executionEnvironment.rootDeviceEnvironments[0]); auto drm = new DrmMock(*executionEnvironment.rootDeviceEnvironments[0]);
@ -1454,7 +1454,7 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCal
EXPECT_EQ(memoryInfo->getMemoryRegionSize(MemoryBanks::getBankForLocalMemory(0)), memoryManager.getLocalMemorySize(0u, 0xF)); EXPECT_EQ(memoryInfo->getMemoryRegionSize(MemoryBanks::getBankForLocalMemory(0)), memoryManager.getLocalMemorySize(0u, 0xF));
} }
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledForMemoryInfoAndInvalidDeviceBitfieldThenReturnZero) { TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledForMemoryInfoAndInvalidDeviceBitfieldThenReturnZero) {
MockExecutionEnvironment executionEnvironment; MockExecutionEnvironment executionEnvironment;
executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>(); executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto drm = new DrmMock(*executionEnvironment.rootDeviceEnvironments[0]); auto drm = new DrmMock(*executionEnvironment.rootDeviceEnvironments[0]);
@ -1467,7 +1467,7 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCal
EXPECT_EQ(0u, memoryManager.getLocalMemorySize(0u, 0u)); EXPECT_EQ(0u, memoryManager.getLocalMemorySize(0u, 0u));
} }
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledButMemoryInfoIsNotAvailableThenSizeZeroIsReturned) { TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledButMemoryInfoIsNotAvailableThenSizeZeroIsReturned) {
MockExecutionEnvironment executionEnvironment; MockExecutionEnvironment executionEnvironment;
executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>(); executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto drm = new DrmMock(*executionEnvironment.rootDeviceEnvironments[0]); auto drm = new DrmMock(*executionEnvironment.rootDeviceEnvironments[0]);

View File

@ -9,26 +9,26 @@
#include "shared/test/common/helpers/ult_hw_config.h" #include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/helpers/variable_backup.h" #include "shared/test/common/helpers/variable_backup.h"
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture_dg1.h" #include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture_exp.h"
#include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.h" #include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.h"
namespace NEO { namespace NEO {
class DrmMemoryManagerFixtureDg1 : public DrmMemoryManagerFixture { class DrmMemoryManagerFixtureExp : public DrmMemoryManagerFixture {
public: public:
DrmMockCustomDg1 *mockDg1; DrmMockCustomExp *mockExp;
void SetUp() override { void SetUp() override {
backup = std::make_unique<VariableBackup<UltHwConfig>>(&ultHwConfig); backup = std::make_unique<VariableBackup<UltHwConfig>>(&ultHwConfig);
ultHwConfig.csrBaseCallCreatePreemption = false; ultHwConfig.csrBaseCallCreatePreemption = false;
MemoryManagementFixture::SetUp(); MemoryManagementFixture::SetUp();
mockDg1 = new DrmMockCustomDg1; mockExp = new DrmMockCustomExp;
DrmMemoryManagerFixture::SetUp(mockDg1, true); DrmMemoryManagerFixture::SetUp(mockExp, true);
} }
void TearDown() override { void TearDown() override {
mockDg1->testIoctlsDg1(); mockExp->testIoctlsExp();
DrmMemoryManagerFixture::TearDown(); DrmMemoryManagerFixture::TearDown();
} }
std::unique_ptr<VariableBackup<UltHwConfig>> backup; std::unique_ptr<VariableBackup<UltHwConfig>> backup;

View File

@ -5,14 +5,14 @@
* *
*/ */
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture_dg1.h" #include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture_exp.h"
#include "opencl/test/unit_test/os_interface/linux/drm_mock_dg1.h" #include "opencl/test/unit_test/os_interface/linux/drm_mock_exp.h"
// clang-format off // clang-format off
#include "shared/source/os_interface/linux/drm_tip.h" #include "shared/source/os_interface/linux/drm_tip.h"
// clang-format on // clang-format on
void DrmMockDg1::handleQueryItemOnDrmTip(drm_i915_query_item *queryItem) { void DrmMockExp::handleQueryItemOnDrmTip(drm_i915_query_item *queryItem) {
switch (queryItem->query_id) { switch (queryItem->query_id) {
case DRM_I915_QUERY_MEMORY_REGIONS: case DRM_I915_QUERY_MEMORY_REGIONS:
if (queryMemoryRegionInfoSuccessCount == 0) { if (queryMemoryRegionInfoSuccessCount == 0) {
@ -41,13 +41,13 @@ void DrmMockDg1::handleQueryItemOnDrmTip(drm_i915_query_item *queryItem) {
} }
} }
int DrmMockCustomDg1::ioctlGemCreateExt(unsigned long request, void *arg) { int DrmMockCustomExp::ioctlGemCreateExt(unsigned long request, void *arg) {
if (request == DRM_IOCTL_I915_GEM_CREATE_EXT) { if (request == DRM_IOCTL_I915_GEM_CREATE_EXT) {
auto createExtParams = reinterpret_cast<DRM_TIP::drm_i915_gem_create_ext *>(arg); auto createExtParams = reinterpret_cast<DRM_TIP::drm_i915_gem_create_ext *>(arg);
createExtSize = createExtParams->size; createExtSize = createExtParams->size;
createExtHandle = createExtParams->handle; createExtHandle = createExtParams->handle;
createExtExtensions = createExtParams->extensions; createExtExtensions = createExtParams->extensions;
ioctlDg1_cnt.gemCreateExt++; ioctlExp_cnt.gemCreateExt++;
return 0; return 0;
} }
return -1; return -1;

View File

@ -14,10 +14,10 @@
using namespace NEO; using namespace NEO;
class DrmMockDg1 : public DrmMock { class DrmMockExp : public DrmMock {
public: public:
DrmMockDg1(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockDg1(rootDeviceEnvironment, defaultHwInfo.get()) {} DrmMockExp(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockExp(rootDeviceEnvironment, defaultHwInfo.get()) {}
DrmMockDg1(RootDeviceEnvironment &rootDeviceEnvironment, const HardwareInfo *inputHwInfo) : DrmMock(rootDeviceEnvironment) { DrmMockExp(RootDeviceEnvironment &rootDeviceEnvironment, const HardwareInfo *inputHwInfo) : DrmMock(rootDeviceEnvironment) {
rootDeviceEnvironment.setHwInfo(inputHwInfo); rootDeviceEnvironment.setHwInfo(inputHwInfo);
} }

View File

@ -91,11 +91,11 @@ else()
) )
endif() endif()
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "") if(I915_LOCAL_MEM_EXP)
list(APPEND NEO_CORE_OS_INTERFACE_LINUX list(APPEND NEO_CORE_OS_INTERFACE_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_local_memory_dg1.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_local_memory_exp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_create_multi_host_allocation_dg1.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_create_multi_host_allocation_exp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_query_dg1.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_query_exp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_tip.h ${CMAKE_CURRENT_SOURCE_DIR}/drm_tip.h
${CMAKE_CURRENT_SOURCE_DIR}/memory_info_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/memory_info_impl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gem_create_ext_memory_regions.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gem_create_ext_memory_regions.cpp