Refactor of global factories

Signed-off-by: Jaroslaw Chodor <jaroslaw.chodor@intel.com>
This commit is contained in:
Jaroslaw Chodor
2021-05-27 19:44:47 +02:00
committed by Compute-Runtime-Automation
parent dca72d3226
commit 3b4ec5b3fa
63 changed files with 573 additions and 117 deletions

View File

@@ -6,6 +6,7 @@
set(RUNTIME_SRCS_OS_INTERFACE_BASE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/create_command_stream_receiver_${DRIVER_MODEL}/create_command_stream_receiver.inl
${CMAKE_CURRENT_SOURCE_DIR}/metrics_library.cpp
${CMAKE_CURRENT_SOURCE_DIR}/metrics_library.h
${CMAKE_CURRENT_SOURCE_DIR}/ocl_reg_path.h

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/os_interface/linux/device_command_stream.inl"
namespace NEO {
template <typename GfxFamily>
CommandStreamReceiver *createCommandStreamReceiver(bool withAubDump,
ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield) {
return createDrmCommandStreamReceiver<GfxFamily>(withAubDump, executionEnvironment, rootDeviceIndex, deviceBitfield);
}
} // namespace NEO

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/os_interface/os_interface.h"
#include "opencl/source/os_interface/linux/device_command_stream.inl"
#include "opencl/source/os_interface/windows/device_command_stream.inl"
namespace NEO {
template <typename GfxFamily>
CommandStreamReceiver *createCommandStreamReceiver(bool withAubDump,
ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield) {
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get();
if (rootDeviceEnvironment->osInterface->getDriverModel()->getDriverModelType() == DriverModelType::DRM) {
return createDrmCommandStreamReceiver<GfxFamily>(withAubDump, executionEnvironment, rootDeviceIndex, deviceBitfield);
} else {
return createWddmCommandStreamReceiver<GfxFamily>(withAubDump, executionEnvironment, rootDeviceIndex, deviceBitfield);
}
}
} // namespace NEO

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/os_interface/windows/device_command_stream.inl"
namespace NEO {
template <typename GfxFamily>
CommandStreamReceiver *createCommandStreamReceiver(bool withAubDump,
ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield) {
return createWddmCommandStreamReceiver<GfxFamily>(withAubDump, executionEnvironment, rootDeviceIndex, deviceBitfield);
}
} // namespace NEO

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2018-2020 Intel Corporation
# Copyright (C) 2018-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

View File

@@ -6,7 +6,7 @@
*/
#include "shared/source/command_stream/device_command_stream.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "opencl/source/command_stream/command_stream_receiver_with_aub_dump.h"
#include "opencl/source/os_interface/linux/drm_command_stream.h"
@@ -14,10 +14,10 @@
namespace NEO {
template <typename GfxFamily>
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(bool withAubDump,
ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield) {
CommandStreamReceiver *createDrmCommandStreamReceiver(bool withAubDump,
ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield) {
if (withAubDump) {
return new CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<GfxFamily>>("aubfile",
executionEnvironment,
@@ -39,5 +39,5 @@ CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(bool withA
deviceBitfield,
gemMode);
}
};
}
} // namespace NEO

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2018-2020 Intel Corporation
# Copyright (C) 2018-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

View File

@@ -20,10 +20,10 @@
namespace NEO {
template <typename GfxFamily>
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(bool withAubDump,
ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield) {
CommandStreamReceiver *createWddmCommandStreamReceiver(bool withAubDump,
ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield) {
if (withAubDump) {
return new CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<GfxFamily>>("aubfile",
executionEnvironment,

View File

@@ -160,4 +160,19 @@ void WddmCommandStreamReceiver<GfxFamily>::kmDafLockAllocations(ResidencyContain
}
}
template <typename GfxFamily>
CommandStreamReceiver *createWddmDeviceCommandStreamReceiver(bool withAubDump,
ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield) {
if (withAubDump) {
return new CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<GfxFamily>>("aubfile",
executionEnvironment,
rootDeviceIndex,
deviceBitfield);
} else {
return new WddmCommandStreamReceiver<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield);
}
}
} // namespace NEO