From dfbad8029b9334930c166c4d2ca4ff8a4628b681 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Tue, 10 Sep 2024 13:19:49 +0000 Subject: [PATCH] feature: add support for SIMD16 EU per DSS to xe-prelim helper Related-To: NEO-12012 Signed-off-by: Mateusz Jablonski --- .../os_interface/linux/xe/CMakeLists.txt | 1 - .../os_interface/linux/xe/ioctl_helper_xe.cpp | 3 +++ .../os_interface/linux/xe/ioctl_helper_xe.h | 2 +- .../linux/xe/ioctl_helper_xe_eu_dss.cpp | 15 ------------ .../linux/xe/ioctl_helper_xe_prelim.cpp | 5 ++-- .../linux/xe/ioctl_helper_xe_prelim.h | 2 +- .../linux/xe/mock_ioctl_helper_xe.h | 1 - .../os_interface/linux/xe/CMakeLists.txt | 7 ++++++ .../linux/xe/ioctl_helper_xe_prelim_tests.cpp | 24 +++++++++++++++++++ .../linux/xe/ioctl_helper_xe_tests.cpp | 9 ++++--- 10 files changed, 45 insertions(+), 24 deletions(-) delete mode 100644 shared/source/os_interface/linux/xe/ioctl_helper_xe_eu_dss.cpp create mode 100644 shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_prelim_tests.cpp diff --git a/shared/source/os_interface/linux/xe/CMakeLists.txt b/shared/source/os_interface/linux/xe/CMakeLists.txt index 4673e14fe3..9b2d6ac754 100644 --- a/shared/source/os_interface/linux/xe/CMakeLists.txt +++ b/shared/source/os_interface/linux/xe/CMakeLists.txt @@ -11,7 +11,6 @@ set(NEO_CORE_OS_INTERFACE_LINUX_XE ${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe.h ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/ioctl_helper_xe_perf.cpp - ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/ioctl_helper_xe_eu_dss.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xedrm.h ${CMAKE_CURRENT_SOURCE_DIR}/xedrm_prelim.h ) diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp index d59dd985c6..40ab3d2a06 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -1719,4 +1719,7 @@ void IoctlHelperXe::querySupportedFeatures() { }; supportedFeatures.flags.pageFault = checkVmCreateFlagsSupport(DRM_XE_VM_CREATE_FLAG_LR_MODE | DRM_XE_VM_CREATE_FLAG_FAULT_MODE); }; +bool IoctlHelperXe::isEuPerDssTopologyType(uint16_t topologyType) const { + return topologyType == DRM_XE_TOPO_EU_PER_DSS; +} } // namespace NEO diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h index e68dca6f55..3e2a16db8a 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h @@ -133,6 +133,7 @@ class IoctlHelperXe : public IoctlHelper { void registerBOBindHandle(Drm *drm, DrmAllocation *drmAllocation) override; bool resourceRegistrationEnabled() override { return true; } bool isPreemptionSupported() override { return true; } + virtual bool isEuPerDssTopologyType(uint16_t topologyType) const; protected: static constexpr uint32_t maxContextSetProperties = 4; @@ -174,7 +175,6 @@ class IoctlHelperXe : public IoctlHelper { uint16_t revision; }; bool queryHwIpVersion(GtIpVersion >IpVersion); - static bool isEuPerDssTopologyType(uint16_t topologyType); int maxExecQueuePriority = 0; std::mutex xeLock; diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe_eu_dss.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe_eu_dss.cpp deleted file mode 100644 index 1a63294278..0000000000 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe_eu_dss.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (C) 2024 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/os_interface/linux/xe/ioctl_helper_xe.h" -#include "shared/source/os_interface/linux/xe/xedrm.h" -namespace NEO { - -bool IoctlHelperXe::isEuPerDssTopologyType(uint16_t topologyType) { - return topologyType == DRM_XE_TOPO_EU_PER_DSS; -} -} // namespace NEO diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe_prelim.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe_prelim.cpp index 5f1ad2c704..c1623bb486 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe_prelim.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe_prelim.cpp @@ -11,7 +11,8 @@ namespace NEO { -IoctlHelperXePrelim::~IoctlHelperXePrelim() { - xeLog("IoctlHelperXePrelim::~IoctlHelperXePrelim\n", ""); +bool IoctlHelperXePrelim::isEuPerDssTopologyType(uint16_t topologyType) const { + return topologyType == DRM_XE_TOPO_EU_PER_DSS || + topologyType == DRM_XE_TOPO_SIMD16_EU_PER_DSS; } } // namespace NEO diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe_prelim.h b/shared/source/os_interface/linux/xe/ioctl_helper_xe_prelim.h index a2683f4eac..2a8243c784 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe_prelim.h +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe_prelim.h @@ -13,7 +13,7 @@ namespace NEO { class IoctlHelperXePrelim : public IoctlHelperXe { public: using IoctlHelperXe::IoctlHelperXe; - ~IoctlHelperXePrelim() override; + bool isEuPerDssTopologyType(uint16_t topologyType) const override; }; } // namespace NEO diff --git a/shared/test/common/os_interface/linux/xe/mock_ioctl_helper_xe.h b/shared/test/common/os_interface/linux/xe/mock_ioctl_helper_xe.h index 44728e27b0..029d6b8ff6 100644 --- a/shared/test/common/os_interface/linux/xe/mock_ioctl_helper_xe.h +++ b/shared/test/common/os_interface/linux/xe/mock_ioctl_helper_xe.h @@ -19,7 +19,6 @@ struct MockIoctlHelperXe : IoctlHelperXe { using IoctlHelperXe::getFdFromVmExport; using IoctlHelperXe::ioctl; using IoctlHelperXe::IoctlHelperXe; - using IoctlHelperXe::isEuPerDssTopologyType; using IoctlHelperXe::maxContextSetProperties; using IoctlHelperXe::maxExecQueuePriority; using IoctlHelperXe::queryGtListData; diff --git a/shared/test/unit_test/os_interface/linux/xe/CMakeLists.txt b/shared/test/unit_test/os_interface/linux/xe/CMakeLists.txt index 6ddfa510cf..7238af4fc5 100644 --- a/shared/test/unit_test/os_interface/linux/xe/CMakeLists.txt +++ b/shared/test/unit_test/os_interface/linux/xe/CMakeLists.txt @@ -14,6 +14,13 @@ if(NEO_ENABLE_XE_EU_DEBUG_SUPPORT) ${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe_debugger_tests.cpp ) endif() + +if(NEO_ENABLE_XE_PRELIM_DETECTION) + list(APPEND NEO_CORE_OS_INTERFACE_TESTS_LINUX_XE + ${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe_prelim_tests.cpp + ) +endif() + set_property(GLOBAL APPEND PROPERTY NEO_CORE_OS_INTERFACE_TESTS_LINUX ${NEO_CORE_OS_INTERFACE_TESTS_LINUX_XE}) if(UNIX) diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_prelim_tests.cpp new file mode 100644 index 0000000000..a2a74bc667 --- /dev/null +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_prelim_tests.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2024 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/os_interface/linux/drm_neo.h" +#include "shared/source/os_interface/linux/xe/ioctl_helper_xe_prelim.h" +#include "shared/source/os_interface/linux/xe/xedrm_prelim.h" +#include "shared/test/common/mocks/mock_execution_environment.h" +#include "shared/test/common/test_macros/test.h" + +using namespace NEO; + +TEST(IoctlHelperXePrelimTest, givenSimd16EuPerDssTypeWhenCheckingIfTopologyIsEuPerDssThenSuccessIsReturned) { + MockExecutionEnvironment executionEnvironment{}; + std::unique_ptr drm{Drm::create(std::make_unique(0, ""), *executionEnvironment.rootDeviceEnvironments[0])}; + IoctlHelperXePrelim ioctlHelper{*drm}; + EXPECT_TRUE(ioctlHelper.isEuPerDssTopologyType(DRM_XE_TOPO_SIMD16_EU_PER_DSS)); + EXPECT_TRUE(ioctlHelper.isEuPerDssTopologyType(DRM_XE_TOPO_EU_PER_DSS)); + EXPECT_FALSE(ioctlHelper.isEuPerDssTopologyType(DRM_XE_TOPO_DSS_GEOMETRY)); + EXPECT_FALSE(ioctlHelper.isEuPerDssTopologyType(DRM_XE_TOPO_DSS_COMPUTE)); +} diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp index 976491a2d1..1970bd7373 100644 --- a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp @@ -2398,9 +2398,12 @@ TEST_F(IoctlHelperXeHwIpVersionTests, WhenSetupIpVersionIsCalledAndIoctlReturnsN } TEST(IoctlHelperXeTest, givenCorrectEuPerDssTypeWhenCheckingIfTopologyIsEuPerDssThenSuccessIsReturned) { - EXPECT_TRUE(MockIoctlHelperXe::isEuPerDssTopologyType(DRM_XE_TOPO_EU_PER_DSS)); - EXPECT_FALSE(MockIoctlHelperXe::isEuPerDssTopologyType(DRM_XE_TOPO_DSS_GEOMETRY)); - EXPECT_FALSE(MockIoctlHelperXe::isEuPerDssTopologyType(DRM_XE_TOPO_DSS_COMPUTE)); + MockExecutionEnvironment executionEnvironment{}; + std::unique_ptr drm{Drm::create(std::make_unique(0, ""), *executionEnvironment.rootDeviceEnvironments[0])}; + IoctlHelperXe ioctlHelper{*drm}; + EXPECT_TRUE(ioctlHelper.isEuPerDssTopologyType(DRM_XE_TOPO_EU_PER_DSS)); + EXPECT_FALSE(ioctlHelper.isEuPerDssTopologyType(DRM_XE_TOPO_DSS_GEOMETRY)); + EXPECT_FALSE(ioctlHelper.isEuPerDssTopologyType(DRM_XE_TOPO_DSS_COMPUTE)); } TEST(IoctlHelperXeTest, givenIoctlHelperWhenSettingExtContextThenCallExternalIoctlFunction) {