mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 21:42:53 +08:00
Add query system info implementation stub on Linux
Related-To: NEO-4998 Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
496bdd77ae
commit
e6a18aac73
@@ -57,6 +57,8 @@ set(NEO_CORE_OS_INTERFACE_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/print.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/settings_reader_create.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sys_calls.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/system_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/system_info_impl.h
|
||||
)
|
||||
|
||||
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "shared/source/os_interface/linux/hw_device_id.h"
|
||||
#include "shared/source/os_interface/linux/os_inc.h"
|
||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||
#include "shared/source/os_interface/linux/system_info.h"
|
||||
#include "shared/source/os_interface/os_environment.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/utilities/directory.h"
|
||||
@@ -302,10 +303,37 @@ int Drm::setupHardwareInfo(DeviceDescriptor *device, bool setupFeatureTableAndWo
|
||||
hwInfo->gtSystemInfo.SliceCount = static_cast<uint32_t>(sliceTotal);
|
||||
hwInfo->gtSystemInfo.SubSliceCount = static_cast<uint32_t>(subSliceTotal);
|
||||
hwInfo->gtSystemInfo.EUCount = static_cast<uint32_t>(euTotal);
|
||||
|
||||
status = querySystemInfo();
|
||||
if (!status) {
|
||||
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stdout, "%s", "INFO: System Info query failed!\n");
|
||||
}
|
||||
if (systemInfo) {
|
||||
setupSystemInfo(hwInfo, *systemInfo);
|
||||
}
|
||||
|
||||
device->setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Drm::setupSystemInfo(HardwareInfo *hwInfo, SystemInfo &sysInfo) {
|
||||
GT_SYSTEM_INFO *gtSysInfo = &hwInfo->gtSystemInfo;
|
||||
gtSysInfo->ThreadCount = gtSysInfo->EUCount * sysInfo.getNumThreadsPerEu();
|
||||
gtSysInfo->L3CacheSizeInKb = sysInfo.getL3CacheSizeInKb();
|
||||
gtSysInfo->L3BankCount = sysInfo.getL3BankCount();
|
||||
gtSysInfo->MaxFillRate = sysInfo.getMaxFillRate();
|
||||
gtSysInfo->TotalVsThreads = sysInfo.getTotalVsThreads();
|
||||
gtSysInfo->TotalHsThreads = sysInfo.getTotalHsThreads();
|
||||
gtSysInfo->TotalDsThreads = sysInfo.getTotalDsThreads();
|
||||
gtSysInfo->TotalGsThreads = sysInfo.getTotalGsThreads();
|
||||
gtSysInfo->TotalPsThreadsWindowerRange = sysInfo.getTotalPsThreads();
|
||||
gtSysInfo->MaxEuPerSubSlice = sysInfo.getMaxEuPerDualSubSlice();
|
||||
gtSysInfo->MaxSlicesSupported = sysInfo.getMaxSlicesSupported();
|
||||
gtSysInfo->MaxSubSlicesSupported = sysInfo.getMaxDualSubSlicesSupported();
|
||||
gtSysInfo->MaxDualSubSlicesSupported = sysInfo.getMaxDualSubSlicesSupported();
|
||||
}
|
||||
|
||||
void appendHwDeviceId(std::vector<std::unique_ptr<HwDeviceId>> &hwDeviceIds, int fileDescriptor, const char *pciPath) {
|
||||
if (fileDescriptor >= 0) {
|
||||
if (Drm::isi915Version(fileDescriptor)) {
|
||||
|
||||
@@ -37,6 +37,7 @@ class DeviceFactory;
|
||||
class OsContext;
|
||||
struct HardwareInfo;
|
||||
struct RootDeviceEnvironment;
|
||||
struct SystemInfo;
|
||||
|
||||
struct DeviceDescriptor { // NOLINT(clang-analyzer-optin.performance.Padding)
|
||||
unsigned short deviceId;
|
||||
@@ -96,6 +97,7 @@ class Drm {
|
||||
bool setQueueSliceCount(uint64_t sliceCount);
|
||||
void checkQueueSliceSupport();
|
||||
uint64_t getSliceMask(uint64_t sliceCount);
|
||||
MOCKABLE_VIRTUAL bool querySystemInfo();
|
||||
MOCKABLE_VIRTUAL bool queryEngineInfo();
|
||||
MOCKABLE_VIRTUAL bool queryMemoryInfo();
|
||||
bool queryTopology(int &sliceCount, int &subSliceCount, int &euCount);
|
||||
@@ -105,6 +107,7 @@ class Drm {
|
||||
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo);
|
||||
int unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo);
|
||||
int setupHardwareInfo(DeviceDescriptor *, bool);
|
||||
void setupSystemInfo(HardwareInfo *hwInfo, SystemInfo &sysInfo);
|
||||
|
||||
bool areNonPersistentContextsSupported() const { return nonPersistentContextsSupported; }
|
||||
void checkNonPersistentContextsSupport();
|
||||
@@ -123,6 +126,10 @@ class Drm {
|
||||
MOCKABLE_VIRTUAL void unregisterResource(uint32_t handle);
|
||||
MOCKABLE_VIRTUAL uint32_t registerIsaCookie(uint32_t isaHandle);
|
||||
|
||||
SystemInfo *getSystemInfo() const {
|
||||
return systemInfo.get();
|
||||
}
|
||||
|
||||
MemoryInfo *getMemoryInfo() const {
|
||||
return memoryInfo.get();
|
||||
}
|
||||
@@ -167,6 +174,7 @@ class Drm {
|
||||
uint64_t uuid = 0;
|
||||
|
||||
Drm(std::unique_ptr<HwDeviceId> hwDeviceIdIn, RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
std::unique_ptr<SystemInfo> systemInfo;
|
||||
std::unique_ptr<EngineInfo> engineInfo;
|
||||
std::unique_ptr<MemoryInfo> memoryInfo;
|
||||
std::vector<uint32_t> virtualMemoryIds;
|
||||
|
||||
@@ -31,6 +31,10 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Drm::querySystemInfo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Drm::queryEngineInfo() {
|
||||
auto length = 0;
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);
|
||||
|
||||
@@ -33,6 +33,10 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Drm::querySystemInfo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Drm::queryEngineInfo() {
|
||||
auto length = 0;
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);
|
||||
|
||||
35
shared/source/os_interface/linux/system_info.h
Normal file
35
shared/source/os_interface/linux/system_info.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct SystemInfo {
|
||||
SystemInfo() = default;
|
||||
virtual ~SystemInfo() = 0;
|
||||
|
||||
virtual uint32_t getMaxSlicesSupported() const = 0;
|
||||
virtual uint32_t getMaxDualSubSlicesSupported() const = 0;
|
||||
virtual uint32_t getMaxEuPerDualSubSlice() const = 0;
|
||||
virtual uint32_t getL3CacheSizeInKb() const = 0;
|
||||
virtual uint32_t getL3BankCount() const = 0;
|
||||
virtual uint32_t getNumThreadsPerEu() const = 0;
|
||||
virtual uint32_t getTotalVsThreads() const = 0;
|
||||
virtual uint32_t getTotalHsThreads() const = 0;
|
||||
virtual uint32_t getTotalDsThreads() const = 0;
|
||||
virtual uint32_t getTotalGsThreads() const = 0;
|
||||
virtual uint32_t getTotalPsThreads() const = 0;
|
||||
virtual uint32_t getMaxFillRate() const = 0;
|
||||
virtual uint32_t getMaxRCS() const = 0;
|
||||
virtual uint32_t getMaxCCS() const = 0;
|
||||
};
|
||||
|
||||
inline SystemInfo::~SystemInfo() {}
|
||||
|
||||
} // namespace NEO
|
||||
35
shared/source/os_interface/linux/system_info_impl.h
Normal file
35
shared/source/os_interface/linux/system_info_impl.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/os_interface/linux/system_info.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct SystemInfoImpl : public SystemInfo {
|
||||
~SystemInfoImpl() override = default;
|
||||
|
||||
SystemInfoImpl(const uint32_t *data, int32_t length) {
|
||||
}
|
||||
|
||||
uint32_t getMaxSlicesSupported() const override { return 0; }
|
||||
uint32_t getMaxDualSubSlicesSupported() const override { return 0; }
|
||||
uint32_t getMaxEuPerDualSubSlice() const override { return 0; }
|
||||
uint32_t getL3CacheSizeInKb() const override { return 0; }
|
||||
uint32_t getL3BankCount() const override { return 0; }
|
||||
uint32_t getNumThreadsPerEu() const override { return 0; }
|
||||
uint32_t getTotalVsThreads() const override { return 0; }
|
||||
uint32_t getTotalHsThreads() const override { return 0; }
|
||||
uint32_t getTotalDsThreads() const override { return 0; }
|
||||
uint32_t getTotalGsThreads() const override { return 0; }
|
||||
uint32_t getTotalPsThreads() const override { return 0; }
|
||||
uint32_t getMaxFillRate() const override { return 0; }
|
||||
uint32_t getMaxRCS() const override { return 0; }
|
||||
uint32_t getMaxCCS() const override { return 0; }
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user