From 6ead86f0e11a4b23194558252de5c4051eefe42a Mon Sep 17 00:00:00 2001 From: Radoslaw Jablonski Date: Mon, 27 Jan 2025 22:11:30 +0000 Subject: [PATCH] performance: enable PreferredAllocationMethod by KMD on PTL Related-To: NEO-10526 Signed-off-by: Radoslaw Jablonski --- .../xe3_core/ptl/os_agnostic_product_helper_ptl.inl | 6 ++++++ shared/test/unit_test/xe3_core/ptl/CMakeLists.txt | 1 + .../unit_test/xe3_core/ptl/excludes_xe3_core_ptl.cpp | 10 ++++++++++ .../xe3_core/ptl/product_helper_tests_ptl.cpp | 10 ++++++++++ 4 files changed, 27 insertions(+) create mode 100644 shared/test/unit_test/xe3_core/ptl/excludes_xe3_core_ptl.cpp diff --git a/shared/source/xe3_core/ptl/os_agnostic_product_helper_ptl.inl b/shared/source/xe3_core/ptl/os_agnostic_product_helper_ptl.inl index b5a0e6f96e..58f946d19c 100644 --- a/shared/source/xe3_core/ptl/os_agnostic_product_helper_ptl.inl +++ b/shared/source/xe3_core/ptl/os_agnostic_product_helper_ptl.inl @@ -18,4 +18,10 @@ template <> bool ProductHelperHw::isBufferPoolAllocatorSupported() const { return false; } + +template <> +std::optional ProductHelperHw::getPreferredAllocationMethod(AllocationType allocationType) const { + return GfxMemoryAllocationMethod::allocateByKmd; +} + } // namespace NEO diff --git a/shared/test/unit_test/xe3_core/ptl/CMakeLists.txt b/shared/test/unit_test/xe3_core/ptl/CMakeLists.txt index 41dc811947..47cb10e532 100644 --- a/shared/test/unit_test/xe3_core/ptl/CMakeLists.txt +++ b/shared/test/unit_test/xe3_core/ptl/CMakeLists.txt @@ -7,6 +7,7 @@ if(TESTS_PTL) target_sources(neo_shared_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/excludes_xe3_core_ptl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_aot_config_tests_ptl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_ptl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/product_helper_tests_ptl.cpp diff --git a/shared/test/unit_test/xe3_core/ptl/excludes_xe3_core_ptl.cpp b/shared/test/unit_test/xe3_core/ptl/excludes_xe3_core_ptl.cpp new file mode 100644 index 0000000000..9760b54128 --- /dev/null +++ b/shared/test/unit_test/xe3_core/ptl/excludes_xe3_core_ptl.cpp @@ -0,0 +1,10 @@ +/* + * Copyright (C) 2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/test/common/test_macros/hw_test_base.h" + +HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, whenGettingPreferredAllocationMethodThenNoPreferenceIsReturned, IGFX_PTL); diff --git a/shared/test/unit_test/xe3_core/ptl/product_helper_tests_ptl.cpp b/shared/test/unit_test/xe3_core/ptl/product_helper_tests_ptl.cpp index 9d1d53aca2..a6f48b5248 100644 --- a/shared/test/unit_test/xe3_core/ptl/product_helper_tests_ptl.cpp +++ b/shared/test/unit_test/xe3_core/ptl/product_helper_tests_ptl.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/helpers/compiler_product_helper.h" +#include "shared/source/memory_manager/allocation_type.h" #include "shared/source/os_interface/product_helper.h" #include "shared/source/xe3_core/hw_info_xe3_core.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" @@ -18,6 +19,15 @@ using namespace NEO; using PtlProductHelper = ProductHelperTest; +PTLTEST_F(PtlProductHelper, whenGettingPreferredAllocationMethodThenAllocateByKmdIsReturned) { + for (auto i = 0; i < static_cast(AllocationType::count); i++) { + auto allocationType = static_cast(i); + auto preferredAllocationMethod = productHelper->getPreferredAllocationMethod(allocationType); + EXPECT_TRUE(preferredAllocationMethod.has_value()); + EXPECT_EQ(GfxMemoryAllocationMethod::allocateByKmd, preferredAllocationMethod.value()); + } +} + PTLTEST_F(PtlProductHelper, givenCompilerProductHelperWhenGetDefaultHwIpVersionThenCorrectValueIsSet) { EXPECT_EQ(compilerProductHelper->getDefaultHwIpVersion(), AOT::PTL_H_A0); }