From b1e8ca5d5978b8a85e0e72c33f95b506a5f9bedf Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Mon, 13 Feb 2023 15:24:53 +0000 Subject: [PATCH] fix make resident dependent multi root device tags Signed-off-by: Maciej Plewka --- shared/source/command_stream/csr_deps.cpp | 3 ++ .../unit_test/command_stream/CMakeLists.txt | 3 +- .../command_stream/csr_deps_tests.cpp | 33 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 shared/test/unit_test/command_stream/csr_deps_tests.cpp diff --git a/shared/source/command_stream/csr_deps.cpp b/shared/source/command_stream/csr_deps.cpp index 0ae2ab90fb..ab19846a0a 100644 --- a/shared/source/command_stream/csr_deps.cpp +++ b/shared/source/command_stream/csr_deps.cpp @@ -15,6 +15,9 @@ void CsrDependencies::makeResident(CommandStreamReceiver &commandStreamReceiver) for (auto ×tampPacketContainer : timestampPacketContainer) { timestampPacketContainer->makeResident(commandStreamReceiver); } + for (auto ×tampPacketContainer : multiRootTimeStampSyncContainer) { + timestampPacketContainer->makeResident(commandStreamReceiver); + } } void CsrDependencies::copyNodesToNewContainer(TimestampPacketContainer &newTimestampPacketContainer) { diff --git a/shared/test/unit_test/command_stream/CMakeLists.txt b/shared/test/unit_test/command_stream/CMakeLists.txt index 9d30cda3ad..66e15f86a1 100644 --- a/shared/test/unit_test/command_stream/CMakeLists.txt +++ b/shared/test/unit_test/command_stream/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2021-2022 Intel Corporation +# Copyright (C) 2021-2023 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -16,6 +16,7 @@ target_sources(neo_shared_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_with_aub_dump_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests.h + ${CMAKE_CURRENT_SOURCE_DIR}/csr_deps_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/get_devices_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/linear_stream_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/stream_properties_tests_common.cpp diff --git a/shared/test/unit_test/command_stream/csr_deps_tests.cpp b/shared/test/unit_test/command_stream/csr_deps_tests.cpp new file mode 100644 index 0000000000..19ea3d22ff --- /dev/null +++ b/shared/test/unit_test/command_stream/csr_deps_tests.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2023 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/command_stream/csr_deps.h" +#include "shared/source/utilities/hw_timestamps.h" +#include "shared/test/common/mocks/mock_command_stream_receiver.h" +#include "shared/test/common/mocks/mock_execution_environment.h" +#include "shared/test/common/mocks/mock_memory_manager.h" +#include "shared/test/common/mocks/mock_timestamp_container.h" +#include "shared/test/common/test_macros/test.h" + +using namespace NEO; + +TEST(CsrDepsTests, givenCsrDepsWhenMakeResidentCalledThenMultiRootSyncNodeAreMadeResident) { + MockExecutionEnvironment executionEnvironment; + executionEnvironment.memoryManager = std::make_unique(); + MockCommandStreamReceiver csr(executionEnvironment, 0, 0); + CsrDependencies csrDeps; + MockTagAllocator timeStampAllocator(0u, executionEnvironment.memoryManager.get(), 10, + MemoryConstants::cacheLineSize, sizeof(HwTimeStamps), false, 0); + auto timestampPacketContainer = std::make_unique(); + + auto node = timeStampAllocator.getTag(); + timestampPacketContainer->add(node); + + csrDeps.multiRootTimeStampSyncContainer.push_back(timestampPacketContainer.get()); + csrDeps.makeResident(csr); + EXPECT_EQ(csr.makeResidentCalledTimes, 1u); +} \ No newline at end of file