[1/N] Make the execution environment adapter agnostic
-Create a structure for adapter specific data -Store an array of adapter data in the execution environment Related-To: NEO-3857 Change-Id: Ia5b52a7bfa53198f0ca5124bcaa0669dd3601faf Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
parent
e22ce2f757
commit
bfc9863179
|
@ -0,0 +1,12 @@
|
|||
#
|
||||
# Copyright (C) 2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(NEO_CORE_EXECUTION_ENVIRONMENT
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/root_device_environment.h
|
||||
)
|
||||
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_EXECUTION_ENVIRONMENT ${NEO_CORE_EXECUTION_ENVIRONMENT})
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct RootDeviceEnvironment {
|
||||
};
|
||||
} // namespace NEO
|
|
@ -10,5 +10,9 @@ set(RUNTIME_SRCS_EXECUTION_ENVIRONMENT
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/execution_environment.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/execution_environment_initialize.cpp
|
||||
)
|
||||
|
||||
get_property(NEO_CORE_EXECUTION_ENVIRONMENT GLOBAL PROPERTY NEO_CORE_EXECUTION_ENVIRONMENT)
|
||||
list(APPEND RUNTIME_SRCS_EXECUTION_ENVIRONMENT ${NEO_CORE_EXECUTION_ENVIRONMENT})
|
||||
|
||||
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_EXECUTION_ENVIRONMENT})
|
||||
set_property(GLOBAL PROPERTY RUNTIME_SRCS_EXECUTION_ENVIRONMENT ${RUNTIME_SRCS_EXECUTION_ENVIRONMENT})
|
||||
|
|
|
@ -11,14 +11,12 @@
|
|||
#include "core/memory_manager/memory_operations_handler.h"
|
||||
#include "runtime/aub/aub_center.h"
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/built_ins/sip.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
|
||||
#include "runtime/compiler_interface/default_cl_cache_config.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
#include "runtime/os_interface/os_interface.h"
|
||||
#include "runtime/source_level_debugger/source_level_debugger.h"
|
||||
|
||||
|
|
|
@ -6,14 +6,13 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/memory_manager/memory_constants.h"
|
||||
#include "core/execution_environment/root_device_environment.h"
|
||||
#include "core/utilities/reference_tracked_object.h"
|
||||
#include "runtime/helpers/common_types.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class AubCenter;
|
||||
|
@ -22,11 +21,10 @@ class CommandStreamReceiver;
|
|||
class CompilerInterface;
|
||||
class GmmHelper;
|
||||
class MemoryManager;
|
||||
class SourceLevelDebugger;
|
||||
class MemoryOperationsHandler;
|
||||
class OSInterface;
|
||||
class RootDevice;
|
||||
class MemoryOperationsHandler;
|
||||
struct EngineControl;
|
||||
class SourceLevelDebugger;
|
||||
struct HardwareInfo;
|
||||
|
||||
class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment> {
|
||||
|
@ -57,6 +55,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
|||
MOCKABLE_VIRTUAL CompilerInterface *getCompilerInterface();
|
||||
BuiltIns *getBuiltIns();
|
||||
|
||||
std::unique_ptr<RootDeviceEnvironment[]> rootDeviceEnvironments;
|
||||
std::unique_ptr<OSInterface> osInterface;
|
||||
std::unique_ptr<MemoryOperationsHandler> memoryOperationsInterface;
|
||||
std::unique_ptr<MemoryManager> memoryManager;
|
||||
|
|
|
@ -19,6 +19,9 @@ bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, Execu
|
|||
if (DebugManager.flags.CreateMultipleRootDevices.get()) {
|
||||
totalDeviceCount = DebugManager.flags.CreateMultipleRootDevices.get();
|
||||
}
|
||||
|
||||
executionEnvironment.rootDeviceEnvironments = std::make_unique<RootDeviceEnvironment[]>(totalDeviceCount);
|
||||
|
||||
auto productFamily = DebugManager.flags.ProductFamilyOverride.get();
|
||||
auto hwInfoConst = *platformDevices;
|
||||
getHwInfoForPlatformString(productFamily, hwInfoConst);
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
#include "runtime/os_interface/hw_info_config.h"
|
||||
#include "runtime/os_interface/linux/drm_memory_operations_handler.h"
|
||||
|
@ -17,9 +15,6 @@
|
|||
|
||||
#include "drm/i915_drm.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
size_t DeviceFactory::numDevices = 0;
|
||||
|
||||
|
@ -31,6 +26,8 @@ bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executi
|
|||
requiredDeviceCount = DebugManager.flags.CreateMultipleRootDevices.get();
|
||||
}
|
||||
|
||||
executionEnvironment.rootDeviceEnvironments = std::make_unique<RootDeviceEnvironment[]>(requiredDeviceCount);
|
||||
|
||||
Drm *drm = Drm::create(devNum);
|
||||
if (!drm) {
|
||||
return false;
|
||||
|
@ -48,7 +45,6 @@ bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executi
|
|||
}
|
||||
|
||||
numDevices = requiredDeviceCount;
|
||||
|
||||
DeviceFactory::numDevices = numDevices;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "runtime/device/device.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
#include "runtime/os_interface/hw_info_config.h"
|
||||
#include "runtime/os_interface/windows/os_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
|
@ -24,19 +23,21 @@ size_t DeviceFactory::numDevices = 0;
|
|||
bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
|
||||
numDevices = 0;
|
||||
|
||||
auto totalDeviceCount = 1u;
|
||||
if (DebugManager.flags.CreateMultipleRootDevices.get()) {
|
||||
totalDeviceCount = DebugManager.flags.CreateMultipleRootDevices.get();
|
||||
}
|
||||
|
||||
executionEnvironment.rootDeviceEnvironments = std::make_unique<RootDeviceEnvironment[]>(totalDeviceCount);
|
||||
|
||||
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
||||
if (!wddm->init(*hardwareInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto totalDeviceCount = 1u;
|
||||
if (DebugManager.flags.CreateMultipleRootDevices.get()) {
|
||||
totalDeviceCount = DebugManager.flags.CreateMultipleRootDevices.get();
|
||||
}
|
||||
|
||||
executionEnvironment.memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm.get());
|
||||
executionEnvironment.osInterface.reset(new OSInterface());
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment.osInterface->get()->setWddm(wddm.release());
|
||||
|
||||
numDevices = totalDeviceCount;
|
||||
|
|
|
@ -189,6 +189,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeMemoryManagerI
|
|||
static_assert(sizeof(ExecutionEnvironment) == sizeof(std::vector<std::unique_ptr<CommandStreamReceiver>>) +
|
||||
sizeof(std::mutex) +
|
||||
sizeof(std::unique_ptr<HardwareInfo>) +
|
||||
sizeof(std::unique_ptr<RootDeviceEnvironment[]>) +
|
||||
(is64bit ? 88 : 48),
|
||||
"New members detected in ExecutionEnvironment, please ensure that destruction sequence of objects is correct");
|
||||
|
||||
|
|
Loading…
Reference in New Issue