From ec36dd62759970e8f4253c343f9d4a800d1840a9 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Thu, 14 Aug 2025 10:43:51 +0000 Subject: [PATCH] refactor: move gmm callbacks definition to common place - merge all the callbacks to single template class - store callback functions in global arrays - partially reuse callbacks on Linux Related-To: NEO-11080 Signed-off-by: Mateusz Jablonski --- CMakeLists.txt | 1 + shared/source/enable_cores.cmake | 4 +- .../enable_family_full_core_gen12lp.cpp | 6 ++- .../source/gen12lp/gmm_callbacks_gen12lp.cpp | 13 +++++ .../gen12lp/windows/gmm_callbacks_gen12lp.cpp | 14 ----- shared/source/gmm_helper/CMakeLists.txt | 6 ++- .../source/gmm_helper/drm/gmm_callbacks.inl | 27 ++++++++++ .../gmm_helper/drm_or_wddm/gmm_callbacks.inl | 8 +++ shared/source/gmm_helper/gmm_callbacks.cpp | 13 +++++ shared/source/gmm_helper/gmm_callbacks.h | 26 +++++++++ .../source/gmm_helper/gmm_callbacks_base.inl | 33 ++++++++++++ .../source/gmm_helper/wddm/gmm_callbacks.inl | 46 ++++++++++++++++ shared/source/helpers/CMakeLists.txt | 7 --- .../source/helpers/windows/gmm_callbacks.cpp | 14 ----- shared/source/helpers/windows/gmm_callbacks.h | 28 ---------- .../source/helpers/windows/gmm_callbacks.inl | 54 ------------------- ...igure_device_address_space_drm_or_wddm.cpp | 4 +- .../configure_device_address_space_wddm.cpp | 13 +++-- .../source/os_interface/windows/wddm/wddm.cpp | 2 +- .../windows/wddm_device_command_stream.inl | 9 ++-- .../enable_family_full_core_xe2_hpg_core.cpp | 6 ++- .../gmm_callbacks_xe2_hpg_core.cpp | 13 +++++ .../windows/gmm_callbacks_xe2_hpg_core.cpp | 16 ------ .../enable_family_full_core_xe3_core.cpp | 4 ++ .../xe3_core/gmm_callbacks_xe3_core.cpp | 13 +++++ .../windows/gmm_callbacks_xe3_core.cpp | 16 ------ .../enable_family_full_core_xe_hpc_core.cpp | 6 ++- .../xe_hpc_core/gmm_callbacks_xe_hpc_core.cpp | 13 +++++ .../windows/gmm_callbacks_xe_hpc_core.cpp | 16 ------ .../enable_family_full_core_xe_hpg_core.cpp | 6 ++- .../xe_hpg_core/gmm_callbacks_xe_hpg_core.cpp | 13 +++++ .../windows/gmm_callbacks_xe_hpg_core.cpp | 16 ------ .../unit_test/gen12lp/windows/CMakeLists.txt | 3 +- .../test/unit_test/gmm_helper/CMakeLists.txt | 1 + .../gmm_callbacks_tests.cpp} | 46 ++++++---------- .../windows/device_command_stream_tests.cpp | 4 +- .../windows/wddm_command_stream_l0_tests.cpp | 1 - .../windows/wddm_windows_tests.cpp | 8 ++- 38 files changed, 286 insertions(+), 243 deletions(-) create mode 100644 shared/source/gen12lp/gmm_callbacks_gen12lp.cpp delete mode 100644 shared/source/gen12lp/windows/gmm_callbacks_gen12lp.cpp create mode 100644 shared/source/gmm_helper/drm/gmm_callbacks.inl create mode 100644 shared/source/gmm_helper/drm_or_wddm/gmm_callbacks.inl create mode 100644 shared/source/gmm_helper/gmm_callbacks.cpp create mode 100644 shared/source/gmm_helper/gmm_callbacks.h create mode 100644 shared/source/gmm_helper/gmm_callbacks_base.inl create mode 100644 shared/source/gmm_helper/wddm/gmm_callbacks.inl delete mode 100644 shared/source/helpers/windows/gmm_callbacks.cpp delete mode 100644 shared/source/helpers/windows/gmm_callbacks.h delete mode 100644 shared/source/helpers/windows/gmm_callbacks.inl create mode 100644 shared/source/xe2_hpg_core/gmm_callbacks_xe2_hpg_core.cpp delete mode 100644 shared/source/xe2_hpg_core/windows/gmm_callbacks_xe2_hpg_core.cpp create mode 100644 shared/source/xe3_core/gmm_callbacks_xe3_core.cpp delete mode 100644 shared/source/xe3_core/windows/gmm_callbacks_xe3_core.cpp create mode 100644 shared/source/xe_hpc_core/gmm_callbacks_xe_hpc_core.cpp delete mode 100644 shared/source/xe_hpc_core/windows/gmm_callbacks_xe_hpc_core.cpp create mode 100644 shared/source/xe_hpg_core/gmm_callbacks_xe_hpg_core.cpp delete mode 100644 shared/source/xe_hpg_core/windows/gmm_callbacks_xe_hpg_core.cpp rename shared/test/unit_test/{gen12lp/windows/gmm_callbacks_tests_gen12lp.cpp => gmm_helper/gmm_callbacks_tests.cpp} (63%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d0a4fd7d7..453b1276a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -926,6 +926,7 @@ include_directories(${NEO_SHARED_DIRECTORY}/debug_settings/definitions${BRANCH_D include_directories(${NEO_SHARED_DIRECTORY}/dll/devices${BRANCH_DIR_SUFFIX}) include_directories(${NEO_SHARED_DIRECTORY}/kernel/definitions${BRANCH_DIR_SUFFIX}) include_directories(${NEO_SHARED_DIRECTORY}/gen_common${BRANCH_DIR_SUFFIX}) +include_directories(${NEO_SHARED_DIRECTORY}/gmm_helper/${DRIVER_MODEL}) if(WIN32) include_directories(${NEO_SHARED_DIRECTORY}/gmm_helper/windows/gmm_memory${BRANCH_DIR_SUFFIX}) include_directories(${NEO_SHARED_DIRECTORY}/os_interface/windows/wddm/definitions) diff --git a/shared/source/enable_cores.cmake b/shared/source/enable_cores.cmake index 0b30bebb80..f46624f95d 100644 --- a/shared/source/enable_cores.cmake +++ b/shared/source/enable_cores.cmake @@ -1,5 +1,5 @@ # -# Copyright (C) 2020-2023 Intel Corporation +# Copyright (C) 2020-2025 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -23,6 +23,7 @@ set(CORE_RUNTIME_SRCS_COREX_CPP_BASE experimental_command_buffer implicit_scaling gfx_core_helper + gmm_callbacks hw_info preamble preemption @@ -33,7 +34,6 @@ set(CORE_RUNTIME_SRCS_COREX_CPP_BASE set(CORE_RUNTIME_SRCS_COREX_CPP_WDDM windows/command_stream_receiver windows/direct_submission - windows/gmm_callbacks ) set(CORE_RUNTIME_SRCS_COREX_CPP_LINUX diff --git a/shared/source/gen12lp/enable_family_full_core_gen12lp.cpp b/shared/source/gen12lp/enable_family_full_core_gen12lp.cpp index 1296c05569..a164c30393 100644 --- a/shared/source/gen12lp/enable_family_full_core_gen12lp.cpp +++ b/shared/source/gen12lp/enable_family_full_core_gen12lp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,6 +20,9 @@ extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = Gen12LpFamily; static auto gfxFamily = IGFX_GEN12LP_CORE; +template +struct GmmCallbacks; + struct EnableCoreGen12LP { EnableCoreGen12LP() { gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; @@ -27,6 +30,7 @@ struct EnableCoreGen12LP { populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); + populateFactoryTable>(); } }; diff --git a/shared/source/gen12lp/gmm_callbacks_gen12lp.cpp b/shared/source/gen12lp/gmm_callbacks_gen12lp.cpp new file mode 100644 index 0000000000..8b7509f693 --- /dev/null +++ b/shared/source/gen12lp/gmm_callbacks_gen12lp.cpp @@ -0,0 +1,13 @@ +/* + * Copyright (C) 2019-2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/gen12lp/hw_cmds_base.h" + +using Family = NEO::Gen12LpFamily; +static auto gfxCore = IGFX_GEN12LP_CORE; + +#include "gmm_callbacks.inl" diff --git a/shared/source/gen12lp/windows/gmm_callbacks_gen12lp.cpp b/shared/source/gen12lp/windows/gmm_callbacks_gen12lp.cpp deleted file mode 100644 index 8416347ff4..0000000000 --- a/shared/source/gen12lp/windows/gmm_callbacks_gen12lp.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) 2019-2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/gen12lp/hw_cmds_base.h" -#include "shared/source/helpers/windows/gmm_callbacks.inl" - -namespace NEO { -template struct DeviceCallbacks; -template struct TTCallbacks; -} // namespace NEO diff --git a/shared/source/gmm_helper/CMakeLists.txt b/shared/source/gmm_helper/CMakeLists.txt index aeb2df9a67..b8a060d723 100644 --- a/shared/source/gmm_helper/CMakeLists.txt +++ b/shared/source/gmm_helper/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2019-2023 Intel Corporation +# Copyright (C) 2019-2025 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -15,6 +15,10 @@ set(NEO_CORE_GMM_HELPER ${CMAKE_CURRENT_SOURCE_DIR}/cache_settings_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/gmm.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gmm.h + ${CMAKE_CURRENT_SOURCE_DIR}/gmm_callbacks.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/gmm_callbacks.h + ${CMAKE_CURRENT_SOURCE_DIR}/gmm_callbacks_base.inl + ${CMAKE_CURRENT_SOURCE_DIR}/${DRIVER_MODEL}/gmm_callbacks.inl ${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface.h diff --git a/shared/source/gmm_helper/drm/gmm_callbacks.inl b/shared/source/gmm_helper/drm/gmm_callbacks.inl new file mode 100644 index 0000000000..0bf5f99804 --- /dev/null +++ b/shared/source/gmm_helper/drm/gmm_callbacks.inl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/gmm_helper/gmm_callbacks_base.inl" +#include "shared/source/helpers/array_count.h" +#include "shared/source/helpers/populate_factory.h" + +namespace NEO { + +template +long __stdcall GmmCallbacks::notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate) { + return 1; +} + +template <> +void populateFactoryTable>() { + UNRECOVERABLE_IF(!isInRange(gfxCore, writeL3AddressFuncFactory)); + writeL3AddressFuncFactory[gfxCore] = GmmCallbacks::writeL3Address; +} + +template struct GmmCallbacks; + +} // namespace NEO diff --git a/shared/source/gmm_helper/drm_or_wddm/gmm_callbacks.inl b/shared/source/gmm_helper/drm_or_wddm/gmm_callbacks.inl new file mode 100644 index 0000000000..9a0e25f0e7 --- /dev/null +++ b/shared/source/gmm_helper/drm_or_wddm/gmm_callbacks.inl @@ -0,0 +1,8 @@ +/* + * Copyright (C) 2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/gmm_helper/wddm/gmm_callbacks.inl" \ No newline at end of file diff --git a/shared/source/gmm_helper/gmm_callbacks.cpp b/shared/source/gmm_helper/gmm_callbacks.cpp new file mode 100644 index 0000000000..e7e08073eb --- /dev/null +++ b/shared/source/gmm_helper/gmm_callbacks.cpp @@ -0,0 +1,13 @@ +/* + * Copyright (C) 2020-2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/gmm_helper/gmm_callbacks.h" + +namespace NEO { +NotifyAubCaptureFunc notifyAubCaptureFuncFactory[IGFX_MAX_CORE]{}; +WriteL3AddressFunc writeL3AddressFuncFactory[IGFX_MAX_CORE]{}; +} // namespace NEO diff --git a/shared/source/gmm_helper/gmm_callbacks.h b/shared/source/gmm_helper/gmm_callbacks.h new file mode 100644 index 0000000000..a3c21b33ab --- /dev/null +++ b/shared/source/gmm_helper/gmm_callbacks.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2019-2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once +#include "shared/source/gmm_helper/gmm_lib.h" + +#include + +namespace NEO { +using NotifyAubCaptureFunc = long(__stdcall *)(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate); +using WriteL3AddressFunc = int(__stdcall *)(void *queueHandle, uint64_t l3GfxAddress, uint64_t regOffset); + +extern NotifyAubCaptureFunc notifyAubCaptureFuncFactory[IGFX_MAX_CORE]; +extern WriteL3AddressFunc writeL3AddressFuncFactory[IGFX_MAX_CORE]; + +template +struct GmmCallbacks { + static long __stdcall notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate); + static int __stdcall writeL3Address(void *queueHandle, uint64_t l3GfxAddress, uint64_t regOffset); +}; + +} // namespace NEO diff --git a/shared/source/gmm_helper/gmm_callbacks_base.inl b/shared/source/gmm_helper/gmm_callbacks_base.inl new file mode 100644 index 0000000000..af8b9add92 --- /dev/null +++ b/shared/source/gmm_helper/gmm_callbacks_base.inl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/command_stream/command_stream_receiver.h" +#include "shared/source/gmm_helper/gmm_callbacks.h" +#include "shared/source/helpers/gfx_core_helper.h" + +namespace NEO { + +template +int __stdcall GmmCallbacks::writeL3Address(void *queueHandle, uint64_t l3GfxAddress, uint64_t regOffset) { + auto csr = reinterpret_cast(queueHandle); + + LriHelper::program(&csr->getCS(0), + static_cast(regOffset & 0xFFFFFFFF), + static_cast(l3GfxAddress & 0xFFFFFFFF), + true, + false); + + LriHelper::program(&csr->getCS(0), + static_cast(regOffset >> 32), + static_cast(l3GfxAddress >> 32), + true, + false); + + return 1; +} + +} // namespace NEO diff --git a/shared/source/gmm_helper/wddm/gmm_callbacks.inl b/shared/source/gmm_helper/wddm/gmm_callbacks.inl new file mode 100644 index 0000000000..4a000e50a2 --- /dev/null +++ b/shared/source/gmm_helper/wddm/gmm_callbacks.inl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2019-2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/command_stream/aub_command_stream_receiver_hw.h" +#include "shared/source/command_stream/command_stream_receiver_with_aub_dump.h" +#include "shared/source/gmm_helper/gmm_callbacks_base.inl" +#include "shared/source/helpers/array_count.h" +#include "shared/source/helpers/populate_factory.h" +#include "shared/source/os_interface/windows/wddm_device_command_stream.h" + +namespace NEO { + +template +long __stdcall GmmCallbacks::notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate) { + auto csr = reinterpret_cast *>(csrHandle); + + if (obtainCsrTypeFromIntegerValue(debugManager.flags.SetCommandStreamReceiver.get(), CommandStreamReceiverType::hardware) == CommandStreamReceiverType::hardwareWithAub) { + auto csrWithAub = static_cast> *>(csr); + auto aubCsr = static_cast *>(csrWithAub->aubCSR.get()); + if (allocate) { + AllocationView externalAllocation(gfxAddress, gfxSize); + aubCsr->makeResidentExternal(externalAllocation); + } else { + aubCsr->makeNonResidentExternal(gfxAddress); + } + } + + return 1; +} + +template <> +void populateFactoryTable>() { + UNRECOVERABLE_IF(!isInRange(gfxCore, writeL3AddressFuncFactory)); + writeL3AddressFuncFactory[gfxCore] = GmmCallbacks::writeL3Address; + + UNRECOVERABLE_IF(!isInRange(gfxCore, notifyAubCaptureFuncFactory)); + notifyAubCaptureFuncFactory[gfxCore] = GmmCallbacks::notifyAubCapture; +} + +template struct GmmCallbacks; + +} // namespace NEO diff --git a/shared/source/helpers/CMakeLists.txt b/shared/source/helpers/CMakeLists.txt index 0405957672..2a02abcf32 100644 --- a/shared/source/helpers/CMakeLists.txt +++ b/shared/source/helpers/CMakeLists.txt @@ -244,13 +244,6 @@ if(SUPPORT_XE3_AND_BEFORE) ) endif() -set(NEO_CORE_HELPERS_GMM_CALLBACKS_WINDOWS - ${CMAKE_CURRENT_SOURCE_DIR}/windows/gmm_callbacks.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/windows/gmm_callbacks.h - ${CMAKE_CURRENT_SOURCE_DIR}/windows/gmm_callbacks.inl -) - -set_property(GLOBAL PROPERTY NEO_CORE_HELPERS_GMM_CALLBACKS_WINDOWS ${NEO_CORE_HELPERS_GMM_CALLBACKS_WINDOWS}) set_property(GLOBAL PROPERTY NEO_CORE_HELPERS ${NEO_CORE_HELPERS}) add_subdirectories() diff --git a/shared/source/helpers/windows/gmm_callbacks.cpp b/shared/source/helpers/windows/gmm_callbacks.cpp deleted file mode 100644 index 53c3848065..0000000000 --- a/shared/source/helpers/windows/gmm_callbacks.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) 2020-2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/os_interface/windows/windows_wrapper.h" - -#include - -namespace NEO { -long(__stdcall *notifyAubCaptureImpl)(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate) = nullptr; -} // namespace NEO diff --git a/shared/source/helpers/windows/gmm_callbacks.h b/shared/source/helpers/windows/gmm_callbacks.h deleted file mode 100644 index 4accb70265..0000000000 --- a/shared/source/helpers/windows/gmm_callbacks.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2019-2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#pragma once -#include "shared/source/os_interface/windows/windows_wrapper.h" - -#include - -namespace NEO { - -extern long(__stdcall *notifyAubCaptureImpl)(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate); -template -struct DeviceCallbacks { - static long __stdcall notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate); -}; - -template -struct TTCallbacks { - using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM; - - static int __stdcall writeL3Address(void *queueHandle, uint64_t l3GfxAddress, uint64_t regOffset); -}; - -} // namespace NEO diff --git a/shared/source/helpers/windows/gmm_callbacks.inl b/shared/source/helpers/windows/gmm_callbacks.inl deleted file mode 100644 index a28a236ad8..0000000000 --- a/shared/source/helpers/windows/gmm_callbacks.inl +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2019-2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/command_stream/aub_command_stream_receiver_hw.h" -#include "shared/source/command_stream/command_stream_receiver_hw.h" -#include "shared/source/command_stream/command_stream_receiver_with_aub_dump.h" -#include "shared/source/helpers/gfx_core_helper.h" -#include "shared/source/helpers/windows/gmm_callbacks.h" -#include "shared/source/os_interface/windows/wddm_device_command_stream.h" - -namespace NEO { - -template -long __stdcall DeviceCallbacks::notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate) { - auto csr = reinterpret_cast *>(csrHandle); - - if (obtainCsrTypeFromIntegerValue(debugManager.flags.SetCommandStreamReceiver.get(), CommandStreamReceiverType::hardware) == CommandStreamReceiverType::hardwareWithAub) { - auto csrWithAub = static_cast> *>(csr); - auto aubCsr = static_cast *>(csrWithAub->aubCSR.get()); - if (allocate) { - AllocationView externalAllocation(gfxAddress, gfxSize); - aubCsr->makeResidentExternal(externalAllocation); - } else { - aubCsr->makeNonResidentExternal(gfxAddress); - } - } - - return 1; -} - -template -int __stdcall TTCallbacks::writeL3Address(void *queueHandle, uint64_t l3GfxAddress, uint64_t regOffset) { - auto csr = reinterpret_cast *>(queueHandle); - - LriHelper::program(&csr->getCS(0), - static_cast(regOffset & 0xFFFFFFFF), - static_cast(l3GfxAddress & 0xFFFFFFFF), - true, - false); - - LriHelper::program(&csr->getCS(0), - static_cast(regOffset >> 32), - static_cast(l3GfxAddress >> 32), - true, - false); - - return 1; -} - -} // namespace NEO diff --git a/shared/source/os_interface/windows/wddm/configure_device_address_space_drm_or_wddm.cpp b/shared/source/os_interface/windows/wddm/configure_device_address_space_drm_or_wddm.cpp index df3b14aaed..699af434b6 100644 --- a/shared/source/os_interface/windows/wddm/configure_device_address_space_drm_or_wddm.cpp +++ b/shared/source/os_interface/windows/wddm/configure_device_address_space_drm_or_wddm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,12 +9,12 @@ #include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/gmm_helper/client_context/gmm_client_context.h" #include "shared/source/gmm_helper/gmm.h" +#include "shared/source/gmm_helper/gmm_callbacks.h" #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/page_table_mngr.h" #include "shared/source/gmm_helper/resource_info.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/hw_info.h" -#include "shared/source/helpers/windows/gmm_callbacks.h" #include "shared/source/memory_manager/gfx_partition.h" #include "shared/source/os_interface/linux/allocator_helper.h" #include "shared/source/os_interface/product_helper.h" diff --git a/shared/source/os_interface/windows/wddm/configure_device_address_space_wddm.cpp b/shared/source/os_interface/windows/wddm/configure_device_address_space_wddm.cpp index cb1cc130a3..7133132c76 100644 --- a/shared/source/os_interface/windows/wddm/configure_device_address_space_wddm.cpp +++ b/shared/source/os_interface/windows/wddm/configure_device_address_space_wddm.cpp @@ -6,9 +6,9 @@ */ #include "shared/source/execution_environment/root_device_environment.h" +#include "shared/source/gmm_helper/gmm_callbacks.h" #include "shared/source/helpers/constants.h" #include "shared/source/helpers/hw_info.h" -#include "shared/source/helpers/windows/gmm_callbacks.h" #include "shared/source/os_interface/windows/gdi_interface.h" #include "shared/source/os_interface/windows/wddm/wddm.h" @@ -16,10 +16,6 @@ namespace NEO { -long __stdcall notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate) { - return notifyAubCaptureImpl(csrHandle, gfxAddress, gfxSize, allocate); -} - bool Wddm::configureDeviceAddressSpace() { GMM_DEVICE_CALLBACKS_INT deviceCallbacks{}; deviceCallbacks.Adapter.KmtHandle = getAdapter(); @@ -41,7 +37,10 @@ bool Wddm::configureDeviceAddressSpace() { deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnUnLock = getGdi()->unlock2; deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnEscape = getGdi()->escape; deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnFreeGPUVA = getGdi()->freeGpuVirtualAddress; - deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture = notifyAubCapture; + + auto hwInfo = rootDeviceEnvironment.getHardwareInfo(); + + deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture = notifyAubCaptureFuncFactory[hwInfo->platform.eRenderCoreFamily]; GMM_DEVICE_INFO deviceInfo{}; deviceInfo.pGfxPartition = &gfxPartition; @@ -63,7 +62,7 @@ bool Wddm::configureDeviceAddressSpace() { ? maximumApplicationAddress + 1u : 0u; - bool obtainMinAddress = rootDeviceEnvironment.getHardwareInfo()->platform.eRenderCoreFamily == IGFX_GEN12LP_CORE; + bool obtainMinAddress = hwInfo->platform.eRenderCoreFamily == IGFX_GEN12LP_CORE; return gmmMemory->configureDevice(getAdapter(), device, getGdi()->escape, svmSize, featureTable->flags.ftrL3IACoherency, minAddress, obtainMinAddress); } diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index 8f8114cc9c..50a8832f92 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -13,6 +13,7 @@ #include "shared/source/gmm_helper/client_context/gmm_handle_allocator.h" #include "shared/source/gmm_helper/client_context/map_gpu_va_gmm.h" #include "shared/source/gmm_helper/gmm.h" +#include "shared/source/gmm_helper/gmm_callbacks.h" #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/page_table_mngr.h" #include "shared/source/gmm_helper/resource_info.h" @@ -23,7 +24,6 @@ #include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/mt_helpers.h" #include "shared/source/helpers/string.h" -#include "shared/source/helpers/windows/gmm_callbacks.h" #include "shared/source/memory_manager/gfx_partition.h" #include "shared/source/os_interface/product_helper.h" #include "shared/source/os_interface/sys_calls_common.h" diff --git a/shared/source/os_interface/windows/wddm_device_command_stream.inl b/shared/source/os_interface/windows/wddm_device_command_stream.inl index d6b04a991e..9707b5ad05 100644 --- a/shared/source/os_interface/windows/wddm_device_command_stream.inl +++ b/shared/source/os_interface/windows/wddm_device_command_stream.inl @@ -14,10 +14,11 @@ #include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h" #include "shared/source/direct_submission/dispatchers/render_dispatcher.h" #include "shared/source/direct_submission/windows/wddm_direct_submission.h" +#include "shared/source/gmm_helper/gmm_callbacks.h" #include "shared/source/gmm_helper/page_table_mngr.h" #include "shared/source/helpers/flush_stamp.h" +#include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/ptr_math.h" -#include "shared/source/helpers/windows/gmm_callbacks.h" #include "shared/source/os_interface/windows/wddm/wddm.h" #include "shared/source/os_interface/windows/wddm/wddm_residency_logger.h" #include "shared/source/os_interface/windows/wddm_device_command_stream.h" @@ -40,7 +41,6 @@ WddmCommandStreamReceiver::WddmCommandStreamReceiver(ExecutionEnviron const DeviceBitfield deviceBitfield) : BaseClass(executionEnvironment, rootDeviceIndex, deviceBitfield) { - notifyAubCaptureImpl = DeviceCallbacks::notifyAubCapture; this->wddm = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface->getDriverModel()->as(); PreemptionMode preemptionMode = PreemptionHelper::getDefaultPreemptionMode(this->peekHwInfo()); @@ -175,9 +175,10 @@ bool WddmCommandStreamReceiver::isTlbFlushRequiredForStateCacheFlush( template GmmPageTableMngr *WddmCommandStreamReceiver::createPageTableManager() { GMM_TRANSLATIONTABLE_CALLBACKS ttCallbacks = {}; - ttCallbacks.pfWriteL3Adr = TTCallbacks::writeL3Address; - auto rootDeviceEnvironment = this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex].get(); + auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); + + ttCallbacks.pfWriteL3Adr = writeL3AddressFuncFactory[hwInfo->platform.eRenderCoreFamily]; GmmPageTableMngr *gmmPageTableMngr = GmmPageTableMngr::create(rootDeviceEnvironment->getGmmClientContext(), TT_TYPE::AUXTT, &ttCallbacks); gmmPageTableMngr->setCsrHandle(this); diff --git a/shared/source/xe2_hpg_core/enable_family_full_core_xe2_hpg_core.cpp b/shared/source/xe2_hpg_core/enable_family_full_core_xe2_hpg_core.cpp index bafc8ba078..730831d7e5 100644 --- a/shared/source/xe2_hpg_core/enable_family_full_core_xe2_hpg_core.cpp +++ b/shared/source/xe2_hpg_core/enable_family_full_core_xe2_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,6 +20,9 @@ extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = Xe2HpgCoreFamily; static auto gfxFamily = IGFX_XE2_HPG_CORE; +template +struct GmmCallbacks; + struct EnableCoreXe2HpgCore { EnableCoreXe2HpgCore() { gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; @@ -27,6 +30,7 @@ struct EnableCoreXe2HpgCore { populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); + populateFactoryTable>(); } }; diff --git a/shared/source/xe2_hpg_core/gmm_callbacks_xe2_hpg_core.cpp b/shared/source/xe2_hpg_core/gmm_callbacks_xe2_hpg_core.cpp new file mode 100644 index 0000000000..5872747a39 --- /dev/null +++ b/shared/source/xe2_hpg_core/gmm_callbacks_xe2_hpg_core.cpp @@ -0,0 +1,13 @@ +/* + * Copyright (C) 2024-2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/xe2_hpg_core/hw_cmds.h" + +using Family = NEO::Xe2HpgCoreFamily; +static auto gfxCore = IGFX_XE2_HPG_CORE; + +#include "gmm_callbacks.inl" diff --git a/shared/source/xe2_hpg_core/windows/gmm_callbacks_xe2_hpg_core.cpp b/shared/source/xe2_hpg_core/windows/gmm_callbacks_xe2_hpg_core.cpp deleted file mode 100644 index 19c4015679..0000000000 --- a/shared/source/xe2_hpg_core/windows/gmm_callbacks_xe2_hpg_core.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2024-2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/helpers/windows/gmm_callbacks.inl" -#include "shared/source/xe2_hpg_core/hw_cmds.h" - -namespace NEO { - -template struct DeviceCallbacks; -template struct TTCallbacks; - -} // namespace NEO diff --git a/shared/source/xe3_core/enable_family_full_core_xe3_core.cpp b/shared/source/xe3_core/enable_family_full_core_xe3_core.cpp index 60b4627593..14af6e17f0 100644 --- a/shared/source/xe3_core/enable_family_full_core_xe3_core.cpp +++ b/shared/source/xe3_core/enable_family_full_core_xe3_core.cpp @@ -20,6 +20,9 @@ extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = Xe3CoreFamily; static auto gfxFamily = IGFX_XE3_CORE; +template +struct GmmCallbacks; + struct EnableCoreXe3Core { EnableCoreXe3Core() { gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; @@ -27,6 +30,7 @@ struct EnableCoreXe3Core { populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); + populateFactoryTable>(); } }; diff --git a/shared/source/xe3_core/gmm_callbacks_xe3_core.cpp b/shared/source/xe3_core/gmm_callbacks_xe3_core.cpp new file mode 100644 index 0000000000..26f9750103 --- /dev/null +++ b/shared/source/xe3_core/gmm_callbacks_xe3_core.cpp @@ -0,0 +1,13 @@ +/* + * Copyright (C) 2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/xe3_core/hw_cmds_base.h" + +static auto gfxCore = IGFX_XE3_CORE; +using Family = NEO::Xe3CoreFamily; + +#include "gmm_callbacks.inl" \ No newline at end of file diff --git a/shared/source/xe3_core/windows/gmm_callbacks_xe3_core.cpp b/shared/source/xe3_core/windows/gmm_callbacks_xe3_core.cpp deleted file mode 100644 index 7e74cc9835..0000000000 --- a/shared/source/xe3_core/windows/gmm_callbacks_xe3_core.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/helpers/windows/gmm_callbacks.inl" -#include "shared/source/xe3_core/hw_cmds_base.h" - -namespace NEO { - -template struct DeviceCallbacks; -template struct TTCallbacks; - -} // namespace NEO diff --git a/shared/source/xe_hpc_core/enable_family_full_core_xe_hpc_core.cpp b/shared/source/xe_hpc_core/enable_family_full_core_xe_hpc_core.cpp index d56e6f1ba6..3796bdb43c 100644 --- a/shared/source/xe_hpc_core/enable_family_full_core_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/enable_family_full_core_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,6 +20,9 @@ extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = XeHpcCoreFamily; static auto gfxFamily = IGFX_XE_HPC_CORE; +template +struct GmmCallbacks; + struct EnableCoreXeHpcCore { EnableCoreXeHpcCore() { gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; @@ -27,6 +30,7 @@ struct EnableCoreXeHpcCore { populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); + populateFactoryTable>(); } }; diff --git a/shared/source/xe_hpc_core/gmm_callbacks_xe_hpc_core.cpp b/shared/source/xe_hpc_core/gmm_callbacks_xe_hpc_core.cpp new file mode 100644 index 0000000000..1d8705a910 --- /dev/null +++ b/shared/source/xe_hpc_core/gmm_callbacks_xe_hpc_core.cpp @@ -0,0 +1,13 @@ +/* + * Copyright (C) 2021-2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/xe_hpc_core/hw_cmds_xe_hpc_core_base.h" + +static auto gfxCore = IGFX_XE_HPC_CORE; +using Family = NEO::XeHpcCoreFamily; + +#include "gmm_callbacks.inl" \ No newline at end of file diff --git a/shared/source/xe_hpc_core/windows/gmm_callbacks_xe_hpc_core.cpp b/shared/source/xe_hpc_core/windows/gmm_callbacks_xe_hpc_core.cpp deleted file mode 100644 index 75ed651664..0000000000 --- a/shared/source/xe_hpc_core/windows/gmm_callbacks_xe_hpc_core.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2021-2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/helpers/windows/gmm_callbacks.inl" -#include "shared/source/xe_hpc_core/hw_cmds_xe_hpc_core_base.h" - -namespace NEO { - -template struct DeviceCallbacks; -template struct TTCallbacks; - -} // namespace NEO diff --git a/shared/source/xe_hpg_core/enable_family_full_core_xe_hpg_core.cpp b/shared/source/xe_hpg_core/enable_family_full_core_xe_hpg_core.cpp index afb990aed2..c58394f962 100644 --- a/shared/source/xe_hpg_core/enable_family_full_core_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/enable_family_full_core_xe_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,6 +20,9 @@ extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = XeHpgCoreFamily; static auto gfxFamily = IGFX_XE_HPG_CORE; +template +struct GmmCallbacks; + struct EnableCoreXeHpgCore { EnableCoreXeHpgCore() { gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; @@ -27,6 +30,7 @@ struct EnableCoreXeHpgCore { populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); + populateFactoryTable>(); } }; diff --git a/shared/source/xe_hpg_core/gmm_callbacks_xe_hpg_core.cpp b/shared/source/xe_hpg_core/gmm_callbacks_xe_hpg_core.cpp new file mode 100644 index 0000000000..87cab37100 --- /dev/null +++ b/shared/source/xe_hpg_core/gmm_callbacks_xe_hpg_core.cpp @@ -0,0 +1,13 @@ +/* + * Copyright (C) 2021-2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h" + +using Family = NEO::XeHpgCoreFamily; +static auto gfxCore = IGFX_XE_HPG_CORE; + +#include "gmm_callbacks.inl" diff --git a/shared/source/xe_hpg_core/windows/gmm_callbacks_xe_hpg_core.cpp b/shared/source/xe_hpg_core/windows/gmm_callbacks_xe_hpg_core.cpp deleted file mode 100644 index e349ca72b1..0000000000 --- a/shared/source/xe_hpg_core/windows/gmm_callbacks_xe_hpg_core.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2021-2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/helpers/windows/gmm_callbacks.inl" -#include "shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h" - -namespace NEO { - -template struct DeviceCallbacks; -template struct TTCallbacks; - -} // namespace NEO diff --git a/shared/test/unit_test/gen12lp/windows/CMakeLists.txt b/shared/test/unit_test/gen12lp/windows/CMakeLists.txt index 630e94091b..ffb7eb2589 100644 --- a/shared/test/unit_test/gen12lp/windows/CMakeLists.txt +++ b/shared/test/unit_test/gen12lp/windows/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2022-2023 Intel Corporation +# Copyright (C) 2022-2025 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -7,7 +7,6 @@ if(WIN32) target_sources(neo_shared_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - ${CMAKE_CURRENT_SOURCE_DIR}/gmm_callbacks_tests_gen12lp.cpp ${CMAKE_CURRENT_SOURCE_DIR}/product_helper_tests_gen12lp.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wddm_tests_gen12lp.cpp ) diff --git a/shared/test/unit_test/gmm_helper/CMakeLists.txt b/shared/test/unit_test/gmm_helper/CMakeLists.txt index de5143eb8b..8f9dfb1440 100644 --- a/shared/test/unit_test/gmm_helper/CMakeLists.txt +++ b/shared/test/unit_test/gmm_helper/CMakeLists.txt @@ -7,6 +7,7 @@ target_sources(neo_shared_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/compression_tests_xe2_and_later.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/gmm_callbacks_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gmm_resource_info_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gmm_tests.cpp diff --git a/shared/test/unit_test/gen12lp/windows/gmm_callbacks_tests_gen12lp.cpp b/shared/test/unit_test/gmm_helper/gmm_callbacks_tests.cpp similarity index 63% rename from shared/test/unit_test/gen12lp/windows/gmm_callbacks_tests_gen12lp.cpp rename to shared/test/unit_test/gmm_helper/gmm_callbacks_tests.cpp index 3d7a16c028..5fa7915f80 100644 --- a/shared/test/unit_test/gen12lp/windows/gmm_callbacks_tests_gen12lp.cpp +++ b/shared/test/unit_test/gmm_helper/gmm_callbacks_tests.cpp @@ -1,46 +1,30 @@ /* - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ -#include "shared/source/command_stream/aub_command_stream_receiver_hw.h" -#include "shared/source/command_stream/command_stream_receiver_with_aub_dump.h" -#include "shared/source/command_stream/linear_stream.h" -#include "shared/source/execution_environment/execution_environment.h" -#include "shared/source/execution_environment/root_device_environment.h" -#include "shared/source/helpers/gfx_core_helper.h" -#include "shared/source/helpers/windows/gmm_callbacks.h" -#include "shared/source/os_interface/windows/wddm_device_command_stream.h" +#include "shared/source/gmm_helper/gmm_callbacks.h" #include "shared/test/common/cmd_parse/hw_parse.h" #include "shared/test/common/fixtures/gmm_callbacks_fixture.h" -#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/libult/ult_command_stream_receiver.h" #include "shared/test/common/test_macros/hw_test.h" -using namespace NEO; +using GmmCallbacksTests = ::Test; -using Gen12LpGmmCallbacksTests = ::Test; - -template -struct MockAubCsrToTestNotifyAubCapture : public AUBCommandStreamReceiverHw { - using AUBCommandStreamReceiverHw::AUBCommandStreamReceiverHw; - using AUBCommandStreamReceiverHw::externalAllocations; -}; - -GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCsrWithoutAubDumpWhenNotifyAubCaptureCallbackIsCalledThenDoNothing) { - auto csr = std::make_unique>(*executionEnvironment, 0, 1); +HWTEST_F(GmmCallbacksTests, givenCsrWithoutAubDumpWhenNotifyAubCaptureCallbackIsCalledThenDoNothing) { + UltCommandStreamReceiver csr(*executionEnvironment, 0, 1); uint64_t address = 0xFEDCBA9876543210; size_t size = 1024; - auto res = DeviceCallbacks::notifyAubCapture(csr.get(), address, size, true); + auto res = GmmCallbacks::notifyAubCapture(&csr, address, size, true); EXPECT_EQ(1, res); } -GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenWddmCsrWhenWriteL3CalledThenWriteTwoMmio) { +HWTEST_F(GmmCallbacksTests, whenWriteL3CalledThenWriteTwoMmio) { using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM; UltCommandStreamReceiver csr(*executionEnvironment, 0, 1); @@ -50,7 +34,7 @@ GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenWddmCsrWhenWriteL3CalledThenWriteTw uint64_t address = 0x00234564002BCDEC; uint64_t value = 0xFEDCBA987654321C; - auto res = TTCallbacks::writeL3Address(&csr, value, address); + auto res = GmmCallbacks::writeL3Address(&csr, value, address); EXPECT_EQ(1, res); EXPECT_EQ(2 * sizeof(MI_LOAD_REGISTER_IMM), csr.commandStream.getUsed()); @@ -69,8 +53,8 @@ GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenWddmCsrWhenWriteL3CalledThenWriteTw EXPECT_EQ(value >> 32, cmd->getDataDword()); } -GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCcsEnabledhenWriteL3CalledThenSetRemapBit) { - typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM; +HWTEST_F(GmmCallbacksTests, givenCcsEnabledhenWriteL3CalledThenSetRemapBit) { + using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM; HardwareInfo localHwInfo = *defaultHwInfo; localHwInfo.featureTable.flags.ftrCCSNode = true; ExecutionEnvironment executionEnvironment; @@ -81,7 +65,7 @@ GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCcsEnabledhenWriteL3CalledThenSetRe uint8_t buffer[128] = {}; csr.commandStream.replaceBuffer(buffer, 128); - auto res = TTCallbacks::writeL3Address(&csr, 1, 1); + auto res = GmmCallbacks::writeL3Address(&csr, 1, 1); EXPECT_EQ(1, res); HardwareParse hwParse; @@ -97,8 +81,8 @@ GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCcsEnabledhenWriteL3CalledThenSetRe EXPECT_TRUE(cmd->getMmioRemapEnable()); } -GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCcsDisabledhenWriteL3CalledThenSetRemapBitToTrue) { - typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM; +HWTEST_F(GmmCallbacksTests, givenCcsDisabledhenWriteL3CalledThenSetRemapBitToTrue) { + using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM; HardwareInfo localHwInfo = *defaultHwInfo; localHwInfo.featureTable.flags.ftrCCSNode = false; ExecutionEnvironment executionEnvironment; @@ -109,7 +93,7 @@ GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCcsDisabledhenWriteL3CalledThenSetR uint8_t buffer[128] = {}; csr.commandStream.replaceBuffer(buffer, 128); - auto res = TTCallbacks::writeL3Address(&csr, 1, 1); + auto res = GmmCallbacks::writeL3Address(&csr, 1, 1); EXPECT_EQ(1, res); HardwareParse hwParse; @@ -123,4 +107,4 @@ GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCcsDisabledhenWriteL3CalledThenSetR cmd = genCmdCast(*(++hwParse.cmdList.begin())); ASSERT_NE(nullptr, cmd); EXPECT_TRUE(cmd->getMmioRemapEnable()); -} +} \ No newline at end of file diff --git a/shared/test/unit_test/os_interface/windows/device_command_stream_tests.cpp b/shared/test/unit_test/os_interface/windows/device_command_stream_tests.cpp index bd76ab9fc2..61b83c8946 100644 --- a/shared/test/unit_test/os_interface/windows/device_command_stream_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/device_command_stream_tests.cpp @@ -9,9 +9,9 @@ #include "shared/source/command_stream/preemption.h" #include "shared/source/direct_submission/direct_submission_controller.h" #include "shared/source/direct_submission/relaxed_ordering_helper.h" +#include "shared/source/gmm_helper/gmm_callbacks.h" #include "shared/source/helpers/compiler_product_helper.h" #include "shared/source/helpers/gfx_core_helper.h" -#include "shared/source/helpers/windows/gmm_callbacks.h" #include "shared/source/indirect_heap/indirect_heap.h" #include "shared/source/memory_manager/internal_allocation_storage.h" #include "shared/source/os_interface/sys_calls_common.h" @@ -1046,7 +1046,7 @@ HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenInitial GMM_TRANSLATIONTABLE_CALLBACKS expectedTTCallbacks = {}; unsigned int expectedFlags = TT_TYPE::AUXTT; - expectedTTCallbacks.pfWriteL3Adr = TTCallbacks::writeL3Address; + expectedTTCallbacks.pfWriteL3Adr = GmmCallbacks::writeL3Address; EXPECT_TRUE(memcmp(&expectedTTCallbacks, &mockMngr->translationTableCb, sizeof(GMM_TRANSLATIONTABLE_CALLBACKS)) == 0); EXPECT_TRUE(memcmp(&expectedFlags, &mockMngr->translationTableFlags, sizeof(unsigned int)) == 0); diff --git a/shared/test/unit_test/os_interface/windows/wddm_command_stream_l0_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_command_stream_l0_tests.cpp index 583e65594e..eee990e6ad 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_command_stream_l0_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_command_stream_l0_tests.cpp @@ -14,7 +14,6 @@ #include "shared/source/direct_submission/windows/wddm_direct_submission.h" #include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/flush_stamp.h" -#include "shared/source/helpers/windows/gmm_callbacks.h" #include "shared/source/memory_manager/internal_allocation_storage.h" #include "shared/source/memory_manager/memory_manager.h" #include "shared/source/os_interface/os_interface.h" diff --git a/shared/test/unit_test/os_interface/windows/wddm_windows_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_windows_tests.cpp index 6f28eb3d36..12de8ecf45 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_windows_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_windows_tests.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/debug_settings/debug_settings_manager.h" +#include "shared/source/gmm_helper/gmm_callbacks.h" #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/os_interface/windows/driver_info_windows.h" #include "shared/source/os_interface/windows/dxgi_wrapper.h" @@ -184,10 +185,6 @@ TEST(WddmGfxPartitionTests, WhenInitializingGfxPartitionThen64KBHeapsAreUsed) { EXPECT_EQ(wddm->gfxPartition.Standard64KB.Base + rootDeviceIndex * heapStandard64KBSize, gfxPartition.getHeapBase(HeapIndex::heapStandard64KB)); } -namespace NEO { -long __stdcall notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate); -} - TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoSucceedsThenDeviceCallbacksArePassedToGmmMemory) { GMM_DEVICE_CALLBACKS_INT expectedDeviceCb{}; wddm->init(); @@ -213,7 +210,7 @@ TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoSucceedsThenDeviceCallbacksAr expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnUnLock = gdi->unlock2; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEscape = gdi->escape; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnFreeGPUVA = gdi->freeGpuVirtualAddress; - expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture = notifyAubCapture; + expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture = notifyAubCaptureFuncFactory[defaultHwInfo->platform.eRenderCoreFamily]; EXPECT_EQ(expectedDeviceCb.Adapter.KmtHandle, gmmMemory->deviceCallbacks.Adapter.KmtHandle); EXPECT_EQ(expectedDeviceCb.hDevice.KmtHandle, gmmMemory->deviceCallbacks.hDevice.KmtHandle); @@ -234,6 +231,7 @@ TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoSucceedsThenDeviceCallbacksAr EXPECT_EQ(expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEscape, gmmMemory->deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnEscape); EXPECT_EQ(expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnFreeGPUVA, gmmMemory->deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnFreeGPUVA); EXPECT_EQ(expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture, gmmMemory->deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture); + EXPECT_NE(nullptr, gmmMemory->deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture); } class MockGmmMemoryWindows : public MockGmmMemoryBase {