File: preamble_xe_hpg_and_xe_hpc.inl

package info (click to toggle)
intel-compute-runtime 25.35.35096.9-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 79,324 kB
  • sloc: cpp: 926,243; lisp: 3,433; sh: 715; makefile: 162; python: 21
file content (90 lines) | stat: -rw-r--r-- 3,373 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Copyright (C) 2023-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/pipe_control_args.h"
#include "shared/source/helpers/pipeline_select_args.h"
#include "shared/source/helpers/pipeline_select_helper.h"
#include "shared/source/helpers/preamble.h"

namespace NEO {

template <typename Family>
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
                                                   const PipelineSelectArgs &pipelineSelectArgs,
                                                   const RootDeviceEnvironment &rootDeviceEnvironment) {

    using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;

    PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;

    if (MemorySynchronizationCommands<Family>::isBarrierPriorToPipelineSelectWaRequired(rootDeviceEnvironment)) {
        PipeControlArgs args;
        args.renderTargetCacheFlushEnable = true;
        MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
    }

    if (debugManager.flags.CleanStateInPreamble.get()) {
        auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
        cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_3D);
        *cmdBuffer = cmd;

        PipeControlArgs args = {};
        args.stateCacheInvalidationEnable = true;
        MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
    }

    auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();

    auto mask = pipelineSelectEnablePipelineSelectMaskBits;

    cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);

    bool systolicSupport = pipelineSelectArgs.systolicPipelineSelectSupport;
    bool systolicValue = pipelineSelectArgs.systolicPipelineSelectMode;
    int32_t overrideSystolic = debugManager.flags.OverrideSystolicPipelineSelect.get();

    if (overrideSystolic != -1) {
        systolicSupport = true;
        systolicValue = !!overrideSystolic;
    }

    if (systolicSupport) {
        cmd.setSystolicModeEnable(systolicValue);
        mask |= pipelineSelectSystolicModeEnableMaskBits;
    }

    cmd.setMaskBits(mask);

    *cmdBuffer = cmd;

    if (debugManager.flags.CleanStateInPreamble.get()) {
        PipeControlArgs args = {};
        args.stateCacheInvalidationEnable = true;
        MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
    }
}

template <typename Family>
size_t PreambleHelper<Family>::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) {
    size_t size = 0;
    using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
    size += sizeof(PIPELINE_SELECT);
    if (MemorySynchronizationCommands<Family>::isBarrierPriorToPipelineSelectWaRequired(rootDeviceEnvironment)) {
        size += MemorySynchronizationCommands<Family>::getSizeForSingleBarrier();
    }
    if (debugManager.flags.CleanStateInPreamble.get()) {
        size += sizeof(PIPELINE_SELECT);
        size += 2 * MemorySynchronizationCommands<Family>::getSizeForSingleBarrier();
    }
    return size;
}

} // namespace NEO