File: common_types.h

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 (155 lines) | stat: -rw-r--r-- 3,759 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
 * Copyright (C) 2019-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#pragma once
#include "shared/source/sku_info/sku_info_base.h"
#include "shared/source/utilities/stackvec.h"

#include <cstdint>
#include <memory>
#include <type_traits>
#include <vector>

namespace NEO {
class GraphicsAllocation;
struct EngineControl;
using EngineControlContainer = std::vector<EngineControl>;
using MultiDeviceEngineControlContainer = StackVec<EngineControlContainer, 6u>;
class Device;
using DeviceVector = std::vector<std::unique_ptr<Device>>;
using PrivateAllocsToReuseContainer = StackVec<std::pair<uint32_t, GraphicsAllocation *>, 8>;

// std::to_underlying is C++23 feature
template <typename EnumT>
constexpr auto toUnderlying(EnumT scopedEnumValue) {
    static_assert(std::is_enum_v<EnumT>);
    static_assert(!std::is_convertible_v<EnumT, std::underlying_type_t<EnumT>>);

    return static_cast<std::underlying_type_t<EnumT>>(scopedEnumValue);
}

template <typename EnumT>
    requires(std::is_enum_v<EnumT> && !std::is_convertible_v<EnumT, std::underlying_type_t<EnumT>>)
constexpr auto toEnum(std::underlying_type_t<EnumT> region) {
    return static_cast<EnumT>(region);
}

enum class DebugPauseState : uint32_t {
    disabled,
    waitingForFirstSemaphore,
    waitingForUserStartConfirmation,
    hasUserStartConfirmation,
    waitingForUserEndConfirmation,
    hasUserEndConfirmation,
    terminate
};

enum class ColouringPolicy : uint32_t {
    deviceCountBased,
    chunkSizeBased,
    mappingBased
};

class TagTypeBase {
};

enum class TagNodeType {
    timestampPacket,
    hwTimeStamps,
    hwPerfCounter,
    counter64b,
    fillPattern
};

enum class CacheRegion : uint16_t {
    defaultRegion = 0,
    region1,
    region2,
    region3,
    count,
    none = 0xFFFF
};
constexpr inline auto toCacheRegion(std::underlying_type_t<CacheRegion> region) {
    DEBUG_BREAK_IF(region >= toUnderlying(CacheRegion::count));
    return toEnum<CacheRegion>(region);
}

enum class CacheLevel : uint16_t {
    defaultLevel = 0,
    level2 = 2,
    level3 = 3
};
constexpr inline auto toCacheLevel(std::underlying_type_t<CacheRegion> level) {
    DEBUG_BREAK_IF(level == 1U);
    DEBUG_BREAK_IF(level > 3U);
    return toEnum<CacheLevel>(level);
}

enum class CachePolicy : uint32_t {
    uncached = 0,
    writeCombined = 1,
    writeThrough = 2,
    writeBack = 3,
};

enum class PreferredLocation : int16_t {
    clear = -1,
    system = 0,
    device = 1,
    none = 2,
    defaultLocation = device
};

enum class PostSyncMode : uint32_t {
    noWrite = 0,
    timestamp = 1,
    immediateData = 2,
};

enum class AtomicAccessMode : uint32_t {
    none = 1,
    host = 2,
    device = 3,
    system = 4,
    invalid = 5
};

enum class SynchronizedDispatchMode : uint32_t {
    disabled = 0,
    full = 1,
    limited = 2
};

enum class LocalMemAllocationMode : uint32_t {
    hwDefault = 0U,
    localOnly = 1U,
    localPreferred = 2U,
    count = 3U
};
constexpr inline auto toLocalMemAllocationMode(std::underlying_type_t<LocalMemAllocationMode> modeFlag) {
    DEBUG_BREAK_IF(modeFlag >= toUnderlying(LocalMemAllocationMode::count));
    return toEnum<LocalMemAllocationMode>(modeFlag);
}

namespace InterruptId {
static constexpr uint32_t notUsed = std::numeric_limits<uint32_t>::max();
}

namespace TypeTraits {
template <typename T>
constexpr bool isPodV = std::is_standard_layout_v<T> && std::is_trivial_v<T> && std::is_trivially_copyable_v<T>;
} // namespace TypeTraits

struct BcsSplitSettings {
    BcsInfoMask allEngines = {};
    BcsInfoMask h2dEngines = {};
    BcsInfoMask d2hEngines = {};
    uint32_t minRequiredTotalCsrCount = 0;
    uint32_t requiredTileCount = 0;
    bool enabled = false;
};
} // namespace NEO