-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathail_configuration.h
161 lines (123 loc) · 5.25 KB
/
ail_configuration.h
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
156
157
158
159
160
161
/*
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "igfxfmid.h"
#include <cstdint>
#include <memory>
#include <set>
#include <string>
/*
* AIL (Application Intelligence Layer) is a set of per-application controls that influence driver behavior.
* The primary goal is to improve user experience and/or performance.
*
* AIL provides application detection mechanism based on running processes in the system.
* Mechanism works on Windows and Linux, is flexible and easily extendable to new applications.
*
* E.g. AIL can detect running Blender application and enable fp64 emulation on hardware
* that does not support native fp64.
*
* Disclaimer: we should never use this for benchmarking or conformance purposes - this would be cheating.
*
*/
namespace NEO {
extern const char legacyPlatformName[];
struct RuntimeCapabilityTable;
enum class AILEnumeration : uint32_t {
disableCompression,
enableFp64,
disableHostPtrTracking,
enableLegacyPlatformName,
disableDirectSubmission,
handleDivergentBarriers,
disableBindlessAddressing,
};
class AILConfiguration;
using AILConfigurationCreateFunctionType = std::unique_ptr<AILConfiguration> (*)();
extern AILConfigurationCreateFunctionType ailConfigurationFactory[IGFX_MAX_PRODUCT];
class AILConfiguration {
public:
static std::unique_ptr<AILConfiguration> create(PRODUCT_FAMILY product) {
auto ailConfigurationCreateFunction = ailConfigurationFactory[product];
if (ailConfigurationCreateFunction == nullptr) {
return nullptr;
}
auto ailConfiguration = ailConfigurationCreateFunction();
return ailConfiguration;
}
AILConfiguration() = default;
MOCKABLE_VIRTUAL bool initProcessExecutableName();
virtual void apply(RuntimeCapabilityTable &runtimeCapabilityTable);
virtual void modifyKernelIfRequired(std::string &kernel) = 0;
virtual bool isContextSyncFlagRequired() = 0;
virtual bool is256BPrefetchDisableRequired() = 0;
virtual bool drainHostptrs() = 0;
virtual bool isBufferPoolEnabled() = 0;
virtual ~AILConfiguration() = default;
virtual bool useLegacyValidationLogic() = 0;
virtual bool forceRcs() = 0;
virtual bool handleDivergentBarriers() = 0;
virtual bool disableBindlessAddressing() = 0;
virtual bool limitAmountOfDeviceMemoryForRecycling() = 0;
virtual bool isRunAloneContextRequired() = 0;
virtual bool isFallbackToPatchtokensRequired() = 0;
virtual bool isAdjustMicrosecondResolutionRequired() = 0;
virtual uint32_t getMicrosecondResolution() = 0;
protected:
virtual void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) = 0;
std::string processName;
bool sourcesContain(const std::string &sources, std::string_view contentToFind) const;
MOCKABLE_VIRTUAL bool isKernelHashCorrect(const std::string &kernelSources, uint64_t expectedHash) const;
virtual void setHandleDivergentBarriers(bool val) = 0;
virtual void setDisableBindlessAddressing(bool val) = 0;
};
extern const std::set<std::string_view> applicationsContextSyncFlag;
extern const std::set<std::string_view> applicationsForceRcsDg2;
extern const std::set<std::string_view> applicationsBufferPoolDisabled;
extern const std::set<std::string_view> applicationsBufferPoolDisabledXe;
extern const std::set<std::string_view> applicationsOverfetchDisabled;
extern const std::set<std::string_view> applicationsDrainHostptrsDisabled;
extern const std::set<std::string_view> applicationsDeviceUSMRecyclingLimited;
extern const std::set<std::string_view> applicationsFallbackToPatchtokensRequiredDg2;
extern const std::set<std::string_view> applicationsMicrosecontResolutionAdjustment;
extern const uint32_t microsecondAdjustment;
template <PRODUCT_FAMILY product>
class AILConfigurationHw : public AILConfiguration {
public:
static std::unique_ptr<AILConfiguration> create() {
return std::make_unique<AILConfigurationHw>();
}
void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) override;
void modifyKernelIfRequired(std::string &kernel) override;
bool isContextSyncFlagRequired() override;
bool is256BPrefetchDisableRequired() override;
bool drainHostptrs() override;
bool isBufferPoolEnabled() override;
bool useLegacyValidationLogic() override;
bool forceRcs() override;
bool handleDivergentBarriers() override;
bool disableBindlessAddressing() override;
bool limitAmountOfDeviceMemoryForRecycling() override;
bool isRunAloneContextRequired() override;
bool isFallbackToPatchtokensRequired() override;
bool isAdjustMicrosecondResolutionRequired() override;
uint32_t getMicrosecondResolution() override;
bool shouldForceRcs = false;
bool shouldHandleDivergentBarriers = false;
bool shouldDisableBindlessAddressing = false;
bool shouldAdjustMicrosecondResolution = false;
protected:
void setHandleDivergentBarriers(bool val) override;
void setDisableBindlessAddressing(bool val) override;
};
template <PRODUCT_FAMILY product>
struct EnableAIL {
EnableAIL() {
auto ailConfigurationCreateFunction = AILConfigurationHw<product>::create;
ailConfigurationFactory[product] = ailConfigurationCreateFunction;
}
};
} // namespace NEO