fix: obtain hw ip version from kmd in wsl mode

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-06-07 14:38:53 +02:00
committed by Compute-Runtime-Automation
parent 5fe9d70066
commit 0c7a36bc8f
8 changed files with 61 additions and 18 deletions

View File

@@ -22,11 +22,13 @@
using SKU_FEATURE_TABLE_GMM = SKU_FEATURE_TABLE;
using WA_TABLE_GMM = WA_TABLE;
using ADAPTER_INFO_GMM = ADAPTER_INFO;
using PLATFORM_GMM = PLATFORM;
#if defined(UMD_KMD_COMMAND_BUFFER_REV_ID)
using SKU_FEATURE_TABLE_KMD = SKU_FEATURE_TABLE_GMM;
using WA_TABLE_KMD = WA_TABLE_GMM;
using ADAPTER_INFO_KMD = ADAPTER_INFO_GMM;
using PLATFORM_KMD = PLATFORM_GMM;
inline void propagateData(ADAPTER_INFO_KMD &) {
}
@@ -161,11 +163,21 @@ struct CREATECONTEXT_PVTDATA { // NOLINT(readability-identifier-naming)
BOOLEAN NoRingFlushes; // NOLINT(readability-identifier-naming)
};
struct PLATFORM_KMD : PLATFORM_GMM { // NOLINT(readability-identifier-naming)
struct HwIpVersion {
uint32_t Value; // NOLINT(readability-identifier-naming)
};
HwIpVersion sRenderBlockID;
};
struct ADAPTER_INFO_KMD : ADAPTER_INFO_GMM { // NOLINT(readability-identifier-naming)
SKU_FEATURE_TABLE_KMD SkuTable; // NOLINT(readability-identifier-naming)
WA_TABLE_KMD WaTable; // NOLINT(readability-identifier-naming)
GMM_GFX_PARTITIONING GfxPartition; // NOLINT(readability-identifier-naming)
ADAPTER_BDF stAdapterBDF;
PLATFORM_KMD GfxPlatform; // NOLINT(readability-identifier-naming)
};
static constexpr COMMAND_BUFFER_HEADER initCommandBufferHeader(uint32_t umdContextType, uint32_t umdPatchList, uint32_t usesResourceStreamer, uint32_t perfTag) {
@@ -187,5 +199,6 @@ inline void propagateData(ADAPTER_INFO_KMD &adapterInfo) {
ADAPTER_INFO &base = static_cast<ADAPTER_INFO &>(adapterInfo);
base.SkuTable = adapterInfo.SkuTable;
base.WaTable = adapterInfo.WaTable;
base.GfxPlatform = adapterInfo.GfxPlatform;
}
#endif

View File

@@ -64,7 +64,7 @@ Wddm::Wddm(std::unique_ptr<HwDeviceIdWddm> &&hwDeviceIdIn, RootDeviceEnvironment
featureTable.reset(new FeatureTable());
workaroundTable.reset(new WorkaroundTable());
gtSystemInfo.reset(new GT_SYSTEM_INFO);
gfxPlatform.reset(new PLATFORM);
gfxPlatform.reset(new PLATFORM_KMD);
memset(gtSystemInfo.get(), 0, sizeof(*gtSystemInfo));
memset(gfxPlatform.get(), 0, sizeof(*gfxPlatform));
this->enablePreemptionRegValue = NEO::readEnablePreemptionRegKey();
@@ -262,7 +262,7 @@ bool Wddm::queryAdapterInfo() {
// translate
if (status == STATUS_SUCCESS) {
memcpy_s(gtSystemInfo.get(), sizeof(GT_SYSTEM_INFO), &adapterInfo.SystemInfo, sizeof(GT_SYSTEM_INFO));
memcpy_s(gfxPlatform.get(), sizeof(PLATFORM), &adapterInfo.GfxPlatform, sizeof(PLATFORM));
memcpy_s(gfxPlatform.get(), sizeof(PLATFORM_KMD), &adapterInfo.GfxPlatform, sizeof(PLATFORM_KMD));
SkuInfoReceiver::receiveFtrTableFromAdapterInfo(featureTable.get(), &adapterInfo);
SkuInfoReceiver::receiveWaTableFromAdapterInfo(workaroundTable.get(), &adapterInfo);
@@ -1236,4 +1236,12 @@ PhysicalDevicePciSpeedInfo Wddm::getPciSpeedInfo() const {
return speedInfo;
}
void Wddm::populateIpVersion(HardwareInfo &hwInfo) {
hwInfo.ipVersion.value = gfxPlatform->sRenderBlockID.Value;
if (hwInfo.ipVersion.value == 0) {
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
hwInfo.ipVersion.value = compilerProductHelper.getHwIpVersion(hwInfo);
}
}
} // namespace NEO

View File

@@ -240,7 +240,7 @@ class Wddm : public DriverModel {
uint64_t dedicatedVideoMemory = 0;
// Adapter information
std::unique_ptr<PLATFORM> gfxPlatform;
std::unique_ptr<PLATFORM_KMD> gfxPlatform;
std::unique_ptr<GT_SYSTEM_INFO> gtSystemInfo;
std::unique_ptr<FeatureTable> featureTable;
std::unique_ptr<WorkaroundTable> workaroundTable;

View File

@@ -5,17 +5,10 @@
*
*/
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/windows/wddm/wddm.h"
namespace NEO {
void Wddm::populateAdditionalAdapterInfoOptions(const ADAPTER_INFO_KMD &adapterInfo) {
}
void Wddm::populateIpVersion(HardwareInfo &hwInfo) {
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
hwInfo.ipVersion.value = compilerProductHelper.getHwIpVersion(hwInfo);
}
} // namespace NEO

View File

@@ -36,7 +36,7 @@ UINT64 PagingFence = 0;
void mockSetAdapterInfo(const void *pGfxPlatform, const void *pGTSystemInfo, uint64_t gpuAddressSpace) {
if (pGfxPlatform != NULL) {
gAdapterInfo.GfxPlatform = *(PLATFORM *)pGfxPlatform;
static_cast<PLATFORM &>(gAdapterInfo.GfxPlatform) = *reinterpret_cast<const PLATFORM *>(pGfxPlatform);
}
if (pGTSystemInfo != NULL) {
gAdapterInfo.SystemInfo = *(GT_SYSTEM_INFO *)pGTSystemInfo;

View File

@@ -227,7 +227,7 @@ struct WddmLinuxTest : public ::testing::Test {
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
wddm->gmmMemory = std::make_unique<MockGmmMemoryWddmLinux>(gmmHelper->getClientContext());
*wddm->gfxPlatform = NEO::defaultHwInfo->platform;
static_cast<PLATFORM &>(*wddm->gfxPlatform) = NEO::defaultHwInfo->platform;
rootDeviceEnvironment.osInterface.reset(new NEO::OSInterface);
rootDeviceEnvironment.osInterface->setDriverModel(std::move(wddm));
@@ -829,7 +829,7 @@ TEST(OSTimeWinLinuxTests, givenOSInterfaceWhenGetCpuGpuTimeThenGetCpuTimeFromOsT
std::unique_ptr<NEO::OSInterface> osInterface(new NEO::OSInterface());
std::unique_ptr<MockWddmLinux> wddm = std::make_unique<MockWddmLinux>(std::move(hwDeviceIdIn), mockRootDeviceEnvironment);
*wddm->gfxPlatform = NEO::defaultHwInfo->platform;
static_cast<PLATFORM &>(*wddm->gfxPlatform) = NEO::defaultHwInfo->platform;
mockRootDeviceEnvironment.setHwInfoAndInitHelpers(NEO::defaultHwInfo.get());
auto mockDeviceTimeWddm = std::make_unique<MockDeviceTimeWddm>(wddm.get());
osInterface->setDriverModel(std::move(wddm));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -2884,9 +2884,36 @@ struct Demarshaller<TOK_S_ADAPTER_INFO> {
tokGfxPlatform = tokGfxPlatform + 1 + tokGfxPlatform->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tokGfxPlatform);
if (tokGfxPlatform->flags.flag3IsMandatory) {
return false;
}
switch (tokGfxPlatform->id) {
default:
if (tokGfxPlatform->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_FS_PLATFORM_STR__S_RENDER_BLOCK_ID: {
const TokenHeader *tokSRenderBlockID = varLen->getValue<TokenHeader>();
const TokenHeader *tokSRenderBlockIDEnd = varLen->getValue<TokenHeader>() + varLen->valueLengthInBytes / sizeof(TokenHeader);
while (tokSRenderBlockID < tokSRenderBlockIDEnd) {
if (false == tokSRenderBlockID->flags.flag4IsVariableLength) {
switch (tokSRenderBlockID->id) {
default:
if (tokSRenderBlockID->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_FBD_GFX_GMD_ID_DEF__ANONYMOUS7345__VALUE:
dst.GfxPlatform.sRenderBlockID.Value = readTokValue<decltype(dst.GfxPlatform.sRenderBlockID.Value)>(*tokSRenderBlockID);
break;
};
tokSRenderBlockID = tokSRenderBlockID + 1 + tokSRenderBlockID->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tokSRenderBlockID);
tokSRenderBlockID = tokSRenderBlockID + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}
WCH_ASSERT(tokSRenderBlockID == tokSRenderBlockIDEnd);
} break;
};
tokGfxPlatform = tokGfxPlatform + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -544,6 +544,7 @@ enum TOK : uint32_t {
TOK_FBD_WA_TABLE__WA_SAMPLER_CACHE_FLUSH_BETWEEN_REDESCRIBED_SURFACE_READS = 2606,
TOK_FBD_WA_TABLE__WA_ALIGN_YUVRESOURCE_TO_LCU = 2702,
TOK_FBD_WA_TABLE__WA32BPP_TILE_Y2DCOLOR_NO_HALIGN4 = 2711,
TOK_FBD_GFX_GMD_ID_DEF__ANONYMOUS7345__VALUE = 3474,
TOK_FE_PLATFORM_STR__E_PRODUCT_FAMILY = 3475,
TOK_FE_PLATFORM_STR__E_PCHPRODUCT_FAMILY = 3476,
TOK_FE_PLATFORM_STR__E_DISPLAY_CORE_FAMILY = 3477,
@@ -554,6 +555,7 @@ enum TOK : uint32_t {
TOK_FBW_PLATFORM_STR__US_DEVICE_ID_PCH = 3482,
TOK_FBW_PLATFORM_STR__US_REV_ID_PCH = 3483,
TOK_FE_PLATFORM_STR__E_GTTYPE = 3484,
TOK_FS_PLATFORM_STR__S_RENDER_BLOCK_ID = 3487,
TOK_FBD_KMD_CAPS_INFO__GAMMA_RGB256X3X16 = 3501,
TOK_FBD_KMD_CAPS_INFO__GDIACCELERATION = 3502,
TOK_FBD_KMD_CAPS_INFO__OS_MANAGED_HW_CONTEXT = 3503,