mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-27 15:53:13 +08:00
move os_interface files to core folder
Change-Id: Iced641c6295b9cf4117a63492178e4591bd30369
This commit is contained in:
@@ -26,11 +26,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_memory_manager_allocate_in_device_pool.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_operations_handler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_operations_handler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ocl_reg_path.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_metrics_library.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.h
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "core/memory_manager/residency.h"
|
||||
#include "core/os_interface/linux/drm_engine_mapper.h"
|
||||
#include "core/os_interface/linux/drm_neo.h"
|
||||
#include "core/os_interface/linux/os_context_linux.h"
|
||||
#include "core/os_interface/linux/os_interface.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
@@ -21,7 +22,6 @@
|
||||
#include "runtime/os_interface/linux/drm_buffer_object.h"
|
||||
#include "runtime/os_interface/linux/drm_command_stream.h"
|
||||
#include "runtime/os_interface/linux/drm_memory_manager.h"
|
||||
#include "runtime/os_interface/linux/os_context_linux.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
#include "core/helpers/ptr_math.h"
|
||||
#include "core/memory_manager/host_ptr_manager.h"
|
||||
#include "core/memory_manager/residency.h"
|
||||
#include "core/os_interface/linux/os_context_linux.h"
|
||||
#include "core/os_interface/linux/os_interface.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/os_interface/linux/allocator_helper.h"
|
||||
#include "runtime/os_interface/linux/os_context_linux.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/os_interface/hw_info_config.h"
|
||||
|
||||
#include "core/command_stream/preemption.h"
|
||||
#include "core/debug_settings/debug_settings_manager.h"
|
||||
#include "core/helpers/hw_cmds.h"
|
||||
#include "core/helpers/hw_helper.h"
|
||||
#include "core/helpers/hw_info.h"
|
||||
#include "core/memory_manager/memory_constants.h"
|
||||
#include "core/os_interface/linux/drm_neo.h"
|
||||
#include "core/os_interface/linux/os_interface.h"
|
||||
#include "core/utilities/cpu_info.h"
|
||||
|
||||
#include "instrumentation.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
HwInfoConfig *hwInfoConfigFactory[IGFX_MAX_PRODUCT] = {};
|
||||
|
||||
uint32_t bitExact(uint32_t value, uint32_t highBit, uint32_t lowBit) {
|
||||
uint32_t bitVal = static_cast<uint32_t>((value >> lowBit) & maxNBitValue(highBit - lowBit + 1));
|
||||
return bitVal;
|
||||
}
|
||||
|
||||
int configureCacheInfo(HardwareInfo *hwInfo) {
|
||||
GT_SYSTEM_INFO *gtSystemInfo = &hwInfo->gtSystemInfo;
|
||||
|
||||
uint32_t type = 0;
|
||||
uint32_t subleaf = 0;
|
||||
uint32_t eax, ebx, ecx;
|
||||
uint32_t cachelevel, linesize, partitions, ways;
|
||||
uint64_t sets, size;
|
||||
|
||||
const CpuInfo &cpuInfo = CpuInfo::getInstance();
|
||||
|
||||
do {
|
||||
uint32_t cpuRegsInfo[4];
|
||||
|
||||
cpuInfo.cpuidex(cpuRegsInfo, 4, subleaf);
|
||||
eax = cpuRegsInfo[0];
|
||||
ebx = cpuRegsInfo[1];
|
||||
ecx = cpuRegsInfo[2];
|
||||
|
||||
type = bitExact(eax, 4, 0);
|
||||
if (type != 0) {
|
||||
cachelevel = bitExact(eax, 7, 5);
|
||||
linesize = bitExact(ebx, 11, 0) + 1;
|
||||
partitions = bitExact(ebx, 21, 12) + 1;
|
||||
ways = bitExact(ebx, 31, 22) + 1;
|
||||
sets = (uint64_t)ecx + 1;
|
||||
|
||||
size = sets * ways * partitions * linesize / 1024;
|
||||
if (cachelevel == 3) {
|
||||
gtSystemInfo->LLCCacheSizeInKb = size;
|
||||
}
|
||||
subleaf++;
|
||||
}
|
||||
} while (type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, OSInterface *osIface) {
|
||||
int ret = 0;
|
||||
Drm *drm = osIface->get()->getDrm();
|
||||
|
||||
*outHwInfo = *inHwInfo;
|
||||
auto platform = &outHwInfo->platform;
|
||||
auto gtSystemInfo = &outHwInfo->gtSystemInfo;
|
||||
auto featureTable = &outHwInfo->featureTable;
|
||||
|
||||
int val = 0;
|
||||
ret = drm->getDeviceID(val);
|
||||
if (ret != 0 || val == 0) {
|
||||
*outHwInfo = {};
|
||||
return (ret == 0) ? -1 : ret;
|
||||
}
|
||||
platform->usDeviceID = static_cast<unsigned short>(val);
|
||||
ret = drm->getDeviceRevID(val);
|
||||
if (ret != 0) {
|
||||
*outHwInfo = {};
|
||||
return ret;
|
||||
}
|
||||
platform->usRevId = static_cast<unsigned short>(val);
|
||||
|
||||
int euCount;
|
||||
ret = drm->getEuTotal(euCount);
|
||||
if (ret != 0) {
|
||||
*outHwInfo = {};
|
||||
return ret;
|
||||
}
|
||||
gtSystemInfo->EUCount = static_cast<uint32_t>(euCount);
|
||||
|
||||
gtSystemInfo->ThreadCount = this->threadsPerEu * gtSystemInfo->EUCount;
|
||||
|
||||
int subSliceCount;
|
||||
ret = drm->getSubsliceTotal(subSliceCount);
|
||||
if (ret != 0) {
|
||||
*outHwInfo = {};
|
||||
return ret;
|
||||
}
|
||||
gtSystemInfo->SubSliceCount = static_cast<uint32_t>(subSliceCount);
|
||||
|
||||
uint64_t gttSizeQuery = 0;
|
||||
featureTable->ftrSVM = true;
|
||||
|
||||
ret = drm->queryGttSize(gttSizeQuery);
|
||||
|
||||
if (ret == 0) {
|
||||
featureTable->ftrSVM = (gttSizeQuery > MemoryConstants::max64BitAppAddress);
|
||||
outHwInfo->capabilityTable.gpuAddressSpace = gttSizeQuery - 1; // gttSizeQuery = (1 << bits)
|
||||
}
|
||||
|
||||
int maxGpuFreq = 0;
|
||||
drm->getMaxGpuFrequency(maxGpuFreq);
|
||||
|
||||
GTTYPE gtType = drm->getGtType();
|
||||
if (gtType == GTTYPE_UNDEFINED) {
|
||||
*outHwInfo = {};
|
||||
return -1;
|
||||
}
|
||||
platform->eGTType = gtType;
|
||||
featureTable->ftrGTA = (gtType == GTTYPE_GTA) ? 1 : 0;
|
||||
featureTable->ftrGTC = (gtType == GTTYPE_GTC) ? 1 : 0;
|
||||
featureTable->ftrGTX = (gtType == GTTYPE_GTX) ? 1 : 0;
|
||||
featureTable->ftrGT1 = (gtType == GTTYPE_GT1) ? 1 : 0;
|
||||
featureTable->ftrGT1_5 = (gtType == GTTYPE_GT1_5) ? 1 : 0;
|
||||
featureTable->ftrGT2 = (gtType == GTTYPE_GT2) ? 1 : 0;
|
||||
featureTable->ftrGT2_5 = (gtType == GTTYPE_GT2_5) ? 1 : 0;
|
||||
featureTable->ftrGT3 = (gtType == GTTYPE_GT3) ? 1 : 0;
|
||||
featureTable->ftrGT4 = (gtType == GTTYPE_GT4) ? 1 : 0;
|
||||
|
||||
ret = configureHardwareCustom(outHwInfo, osIface);
|
||||
if (ret != 0) {
|
||||
*outHwInfo = {};
|
||||
return ret;
|
||||
}
|
||||
configureCacheInfo(outHwInfo);
|
||||
featureTable->ftrEDram = (gtSystemInfo->EdramSizeInKb != 0) ? 1 : 0;
|
||||
|
||||
outHwInfo->capabilityTable.maxRenderFrequency = maxGpuFreq;
|
||||
outHwInfo->capabilityTable.ftrSvm = featureTable->ftrSVM;
|
||||
|
||||
HwHelper &hwHelper = HwHelper::get(platform->eRenderCoreFamily);
|
||||
outHwInfo->capabilityTable.ftrSupportsCoherency = false;
|
||||
|
||||
hwHelper.adjustDefaultEngineType(outHwInfo);
|
||||
outHwInfo->capabilityTable.defaultEngineType = getChosenEngineType(*outHwInfo);
|
||||
|
||||
outHwInfo->capabilityTable.instrumentationEnabled =
|
||||
(outHwInfo->capabilityTable.instrumentationEnabled && haveInstrumentation);
|
||||
|
||||
outHwInfo->capabilityTable.ftrRenderCompressedBuffers = false;
|
||||
outHwInfo->capabilityTable.ftrRenderCompressedImages = false;
|
||||
drm->checkQueueSliceSupport();
|
||||
drm->checkNonPersistentContextsSupport();
|
||||
drm->checkPreemptionSupport();
|
||||
bool preemption = drm->isPreemptionSupported();
|
||||
PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable,
|
||||
static_cast<bool>(outHwInfo->featureTable.ftrGpGpuMidThreadLevelPreempt) && preemption,
|
||||
static_cast<bool>(outHwInfo->featureTable.ftrGpGpuThreadGroupLevelPreempt) && preemption,
|
||||
static_cast<bool>(outHwInfo->featureTable.ftrGpGpuMidBatchPreempt) && preemption);
|
||||
outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->gtSystemInfo.CsrSizeInMb * MemoryConstants::megaByte;
|
||||
|
||||
auto &kmdNotifyProperties = outHwInfo->capabilityTable.kmdNotifyProperties;
|
||||
KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideEnableKmdNotify.get(), kmdNotifyProperties.enableKmdNotify);
|
||||
KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get(), kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||
KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleep.get(), kmdNotifyProperties.enableQuickKmdSleep);
|
||||
KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||
KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleepForSporadicWaits.get(), kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||
KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -1,11 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/os_interface/linux/os_inc.h"
|
||||
namespace Os {
|
||||
const char *fileSeparator = "/";
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/linux/os_context_linux.h"
|
||||
|
||||
#include "core/os_interface/linux/drm_neo.h"
|
||||
#include "core/os_interface/linux/os_interface.h"
|
||||
#include "core/os_interface/os_context.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield,
|
||||
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) {
|
||||
if (osInterface) {
|
||||
return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority);
|
||||
}
|
||||
return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority);
|
||||
}
|
||||
|
||||
OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield,
|
||||
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority)
|
||||
: OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), drm(drm) {
|
||||
for (auto deviceIndex = 0u; deviceIndex < deviceBitfield.size(); deviceIndex++) {
|
||||
if (deviceBitfield.test(deviceIndex)) {
|
||||
auto drmContextId = drm.createDrmContext();
|
||||
if (drm.areNonPersistentContextsSupported()) {
|
||||
drm.setNonPersistentContext(drmContextId);
|
||||
}
|
||||
if (drm.isPreemptionSupported() && lowPriority) {
|
||||
drm.setLowPriorityContextParam(drmContextId);
|
||||
}
|
||||
this->engineFlag = drm.bindDrmContext(drmContextId, deviceIndex, engineType);
|
||||
this->drmContextIds.push_back(drmContextId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OsContextLinux::~OsContextLinux() {
|
||||
for (auto drmContextId : drmContextIds) {
|
||||
drm.destroyDrmContext(drmContextId);
|
||||
}
|
||||
}
|
||||
} // namespace NEO
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/os_interface/os_context.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class Drm;
|
||||
|
||||
class OsContextLinux : public OsContext {
|
||||
public:
|
||||
OsContextLinux() = delete;
|
||||
~OsContextLinux() override;
|
||||
OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield,
|
||||
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority);
|
||||
|
||||
unsigned int getEngineFlag() const { return engineFlag; }
|
||||
const std::vector<uint32_t> &getDrmContextIds() const { return drmContextIds; }
|
||||
|
||||
protected:
|
||||
unsigned int engineFlag = 0;
|
||||
std::vector<uint32_t> drmContextIds;
|
||||
Drm &drm;
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <sys/socket.h>
|
||||
typedef int SOCKET;
|
||||
@@ -17,7 +17,6 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/environment_variables.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ocl_reg_path.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_metrics_library.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_socket.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_win.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_win.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_device_command_stream.h
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <winsock.h>
|
||||
Reference in New Issue
Block a user