From 75d0fb308a3dac15ff1249f0f127a40f927e177b Mon Sep 17 00:00:00 2001 From: Slawomir Milczarek Date: Wed, 13 Nov 2019 13:53:27 +0100 Subject: [PATCH] Fixed AUB Center class object initialization Related-To: NEO-3916 Change-Id: Ia17abe09c638ee76b8fda98166938c1bab6629a7 Signed-off-by: Slawomir Milczarek --- runtime/os_interface/device_factory.cpp | 5 ++++- .../os_interface/device_factory_tests.cpp | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/runtime/os_interface/device_factory.cpp b/runtime/os_interface/device_factory.cpp index 6f956a22d5..a189579ca4 100644 --- a/runtime/os_interface/device_factory.cpp +++ b/runtime/os_interface/device_factory.cpp @@ -8,6 +8,7 @@ #include "core/os_interface/aub_memory_operations_handler.h" #include "runtime/aub/aub_center.h" #include "runtime/device/device.h" +#include "runtime/helpers/hw_helper.h" #include "runtime/helpers/options.h" #include "runtime/os_interface/debug_settings_manager.h" #include "runtime/os_interface/hw_info_config.h" @@ -40,7 +41,9 @@ bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, Execu DeviceFactory::numDevices = numDevices; auto csr = DebugManager.flags.SetCommandStreamReceiver.get(); if (csr > 0) { - executionEnvironment.initAubCenter(DebugManager.flags.EnableLocalMemory.get(), "", static_cast(csr)); + auto &hwHelper = HwHelper::get(hardwareInfo->platform.eRenderCoreFamily); + auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hardwareInfo); + executionEnvironment.initAubCenter(localMemoryEnabled, "", static_cast(csr)); auto aubCenter = executionEnvironment.rootDeviceEnvironments[0].aubCenter.get(); executionEnvironment.memoryOperationsInterface = std::make_unique(aubCenter->getAubManager()); } diff --git a/unit_tests/os_interface/device_factory_tests.cpp b/unit_tests/os_interface/device_factory_tests.cpp index e0169b4479..8076181aec 100644 --- a/unit_tests/os_interface/device_factory_tests.cpp +++ b/unit_tests/os_interface/device_factory_tests.cpp @@ -14,6 +14,7 @@ #include "runtime/os_interface/os_interface.h" #include "runtime/os_interface/os_library.h" #include "runtime/platform/platform.h" +#include "unit_tests/mocks/mock_execution_environment.h" #include "gtest/gtest.h" @@ -164,6 +165,22 @@ TEST_F(DeviceFactoryTest, givenCreateMultipleRootDevicesDebugFlagWhenGetDevicesF EXPECT_EQ(requiredDeviceCount, numDevices); } +TEST_F(DeviceFactoryTest, givenSetCommandStreamReceiverInAubModeForTgllpProductFamilyWhenGetDevicesForProductFamilyOverrideIsCalledThenAubCenterIsInitializedCorrectly) { + DeviceFactoryCleaner cleaner; + DebugManagerStateRestore stateRestore; + DebugManager.flags.SetCommandStreamReceiver.set(1); + DebugManager.flags.ProductFamilyOverride.set("tgllp"); + + MockExecutionEnvironment executionEnvironment(*platformDevices); + + size_t numDevices = 0; + bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, executionEnvironment); + ASSERT_TRUE(success); + + EXPECT_TRUE(executionEnvironment.initAubCenterCalled); + EXPECT_FALSE(executionEnvironment.localMemoryEnabledReceived); +} + TEST_F(DeviceFactoryTest, givenGetDevicesCallWhenItIsDoneThenOsInterfaceIsAllocated) { DeviceFactoryCleaner cleaner;