mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
Before performing gpu device reset, first all level zero resources and gpu device specific resources have to be cleaned up. Also as after device reset, state of gpu device would be lost. Hence after performing gpu device reset, level zero device have to be reinitialized by querying gpu device again. This change is aimed at reinitializing the level zero resources after gpu device reset, so that user could continue using level zero devices after device reset. Related-To: LOCI-2627 Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
71 lines
3.2 KiB
C++
71 lines
3.2 KiB
C++
/*
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/test/common/libult/create_command_stream.h"
|
|
|
|
#include "shared/source/command_stream/create_command_stream_impl.h"
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
|
#include "shared/test/common/helpers/default_hw_info.h"
|
|
#include "shared/test/common/helpers/ult_hw_config.h"
|
|
#include "shared/test/common/mocks/ult_device_factory.h"
|
|
|
|
#include <cassert>
|
|
|
|
namespace NEO {
|
|
|
|
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
|
|
|
CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment,
|
|
uint32_t rootDeviceIndex,
|
|
const DeviceBitfield deviceBitfield) {
|
|
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
|
|
|
if (ultHwConfig.useHwCsr) {
|
|
return createCommandStreamImpl(executionEnvironment, rootDeviceIndex, deviceBitfield);
|
|
}
|
|
|
|
auto funcCreate = commandStreamReceiverFactory[IGFX_MAX_CORE + hwInfo->platform.eRenderCoreFamily];
|
|
if (funcCreate) {
|
|
return funcCreate(false, executionEnvironment, rootDeviceIndex, deviceBitfield);
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment) {
|
|
if (executionEnvironment.rootDeviceEnvironments.size() == 0) {
|
|
executionEnvironment.prepareRootDeviceEnvironments(1u);
|
|
}
|
|
auto currentHwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
|
|
if (currentHwInfo->platform.eProductFamily == IGFX_UNKNOWN && currentHwInfo->platform.eRenderCoreFamily == IGFX_UNKNOWN_CORE) {
|
|
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
|
}
|
|
if (ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc) {
|
|
uint32_t numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get() != 0 ? DebugManager.flags.CreateMultipleRootDevices.get() : 1u;
|
|
UltDeviceFactory::prepareDeviceEnvironments(executionEnvironment, numRootDevices);
|
|
return ultHwConfig.mockedPrepareDeviceEnvironmentsFuncResult;
|
|
}
|
|
|
|
return prepareDeviceEnvironmentsImpl(executionEnvironment);
|
|
}
|
|
|
|
bool prepareDeviceEnvironment(ExecutionEnvironment &executionEnvironment, std::string &osPciPath, const uint32_t rootDeviceIndex) {
|
|
executionEnvironment.prepareRootDeviceEnvironment(rootDeviceIndex);
|
|
auto currentHwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
|
if (currentHwInfo->platform.eProductFamily == IGFX_UNKNOWN && currentHwInfo->platform.eRenderCoreFamily == IGFX_UNKNOWN_CORE) {
|
|
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
|
|
}
|
|
if (ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc) {
|
|
uint32_t numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get() != 0 ? DebugManager.flags.CreateMultipleRootDevices.get() : 1u;
|
|
UltDeviceFactory::prepareDeviceEnvironments(executionEnvironment, numRootDevices);
|
|
return ultHwConfig.mockedPrepareDeviceEnvironmentsFuncResult;
|
|
}
|
|
|
|
return prepareDeviceEnvironmentImpl(executionEnvironment, osPciPath, rootDeviceIndex);
|
|
}
|
|
|
|
} // namespace NEO
|