Skip to content

Commit 1c8a503

Browse files
Add initial AIL implementation
Related-To: NEO-6390 Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
1 parent 91dfa5c commit 1c8a503

File tree

5 files changed

+64
-1
lines changed

5 files changed

+64
-1
lines changed

shared/source/ail/ail_configuration.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111
#include <string_view>
1212

1313
namespace NEO {
14-
std::map<std::string_view, std::vector<AILEnumeration>> applicationMap = {};
14+
/*
15+
* fp64 support is unavailable on some Intel GPUs, and the SW emulation in IGC should not be enabled by default.
16+
* For Blender, fp64 is not performance-critical - SW emulation is good enough for the application to be usable
17+
* (some versions would not function correctly without it).
18+
*
19+
*/
20+
21+
std::map<std::string_view, std::vector<AILEnumeration>> applicationMap = {{"blender", {AILEnumeration::ENABLE_FP64}}};
1522

1623
AILConfiguration *ailConfigurationTable[IGFX_MAX_PRODUCT] = {};
1724

@@ -20,6 +27,20 @@ AILConfiguration *AILConfiguration::get(PRODUCT_FAMILY productFamily) {
2027
}
2128

2229
void AILConfiguration::apply(RuntimeCapabilityTable &runtimeCapabilityTable) {
30+
auto search = applicationMap.find(processName);
31+
32+
if (search != applicationMap.end()) {
33+
for (size_t i = 0; i < search->second.size(); ++i) {
34+
switch (search->second[i]) {
35+
case AILEnumeration::ENABLE_FP64:
36+
runtimeCapabilityTable.ftrSupportsFP64 = true;
37+
break;
38+
default:
39+
break;
40+
}
41+
}
42+
}
43+
2344
applyExt(runtimeCapabilityTable);
2445
}
2546

shared/source/ail/ail_configuration.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@
1111

1212
#pragma once
1313

14+
/*
15+
* AIL (Application Intelligence Layer) is a set of per-application controls that influence driver behavior.
16+
* The primary goal is to improve user experience and/or performance.
17+
*
18+
* AIL provides application detection mechanism based on running processes in the system.
19+
* Mechanism works on Windows and Linux, is flexible and easily extendable to new applications.
20+
*
21+
* E.g. AIL can detect running Blender application and enable fp64 emulation on hardware
22+
* that does not support native fp64.
23+
*
24+
* Disclaimer: we should never use this for benchmarking or conformance purposes - this would be cheating.
25+
*
26+
*/
27+
1428
namespace NEO {
1529

1630
enum class AILEnumeration : uint32_t {

shared/source/ail/linux/ail_configuration_linux.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#include <string_view>
1212

13+
// Application detection is performed using the process name of the given application.
14+
1315
namespace NEO {
1416
bool AILConfiguration::initProcessExecutableName() {
1517
char path[512] = {0};

shared/source/ail/windows/ail_configuration_windows.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "shared/source/ail/ail_configuration.h"
99
#include "shared/source/os_interface/windows/sys_calls.h"
1010

11+
// Application detection is performed using the process name of the given application.
12+
1113
namespace NEO {
1214
bool AILConfiguration::initProcessExecutableName() {
1315
const DWORD length = MAX_PATH;

shared/test/unit_test/ail/ail_tests.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,41 @@
77

88
#include "shared/source/ail/ail_configuration.h"
99
#include "shared/test/common/helpers/unit_test_helper.h"
10+
#include "shared/test/common/helpers/variable_backup.h"
1011

1112
#include "test.h"
1213

1314
namespace NEO {
1415
using IsSKL = IsProduct<IGFX_SKYLAKE>;
1516

1617
using AILTests = ::testing::Test;
18+
template <PRODUCT_FAMILY productFamily>
19+
class AILMock : public AILConfigurationHw<productFamily> {
20+
public:
21+
using AILConfiguration::processName;
22+
};
1723

1824
HWTEST2_F(AILTests, givenUninitializedTemplateWhenGetAILConfigurationThenNullptrIsReturned, IsSKL) {
1925
auto ailConfiguration = AILConfiguration::get(productFamily);
2026

2127
ASSERT_EQ(nullptr, ailConfiguration);
2228
}
29+
30+
HWTEST2_F(AILTests, givenInitilizedTemplateWhenApplyWithBlenderIsCalledThenFP64SupportIsEnabled, IsAtLeastGen12lp) {
31+
VariableBackup<AILConfiguration *> ailConfigurationBackup(&ailConfigurationTable[productFamily]);
32+
33+
AILMock<productFamily> ailTemp;
34+
ailTemp.processName = "blender";
35+
ailConfigurationTable[productFamily] = &ailTemp;
36+
37+
auto ailConfiguration = AILConfiguration::get(productFamily);
38+
ASSERT_NE(nullptr, ailConfiguration);
39+
40+
NEO::RuntimeCapabilityTable rtTable = {};
41+
rtTable.ftrSupportsFP64 = false;
42+
43+
ailConfiguration->apply(rtTable);
44+
45+
EXPECT_EQ(rtTable.ftrSupportsFP64, true);
46+
}
2347
} // namespace NEO

0 commit comments

Comments
 (0)