Skip to content

Commit 5c2329e

Browse files
fix: Correct AIL initialization in runtime
- Initialize AIL helper in runtime (linux/windows/AUB path). - Return false if AIL configuration initialization is called with empty AIL helper (is nullptr). - Skip mentioned condition if AIL is disabled via EnableAIL debug key. Related-To: NEO-9240 Signed-off-by: Kacper Nowak <[email protected]> Source: 4a00640
1 parent efd3cc9 commit 5c2329e

File tree

14 files changed

+154
-117
lines changed

14 files changed

+154
-117
lines changed

opencl/test/unit_test/linux/main_linux_dll.cpp

Lines changed: 71 additions & 87 deletions
Large diffs are not rendered by default.

shared/source/execution_environment/root_device_environment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void RootDeviceEnvironment::prepareForCleanup() const {
102102

103103
bool RootDeviceEnvironment::initAilConfiguration() {
104104
if (ailConfiguration == nullptr) {
105-
return true;
105+
return (false == DebugManager.flags.EnableAIL.get());
106106
}
107107

108108
auto result = ailConfiguration->initProcessExecutableName();

shared/source/os_interface/device_factory.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
6363
rootDeviceEnvironment.initGfxCoreHelper();
6464
rootDeviceEnvironment.initApiGfxCoreHelper();
6565
rootDeviceEnvironment.initCompilerProductHelper();
66+
rootDeviceEnvironment.initAilConfigurationHelper();
67+
if (false == rootDeviceEnvironment.initAilConfiguration()) {
68+
return false;
69+
}
6670

6771
auto hardwareInfo = rootDeviceEnvironment.getMutableHardwareInfo();
6872

shared/source/os_interface/linux/drm_neo.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,12 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl
436436
rootDeviceEnvironment.initGfxCoreHelper();
437437
rootDeviceEnvironment.initApiGfxCoreHelper();
438438
rootDeviceEnvironment.initCompilerProductHelper();
439+
rootDeviceEnvironment.initAilConfigurationHelper();
440+
auto result = rootDeviceEnvironment.initAilConfiguration();
441+
if (false == result) {
442+
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: AIL creation failed!\n");
443+
return -1;
444+
}
439445

440446
hwInfo->platform.usDeviceID = deviceId;
441447
hwInfo->platform.usRevId = revisionId;

shared/source/os_interface/linux/os_interface_linux.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ bool initDrmOsInterface(std::unique_ptr<HwDeviceId> &&hwDeviceId, uint32_t rootD
5252
}
5353
rootDeviceEnv->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, rootDeviceIndex);
5454

55-
[[maybe_unused]] bool result = rootDeviceEnv->initAilConfiguration();
56-
DEBUG_BREAK_IF(!result);
57-
5855
return true;
5956
}
6057

shared/source/os_interface/windows/wddm/wddm.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ bool Wddm::init() {
114114
productHelper.adjustPlatformForProductFamily(hardwareInfo);
115115
rootDeviceEnvironment.initApiGfxCoreHelper();
116116
rootDeviceEnvironment.initGfxCoreHelper();
117+
rootDeviceEnvironment.initAilConfigurationHelper();
118+
if (false == rootDeviceEnvironment.initAilConfiguration()) {
119+
return false;
120+
}
117121

118122
populateIpVersion(*hardwareInfo);
119123
rootDeviceEnvironment.initReleaseHelper();
@@ -129,9 +133,6 @@ bool Wddm::init() {
129133
rootDeviceEnvironment.initGmm();
130134
this->rootDeviceEnvironment.getGmmClientContext()->setHandleAllocator(this->hwDeviceId->getUmKmDataTranslator()->createGmmHandleAllocator());
131135

132-
[[maybe_unused]] bool result = rootDeviceEnvironment.initAilConfiguration();
133-
DEBUG_BREAK_IF(!result);
134-
135136
if (WddmVersion::WDDM_2_3 == getWddmVersion()) {
136137
wddmInterface = std::make_unique<WddmInterface23>(*this);
137138
} else {

shared/test/common/mocks/mock_ail_configuration.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
namespace NEO {
1313
class MockAILConfiguration : public AILConfiguration {
1414
public:
15+
bool initProcessExecutableNameResult = true;
1516
bool initProcessExecutableName() override {
16-
return true;
17+
return initProcessExecutableNameResult;
1718
}
1819
void modifyKernelIfRequired(std::string &kernel) override {}
1920

shared/test/common/mocks/mock_execution_environment.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ bool MockRootDeviceEnvironment::initOsInterface(std::unique_ptr<HwDeviceId> &&hw
3737
}
3838
return RootDeviceEnvironment::initOsInterface(std::move(hwDeviceId), rootDeviceIndex);
3939
}
40+
bool MockRootDeviceEnvironment::initAilConfiguration() {
41+
if (ailInitializationResult.has_value()) {
42+
return *ailInitializationResult;
43+
} else
44+
return RootDeviceEnvironment::initAilConfiguration();
45+
}
4046

4147
MockRootDeviceEnvironment::~MockRootDeviceEnvironment() {
4248
if (initOsInterfaceExpectedCallCount) {

shared/test/common/mocks/mock_execution_environment.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct MockRootDeviceEnvironment : public RootDeviceEnvironment {
2424

2525
void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) override;
2626
bool initOsInterface(std::unique_ptr<HwDeviceId> &&hwDeviceId, uint32_t rootDeviceIndex) override;
27+
bool initAilConfiguration() override;
2728

2829
std::vector<bool> initOsInterfaceResults;
2930
uint32_t initOsInterfaceCalled = 0u;
@@ -32,6 +33,7 @@ struct MockRootDeviceEnvironment : public RootDeviceEnvironment {
3233
bool localMemoryEnabledReceived = false;
3334
std::string aubFileNameReceived = "";
3435
bool useMockAubCenter = true;
36+
std::optional<bool> ailInitializationResult{true};
3537
};
3638

3739
struct MockExecutionEnvironment : ExecutionEnvironment {

shared/test/unit_test/ail/ail_tests.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,6 @@ HWTEST2_F(AILTests, givenPreGen12AndAndProcessNameIsNotResolveWhenApplyWithDavin
138138
EXPECT_TRUE(rtTable.hostPtrTrackingEnabled);
139139
}
140140

141-
HWTEST_F(AILTests, GivenPlatformHasNoAilAvailableWhenAilIsEnabledThenAilInitializationReturnsTrue) {
142-
DebugManagerStateRestore restore;
143-
NEO::DebugManager.flags.EnableAIL.set(true);
144-
145-
HardwareInfo hwInfo{};
146-
hwInfo.platform.eProductFamily = productFamily;
147-
hwInfo.platform.eRenderCoreFamily = renderCoreFamily;
148-
149-
NEO::MockExecutionEnvironment executionEnvironment{&hwInfo, true, 1};
150-
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[0].get();
151-
rootDeviceEnvironment->ailConfiguration.reset(nullptr);
152-
153-
EXPECT_TRUE(rootDeviceEnvironment->initAilConfiguration());
154-
}
155-
156141
HWTEST2_F(AILTests, GivenAilWhenCheckingContextSyncFlagRequiredThenExpectFalse, IsAtLeastGen9) {
157142
AILWhitebox<productFamily> ail;
158143
ail.processName = "other";

0 commit comments

Comments
 (0)