mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Change use of querySystemInfo
Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
a3930168d6
commit
2ce3a223f0
@ -21,7 +21,7 @@ TEST(DrmSystemInfoTest, whenQueryingSystemInfoThenSystemInfoIsNotCreatedAndNoIoc
|
|||||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||||
DrmMock drm(*executionEnvironment->rootDeviceEnvironments[0]);
|
DrmMock drm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
|
|
||||||
EXPECT_TRUE(drm.querySystemInfo());
|
EXPECT_FALSE(drm.querySystemInfo());
|
||||||
|
|
||||||
EXPECT_EQ(nullptr, drm.getSystemInfo());
|
EXPECT_EQ(nullptr, drm.getSystemInfo());
|
||||||
EXPECT_EQ(0u, drm.ioctlCallsCount);
|
EXPECT_EQ(0u, drm.ioctlCallsCount);
|
||||||
@ -32,6 +32,7 @@ TEST(DrmSystemInfoTest, givenSystemInfoCreatedWhenQueryingSpecificAtrributesThen
|
|||||||
|
|
||||||
EXPECT_EQ(0u, systemInfo.getL3CacheSizeInKb());
|
EXPECT_EQ(0u, systemInfo.getL3CacheSizeInKb());
|
||||||
EXPECT_EQ(0u, systemInfo.getL3BankCount());
|
EXPECT_EQ(0u, systemInfo.getL3BankCount());
|
||||||
|
EXPECT_EQ(0u, systemInfo.getNumThreadsPerEu());
|
||||||
EXPECT_EQ(0u, systemInfo.getMaxFillRate());
|
EXPECT_EQ(0u, systemInfo.getMaxFillRate());
|
||||||
EXPECT_EQ(0u, systemInfo.getTotalVsThreads());
|
EXPECT_EQ(0u, systemInfo.getTotalVsThreads());
|
||||||
EXPECT_EQ(0u, systemInfo.getTotalHsThreads());
|
EXPECT_EQ(0u, systemInfo.getTotalHsThreads());
|
||||||
@ -45,11 +46,11 @@ TEST(DrmSystemInfoTest, givenSystemInfoCreatedWhenQueryingSpecificAtrributesThen
|
|||||||
EXPECT_EQ(0u, systemInfo.getMaxCCS());
|
EXPECT_EQ(0u, systemInfo.getMaxCCS());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFailsThenSystemInfoIsNotCreatedAndDebugMessageIsPrinted) {
|
TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoTrueThenSystemInfoIsNotCreatedAndDebugMessageIsNotPrinted) {
|
||||||
struct DrmMockToFailQuerySystemInfo : public DrmMock {
|
struct DrmMockToQuerySystemInfo : public DrmMock {
|
||||||
DrmMockToFailQuerySystemInfo(RootDeviceEnvironment &rootDeviceEnvironment)
|
DrmMockToQuerySystemInfo(RootDeviceEnvironment &rootDeviceEnvironment)
|
||||||
: DrmMock(rootDeviceEnvironment) {}
|
: DrmMock(rootDeviceEnvironment) {}
|
||||||
bool querySystemInfo() override { return false; }
|
bool querySystemInfo() override { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
@ -58,7 +59,7 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFailsThenSystem
|
|||||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||||
DrmMockToFailQuerySystemInfo drm(*executionEnvironment->rootDeviceEnvironments[0]);
|
DrmMockToQuerySystemInfo drm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
|
|
||||||
HardwareInfo hwInfo = *defaultHwInfo;
|
HardwareInfo hwInfo = *defaultHwInfo;
|
||||||
auto setupHardwareInfo = [](HardwareInfo *, bool) {};
|
auto setupHardwareInfo = [](HardwareInfo *, bool) {};
|
||||||
@ -70,10 +71,13 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFailsThenSystem
|
|||||||
EXPECT_EQ(ret, 0);
|
EXPECT_EQ(ret, 0);
|
||||||
EXPECT_EQ(nullptr, drm.getSystemInfo());
|
EXPECT_EQ(nullptr, drm.getSystemInfo());
|
||||||
|
|
||||||
EXPECT_THAT(::testing::internal::GetCapturedStdout(), ::testing::HasSubstr("INFO: System Info query failed!\n"));
|
EXPECT_THAT(::testing::internal::GetCapturedStdout(), ::testing::IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenSystemInfoIsCreatedThenSetHardwareInfoAttributesWithZeros) {
|
TEST(DrmSystemInfoTest, givenSystemInfoWhenSetupHardwareInfoThenFinishedWithSuccess) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
DebugManager.flags.PrintDebugMessages.set(true);
|
||||||
|
|
||||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||||
@ -81,24 +85,12 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenSystemInfoIsCreatedThenSetHard
|
|||||||
|
|
||||||
HardwareInfo hwInfo = *defaultHwInfo;
|
HardwareInfo hwInfo = *defaultHwInfo;
|
||||||
auto setupHardwareInfo = [](HardwareInfo *, bool) {};
|
auto setupHardwareInfo = [](HardwareInfo *, bool) {};
|
||||||
GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo;
|
|
||||||
DeviceDescriptor device = {0, &hwInfo, setupHardwareInfo, GTTYPE_UNDEFINED};
|
DeviceDescriptor device = {0, &hwInfo, setupHardwareInfo, GTTYPE_UNDEFINED};
|
||||||
|
|
||||||
drm.systemInfo.reset(new SystemInfoImpl(nullptr, 0));
|
drm.systemInfo.reset(new SystemInfoImpl(nullptr, 0));
|
||||||
|
|
||||||
|
::testing::internal::CaptureStdout();
|
||||||
int ret = drm.setupHardwareInfo(&device, false);
|
int ret = drm.setupHardwareInfo(&device, false);
|
||||||
EXPECT_EQ(ret, 0);
|
EXPECT_EQ(ret, 0);
|
||||||
|
EXPECT_THAT(::testing::internal::GetCapturedStdout(), ::testing::IsEmpty());
|
||||||
EXPECT_EQ_VAL(0u, gtSystemInfo.L3CacheSizeInKb);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.L3BankCount);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.MaxFillRate);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.TotalVsThreads);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.TotalHsThreads);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.TotalDsThreads);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.TotalGsThreads);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.TotalPsThreadsWindowerRange);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.TotalDsThreads);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.MaxEuPerSubSlice);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.MaxSlicesSupported);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.MaxSubSlicesSupported);
|
|
||||||
EXPECT_EQ(0u, gtSystemInfo.MaxDualSubSlicesSupported);
|
|
||||||
}
|
}
|
||||||
|
@ -466,37 +466,20 @@ int Drm::setupHardwareInfo(DeviceDescriptor *device, bool setupFeatureTableAndWo
|
|||||||
hwInfo->gtSystemInfo.EUCount = static_cast<uint32_t>(topologyData.euCount);
|
hwInfo->gtSystemInfo.EUCount = static_cast<uint32_t>(topologyData.euCount);
|
||||||
|
|
||||||
status = querySystemInfo();
|
status = querySystemInfo();
|
||||||
if (!status) {
|
if (status) {
|
||||||
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stdout, "%s", "INFO: System Info query failed!\n");
|
setupSystemInfo(hwInfo, systemInfo.get());
|
||||||
}
|
}
|
||||||
if (systemInfo) {
|
|
||||||
setupSystemInfo(hwInfo, *systemInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
device->setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable);
|
device->setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable);
|
||||||
|
|
||||||
|
if (systemInfo) {
|
||||||
|
systemInfo->checkSysInfoMismatch(hwInfo);
|
||||||
|
}
|
||||||
|
|
||||||
setupCacheInfo(*hwInfo);
|
setupCacheInfo(*hwInfo);
|
||||||
|
|
||||||
return 0;
|
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) {
|
void appendHwDeviceId(std::vector<std::unique_ptr<HwDeviceId>> &hwDeviceIds, int fileDescriptor, const char *pciPath) {
|
||||||
if (fileDescriptor >= 0) {
|
if (fileDescriptor >= 0) {
|
||||||
if (Drm::isi915Version(fileDescriptor)) {
|
if (Drm::isi915Version(fileDescriptor)) {
|
||||||
|
@ -143,7 +143,7 @@ class Drm : public DriverModel {
|
|||||||
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo);
|
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo);
|
||||||
int unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo);
|
int unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo);
|
||||||
int setupHardwareInfo(DeviceDescriptor *, bool);
|
int setupHardwareInfo(DeviceDescriptor *, bool);
|
||||||
void setupSystemInfo(HardwareInfo *hwInfo, SystemInfo &sysInfo);
|
void setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo);
|
||||||
void setupCacheInfo(const HardwareInfo &hwInfo);
|
void setupCacheInfo(const HardwareInfo &hwInfo);
|
||||||
|
|
||||||
PhysicalDevicePciBusInfo getPciBusInfo() const override;
|
PhysicalDevicePciBusInfo getPciBusInfo() const override;
|
||||||
|
@ -50,9 +50,11 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Drm::querySystemInfo() {
|
bool Drm::querySystemInfo() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Drm::setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo) {}
|
||||||
|
|
||||||
bool Drm::queryEngineInfo(bool isSysmanEnabled) {
|
bool Drm::queryEngineInfo(bool isSysmanEnabled) {
|
||||||
auto length = 0;
|
auto length = 0;
|
||||||
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);
|
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);
|
||||||
|
@ -52,9 +52,11 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Drm::querySystemInfo() {
|
bool Drm::querySystemInfo() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Drm::setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo) {}
|
||||||
|
|
||||||
bool Drm::queryEngineInfo(bool isSysmanEnabled) {
|
bool Drm::queryEngineInfo(bool isSysmanEnabled) {
|
||||||
auto length = 0;
|
auto length = 0;
|
||||||
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);
|
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 Intel Corporation
|
* Copyright (C) 2020-2021 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
struct HardwareInfo;
|
||||||
struct SystemInfo {
|
struct SystemInfo {
|
||||||
SystemInfo() = default;
|
SystemInfo() = default;
|
||||||
virtual ~SystemInfo() = 0;
|
virtual ~SystemInfo() = 0;
|
||||||
@ -17,7 +17,7 @@ struct SystemInfo {
|
|||||||
virtual uint32_t getMaxSlicesSupported() const = 0;
|
virtual uint32_t getMaxSlicesSupported() const = 0;
|
||||||
virtual uint32_t getMaxDualSubSlicesSupported() const = 0;
|
virtual uint32_t getMaxDualSubSlicesSupported() const = 0;
|
||||||
virtual uint32_t getMaxEuPerDualSubSlice() const = 0;
|
virtual uint32_t getMaxEuPerDualSubSlice() const = 0;
|
||||||
virtual uint32_t getL3CacheSizeInKb() const = 0;
|
virtual uint64_t getL3CacheSizeInKb() const = 0;
|
||||||
virtual uint32_t getL3BankCount() const = 0;
|
virtual uint32_t getL3BankCount() const = 0;
|
||||||
virtual uint32_t getNumThreadsPerEu() const = 0;
|
virtual uint32_t getNumThreadsPerEu() const = 0;
|
||||||
virtual uint32_t getTotalVsThreads() const = 0;
|
virtual uint32_t getTotalVsThreads() const = 0;
|
||||||
@ -28,6 +28,7 @@ struct SystemInfo {
|
|||||||
virtual uint32_t getMaxFillRate() const = 0;
|
virtual uint32_t getMaxFillRate() const = 0;
|
||||||
virtual uint32_t getMaxRCS() const = 0;
|
virtual uint32_t getMaxRCS() const = 0;
|
||||||
virtual uint32_t getMaxCCS() const = 0;
|
virtual uint32_t getMaxCCS() const = 0;
|
||||||
|
virtual void checkSysInfoMismatch(HardwareInfo *hwInfo) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline SystemInfo::~SystemInfo() {}
|
inline SystemInfo::~SystemInfo() {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 Intel Corporation
|
* Copyright (C) 2020-2021 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include "shared/source/os_interface/linux/system_info.h"
|
#include "shared/source/os_interface/linux/system_info.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
struct HardwareInfo;
|
||||||
struct SystemInfoImpl : public SystemInfo {
|
struct SystemInfoImpl : public SystemInfo {
|
||||||
~SystemInfoImpl() override = default;
|
~SystemInfoImpl() override = default;
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ struct SystemInfoImpl : public SystemInfo {
|
|||||||
uint32_t getMaxSlicesSupported() const override { return 0; }
|
uint32_t getMaxSlicesSupported() const override { return 0; }
|
||||||
uint32_t getMaxDualSubSlicesSupported() const override { return 0; }
|
uint32_t getMaxDualSubSlicesSupported() const override { return 0; }
|
||||||
uint32_t getMaxEuPerDualSubSlice() const override { return 0; }
|
uint32_t getMaxEuPerDualSubSlice() const override { return 0; }
|
||||||
uint32_t getL3CacheSizeInKb() const override { return 0; }
|
uint64_t getL3CacheSizeInKb() const override { return 0; }
|
||||||
uint32_t getL3BankCount() const override { return 0; }
|
uint32_t getL3BankCount() const override { return 0; }
|
||||||
uint32_t getNumThreadsPerEu() const override { return 0; }
|
uint32_t getNumThreadsPerEu() const override { return 0; }
|
||||||
uint32_t getTotalVsThreads() const override { return 0; }
|
uint32_t getTotalVsThreads() const override { return 0; }
|
||||||
@ -30,6 +30,7 @@ struct SystemInfoImpl : public SystemInfo {
|
|||||||
uint32_t getMaxFillRate() const override { return 0; }
|
uint32_t getMaxFillRate() const override { return 0; }
|
||||||
uint32_t getMaxRCS() const override { return 0; }
|
uint32_t getMaxRCS() const override { return 0; }
|
||||||
uint32_t getMaxCCS() const override { return 0; }
|
uint32_t getMaxCCS() const override { return 0; }
|
||||||
|
void checkSysInfoMismatch(HardwareInfo *hwInfo) override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
Reference in New Issue
Block a user