Change use of querySystemInfo

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska
2021-06-15 10:43:12 +00:00
committed by Compute-Runtime-Automation
parent a3930168d6
commit 2ce3a223f0
7 changed files with 36 additions and 55 deletions

View File

@ -21,7 +21,7 @@ TEST(DrmSystemInfoTest, whenQueryingSystemInfoThenSystemInfoIsNotCreatedAndNoIoc
executionEnvironment->prepareRootDeviceEnvironments(1);
DrmMock drm(*executionEnvironment->rootDeviceEnvironments[0]);
EXPECT_TRUE(drm.querySystemInfo());
EXPECT_FALSE(drm.querySystemInfo());
EXPECT_EQ(nullptr, drm.getSystemInfo());
EXPECT_EQ(0u, drm.ioctlCallsCount);
@ -32,6 +32,7 @@ TEST(DrmSystemInfoTest, givenSystemInfoCreatedWhenQueryingSpecificAtrributesThen
EXPECT_EQ(0u, systemInfo.getL3CacheSizeInKb());
EXPECT_EQ(0u, systemInfo.getL3BankCount());
EXPECT_EQ(0u, systemInfo.getNumThreadsPerEu());
EXPECT_EQ(0u, systemInfo.getMaxFillRate());
EXPECT_EQ(0u, systemInfo.getTotalVsThreads());
EXPECT_EQ(0u, systemInfo.getTotalHsThreads());
@ -45,11 +46,11 @@ TEST(DrmSystemInfoTest, givenSystemInfoCreatedWhenQueryingSpecificAtrributesThen
EXPECT_EQ(0u, systemInfo.getMaxCCS());
}
TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFailsThenSystemInfoIsNotCreatedAndDebugMessageIsPrinted) {
struct DrmMockToFailQuerySystemInfo : public DrmMock {
DrmMockToFailQuerySystemInfo(RootDeviceEnvironment &rootDeviceEnvironment)
TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoTrueThenSystemInfoIsNotCreatedAndDebugMessageIsNotPrinted) {
struct DrmMockToQuerySystemInfo : public DrmMock {
DrmMockToQuerySystemInfo(RootDeviceEnvironment &rootDeviceEnvironment)
: DrmMock(rootDeviceEnvironment) {}
bool querySystemInfo() override { return false; }
bool querySystemInfo() override { return true; }
};
DebugManagerStateRestore restorer;
@ -58,7 +59,7 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFailsThenSystem
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
DrmMockToFailQuerySystemInfo drm(*executionEnvironment->rootDeviceEnvironments[0]);
DrmMockToQuerySystemInfo drm(*executionEnvironment->rootDeviceEnvironments[0]);
HardwareInfo hwInfo = *defaultHwInfo;
auto setupHardwareInfo = [](HardwareInfo *, bool) {};
@ -70,10 +71,13 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFailsThenSystem
EXPECT_EQ(ret, 0);
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>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
@ -81,24 +85,12 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenSystemInfoIsCreatedThenSetHard
HardwareInfo hwInfo = *defaultHwInfo;
auto setupHardwareInfo = [](HardwareInfo *, bool) {};
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
DeviceDescriptor device = {0, &hwInfo, setupHardwareInfo, GTTYPE_UNDEFINED};
drm.systemInfo.reset(new SystemInfoImpl(nullptr, 0));
::testing::internal::CaptureStdout();
int ret = drm.setupHardwareInfo(&device, false);
EXPECT_EQ(ret, 0);
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);
EXPECT_THAT(::testing::internal::GetCapturedStdout(), ::testing::IsEmpty());
}

View File

@ -466,37 +466,20 @@ int Drm::setupHardwareInfo(DeviceDescriptor *device, bool setupFeatureTableAndWo
hwInfo->gtSystemInfo.EUCount = static_cast<uint32_t>(topologyData.euCount);
status = querySystemInfo();
if (!status) {
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stdout, "%s", "INFO: System Info query failed!\n");
if (status) {
setupSystemInfo(hwInfo, systemInfo.get());
}
if (systemInfo) {
setupSystemInfo(hwInfo, *systemInfo);
}
device->setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable);
if (systemInfo) {
systemInfo->checkSysInfoMismatch(hwInfo);
}
setupCacheInfo(*hwInfo);
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)) {

View File

@ -143,7 +143,7 @@ class Drm : public DriverModel {
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);
void setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo);
void setupCacheInfo(const HardwareInfo &hwInfo);
PhysicalDevicePciBusInfo getPciBusInfo() const override;

View File

@ -50,9 +50,11 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
}
bool Drm::querySystemInfo() {
return true;
return false;
}
void Drm::setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo) {}
bool Drm::queryEngineInfo(bool isSysmanEnabled) {
auto length = 0;
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);

View File

@ -52,9 +52,11 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
}
bool Drm::querySystemInfo() {
return true;
return false;
}
void Drm::setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo) {}
bool Drm::queryEngineInfo(bool isSysmanEnabled) {
auto length = 0;
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -9,7 +9,7 @@
#include <cstdint>
namespace NEO {
struct HardwareInfo;
struct SystemInfo {
SystemInfo() = default;
virtual ~SystemInfo() = 0;
@ -17,7 +17,7 @@ struct SystemInfo {
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 uint64_t getL3CacheSizeInKb() const = 0;
virtual uint32_t getL3BankCount() const = 0;
virtual uint32_t getNumThreadsPerEu() const = 0;
virtual uint32_t getTotalVsThreads() const = 0;
@ -28,6 +28,7 @@ struct SystemInfo {
virtual uint32_t getMaxFillRate() const = 0;
virtual uint32_t getMaxRCS() const = 0;
virtual uint32_t getMaxCCS() const = 0;
virtual void checkSysInfoMismatch(HardwareInfo *hwInfo) = 0;
};
inline SystemInfo::~SystemInfo() {}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -9,7 +9,7 @@
#include "shared/source/os_interface/linux/system_info.h"
namespace NEO {
struct HardwareInfo;
struct SystemInfoImpl : public SystemInfo {
~SystemInfoImpl() override = default;
@ -19,7 +19,7 @@ struct SystemInfoImpl : public SystemInfo {
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; }
uint64_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; }
@ -30,6 +30,7 @@ struct SystemInfoImpl : public SystemInfo {
uint32_t getMaxFillRate() const override { return 0; }
uint32_t getMaxRCS() const override { return 0; }
uint32_t getMaxCCS() const override { return 0; }
void checkSysInfoMismatch(HardwareInfo *hwInfo) override {}
};
} // namespace NEO