File: csr_deps_tests.cpp

package info (click to toggle)
intel-compute-runtime 25.44.36015.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 79,632 kB
  • sloc: cpp: 931,547; lisp: 2,074; sh: 719; makefile: 162; python: 21
file content (33 lines) | stat: -rw-r--r-- 1,389 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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<MockMemoryManager>();
    MockCommandStreamReceiver csr(executionEnvironment, 0, 0);
    CsrDependencies csrDeps;
    MockTagAllocator<HwTimeStamps> timeStampAllocator(0u, executionEnvironment.memoryManager.get(), 10,
                                                      MemoryConstants::cacheLineSize, sizeof(HwTimeStamps), false, 0);
    auto timestampPacketContainer = std::make_unique<TimestampPacketContainer>();

    auto node = timeStampAllocator.getTag();
    timestampPacketContainer->add(node);

    csrDeps.multiRootTimeStampSyncContainer.push_back(timestampPacketContainer.get());
    csrDeps.makeResident(csr);
    EXPECT_EQ(csr.makeResidentCalledTimes, 1u);
}