File: timestamp_packet.cpp

package info (click to toggle)
intel-compute-runtime 22.43.24595.41-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 57,740 kB
  • sloc: cpp: 631,142; lisp: 3,515; sh: 470; makefile: 76; python: 21
file content (58 lines) | stat: -rw-r--r-- 2,112 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright (C) 2018-2021 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/source/helpers/timestamp_packet.h"

#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/utilities/tag_allocator.h"

using namespace NEO;

void TimestampPacketContainer::add(TagNodeBase *timestampPacketNode) {
    timestampPacketNodes.push_back(timestampPacketNode);
}

TimestampPacketContainer::~TimestampPacketContainer() {
    for (auto node : timestampPacketNodes) {
        node->returnTag();
    }
}

void TimestampPacketContainer::swapNodes(TimestampPacketContainer &timestampPacketContainer) {
    timestampPacketNodes.swap(timestampPacketContainer.timestampPacketNodes);
}

void TimestampPacketContainer::assignAndIncrementNodesRefCounts(const TimestampPacketContainer &inputTimestampPacketContainer) {
    auto &inputNodes = inputTimestampPacketContainer.peekNodes();
    std::copy(inputNodes.begin(), inputNodes.end(), std::back_inserter(timestampPacketNodes));

    for (auto node : inputNodes) {
        node->incRefCount();
    }
}

void TimestampPacketContainer::makeResident(CommandStreamReceiver &commandStreamReceiver) {
    for (auto node : timestampPacketNodes) {
        commandStreamReceiver.makeResident(*node->getBaseGraphicsAllocation());
    }
}

void TimestampPacketContainer::moveNodesToNewContainer(TimestampPacketContainer &timestampPacketContainer) {
    TimestampPacketContainer tempContainer;
    swapNodes(tempContainer);

    timestampPacketContainer.assignAndIncrementNodesRefCounts(tempContainer);
}

void TimestampPacketDependencies::moveNodesToNewContainer(TimestampPacketContainer &timestampPacketContainer) {
    cacheFlushNodes.moveNodesToNewContainer(timestampPacketContainer);
    previousEnqueueNodes.moveNodesToNewContainer(timestampPacketContainer);
    barrierNodes.moveNodesToNewContainer(timestampPacketContainer);
    auxToNonAuxNodes.moveNodesToNewContainer(timestampPacketContainer);
    nonAuxToAuxNodes.moveNodesToNewContainer(timestampPacketContainer);
}