Store hardware IP version in hardware info

Query HW IP version using ioctl helper prelim

Related-To: NEO-7457
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-10-31 13:57:24 +00:00
committed by Compute-Runtime-Automation
parent 49c828e481
commit 8ddc889c1d
26 changed files with 189 additions and 90 deletions

View File

@@ -137,17 +137,23 @@ inline bool operator==(const RuntimeCapabilityTable &lhs, const RuntimeCapabilit
return result;
}
struct HardwareIpVersion {
uint8_t architecture;
uint8_t release;
uint8_t revision;
};
struct HardwareInfo {
HardwareInfo() = default;
HardwareInfo(const PLATFORM *platform, const FeatureTable *featureTable, const WorkaroundTable *workaroundTable,
const GT_SYSTEM_INFO *gtSystemInfo, const RuntimeCapabilityTable &capabilityTable);
PLATFORM platform = {};
FeatureTable featureTable = {};
WorkaroundTable workaroundTable = {};
alignas(4) GT_SYSTEM_INFO gtSystemInfo = {};
alignas(8) RuntimeCapabilityTable capabilityTable = {};
PLATFORM platform{};
FeatureTable featureTable{};
WorkaroundTable workaroundTable{};
alignas(4) GT_SYSTEM_INFO gtSystemInfo{};
alignas(8) RuntimeCapabilityTable capabilityTable{};
HardwareIpVersion ipVersion{};
};
template <PRODUCT_FAMILY product>

View File

@@ -57,7 +57,6 @@ set(NEO_CORE_OS_INTERFACE_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_prelim.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ioctl_helper_getter.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ioctl_helper_prelim_init.cpp
${CMAKE_CURRENT_SOURCE_DIR}/engine_info.h
${CMAKE_CURRENT_SOURCE_DIR}/engine_info.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_info.h

View File

@@ -76,6 +76,7 @@ using NEO::PrelimI915::prelim_drm_i915_gem_vm_prefetch;
using NEO::PrelimI915::prelim_drm_i915_gem_vm_region_ext;
using NEO::PrelimI915::prelim_drm_i915_gem_wait_user_fence;
using NEO::PrelimI915::prelim_drm_i915_query_distance_info;
using NEO::PrelimI915::prelim_drm_i915_query_hw_ip_version;
using NEO::PrelimI915::prelim_drm_i915_uuid_control;
using NEO::PrelimI915::prelim_drm_i915_vm_bind_ext_set_pat;
using NEO::PrelimI915::prelim_drm_i915_vm_bind_ext_user_fence;

View File

@@ -24,6 +24,7 @@ class OsContextLinux;
class IoctlHelper;
enum class CacheRegion : uint16_t;
struct HardwareInfo;
struct HardwareIpVersion;
struct MemoryRegion {
MemoryClassInstance region;
@@ -261,6 +262,8 @@ class IoctlHelperPrelim20 : public IoctlHelper {
bool getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) override;
protected:
bool queryHwIpVersion(EngineClassInstance &engineInfo, HardwareIpVersion &ipVersion, int &ret);
bool handleExecBufferInNonBlockMode = false;
};

View File

@@ -705,6 +705,57 @@ bool IoctlHelperPrelim20::getFabricLatency(uint32_t fabricId, uint32_t &latency,
bandwidth = info.bandwidth;
return true;
}
bool IoctlHelperPrelim20::queryHwIpVersion(EngineClassInstance &engineInfo, HardwareIpVersion &ipVersion, int &ret) {
QueryItem queryItem{};
queryItem.queryId = PRELIM_DRM_I915_QUERY_HW_IP_VERSION;
Query query{};
query.itemsPtr = reinterpret_cast<uint64_t>(&queryItem);
query.numItems = 1u;
ret = ioctl(DrmIoctl::Query, &query);
if (ret != 0) {
return false;
}
if (queryItem.length != sizeof(prelim_drm_i915_query_hw_ip_version)) {
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s\n",
"Size got from PRELIM_DRM_I915_QUERY_HW_IP_VERSION query does not match PrelimI915::prelim_drm_i915_query_hw_ip_version size");
return false;
}
prelim_drm_i915_query_hw_ip_version queryHwIpVersion{};
queryHwIpVersion.engine.engine_class = engineInfo.engineClass;
queryHwIpVersion.engine.engine_instance = engineInfo.engineInstance;
queryItem.dataPtr = reinterpret_cast<uint64_t>(&queryHwIpVersion);
ret = ioctl(DrmIoctl::Query, &query);
if (ret != 0) {
return false;
}
ipVersion.architecture = queryHwIpVersion.arch;
ipVersion.release = queryHwIpVersion.release;
ipVersion.revision = queryHwIpVersion.stepping;
return true;
}
bool IoctlHelperPrelim20::initialize() {
auto hwInfo = drm.getRootDeviceEnvironment().getMutableHardwareInfo();
EngineClassInstance engineInfo = {static_cast<uint16_t>(getDrmParamValue(DrmParam::EngineClassRender)), 0};
int ret = 0;
bool result = queryHwIpVersion(engineInfo, hwInfo->ipVersion, ret);
if (result == false &&
ret != 0 &&
HwInfoConfig::get(hwInfo->platform.eProductFamily)->isPlatformQuerySupported()) {
int err = drm.getErrno();
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr,
"ioctl(PRELIM_DRM_I915_QUERY_HW_IP_VERSION) failed with %d. errno=%d(%s)\n", ret, err, strerror(err));
}
return result;
}
static_assert(sizeof(MemoryClassInstance) == sizeof(prelim_drm_i915_gem_memory_class_instance));
static_assert(offsetof(MemoryClassInstance, memoryClass) == offsetof(prelim_drm_i915_gem_memory_class_instance, memory_class));

View File

@@ -1,16 +0,0 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/linux/ioctl_helper.h"
namespace NEO {
bool IoctlHelperPrelim20::initialize() {
return true;
}
} // namespace NEO

View File

@@ -108,6 +108,7 @@ bool Wddm::init() {
setPlatformSupportEvictIfNecessaryFlag(*hwConfig);
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*hardwareInfo);
populateIpVersion(*hardwareInfo);
rootDeviceEnvironment.setHwInfo(hardwareInfo.get());
rootDeviceEnvironment.initGmm();
this->rootDeviceEnvironment.getGmmClientContext()->setHandleAllocator(this->hwDeviceId->getUmKmDataTranslator()->createGmmHandleAllocator());

View File

@@ -237,6 +237,7 @@ class Wddm : public DriverModel {
}
void setPlatformSupportEvictIfNecessaryFlag(const HwInfoConfig &hwInfoConfig);
void populateAdditionalAdapterInfoOptions(const ADAPTER_INFO_KMD &adapterInfo);
void populateIpVersion(HardwareInfo &hwInfo);
GMM_GFX_PARTITIONING gfxPartition{};
ADAPTER_BDF adapterBDF{};

View File

@@ -11,5 +11,6 @@ namespace NEO {
void Wddm::populateAdditionalAdapterInfoOptions(const ADAPTER_INFO_KMD &adapterInfo) {
}
void Wddm::populateIpVersion(HardwareInfo &hwInfo) {
}
} // namespace NEO