fix: init releaseHelper after ipVersion setup
Related-To: NEO-7786 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
parent
831363e51b
commit
dadd19e17b
|
@ -86,6 +86,10 @@ void RootDeviceEnvironment::setHwInfoAndInitHelpers(const HardwareInfo *hwInfo)
|
|||
initHelpers();
|
||||
}
|
||||
|
||||
void RootDeviceEnvironment::setHwInfo(const HardwareInfo *hwInfo) {
|
||||
*this->hwInfo = *hwInfo;
|
||||
}
|
||||
|
||||
bool RootDeviceEnvironment::isFullRangeSvm() const {
|
||||
return hwInfo->capabilityTable.gpuAddressSpace >= maxNBitValue(47);
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ struct RootDeviceEnvironment {
|
|||
MOCKABLE_VIRTUAL const HardwareInfo *getHardwareInfo() const;
|
||||
HardwareInfo *getMutableHardwareInfo() const;
|
||||
void setHwInfoAndInitHelpers(const HardwareInfo *hwInfo);
|
||||
void setHwInfo(const HardwareInfo *hwInfo);
|
||||
bool isFullRangeSvm() const;
|
||||
bool isWddmOnLinux() const;
|
||||
|
||||
|
|
|
@ -57,7 +57,13 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
|
|||
|
||||
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get();
|
||||
rootDeviceEnvironment.setHwInfoAndInitHelpers(hwInfoConst);
|
||||
rootDeviceEnvironment.setHwInfo(hwInfoConst);
|
||||
|
||||
rootDeviceEnvironment.initProductHelper();
|
||||
rootDeviceEnvironment.initGfxCoreHelper();
|
||||
rootDeviceEnvironment.initApiGfxCoreHelper();
|
||||
rootDeviceEnvironment.initCompilerProductHelper();
|
||||
|
||||
auto hardwareInfo = rootDeviceEnvironment.getMutableHardwareInfo();
|
||||
|
||||
if (DebugManager.flags.OverrideRevision.get() != -1) {
|
||||
|
@ -92,6 +98,8 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
|
|||
hardwareInfo->ipVersion = DebugManager.flags.OverrideHwIpVersion.get();
|
||||
}
|
||||
|
||||
rootDeviceEnvironment.initReleaseHelper();
|
||||
|
||||
if (DebugManager.flags.OverrideGpuAddressSpace.get() != -1) {
|
||||
hardwareInfo->capabilityTable.gpuAddressSpace = maxNBitValue(static_cast<uint64_t>(DebugManager.flags.OverrideGpuAddressSpace.get()));
|
||||
}
|
||||
|
|
|
@ -430,7 +430,11 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl
|
|||
auto deviceId = hwInfo->platform.usDeviceID;
|
||||
auto revisionId = hwInfo->platform.usRevId;
|
||||
|
||||
rootDeviceEnvironment.setHwInfoAndInitHelpers(device->pHwInfo);
|
||||
rootDeviceEnvironment.setHwInfo(device->pHwInfo);
|
||||
rootDeviceEnvironment.initProductHelper();
|
||||
rootDeviceEnvironment.initGfxCoreHelper();
|
||||
rootDeviceEnvironment.initApiGfxCoreHelper();
|
||||
rootDeviceEnvironment.initCompilerProductHelper();
|
||||
|
||||
hwInfo->platform.usDeviceID = deviceId;
|
||||
hwInfo->platform.usRevId = revisionId;
|
||||
|
@ -438,6 +442,7 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl
|
|||
const auto productFamily = hwInfo->platform.eProductFamily;
|
||||
setupIoctlHelper(productFamily);
|
||||
ioctlHelper->setupIpVersion();
|
||||
rootDeviceEnvironment.initReleaseHelper();
|
||||
|
||||
Drm::QueryTopologyData topologyData = {};
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
@ -48,6 +49,27 @@ TEST_F(DeviceFactoryTests, givenHwIpVersionOverrideWhenPrepareDeviceEnvironments
|
|||
EXPECT_NE(0u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->platform.usDeviceID);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTests, givenHwIpVersionOverrideWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenReleaseHelperContainsCorrectIpVersion) {
|
||||
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
|
||||
auto config = defaultHwInfo.get()->ipVersion.value;
|
||||
DebugManager.flags.OverrideHwIpVersion.set(config);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
auto *releaseHelper = executionEnvironment.rootDeviceEnvironments[0]->getReleaseHelper();
|
||||
|
||||
if (releaseHelper == nullptr) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
class ReleaseHelperExpose : public ReleaseHelper {
|
||||
public:
|
||||
using ReleaseHelper::hardwareIpVersion;
|
||||
};
|
||||
|
||||
ReleaseHelperExpose *exposedReleaseHelper = static_cast<ReleaseHelperExpose *>(releaseHelper);
|
||||
EXPECT_EQ(config, exposedReleaseHelper->hardwareIpVersion.value);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTests, givenHwIpVersionAndDeviceIdOverrideWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenCorrectValueIsSet) {
|
||||
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
|
||||
auto config = defaultHwInfo.get()->ipVersion.value;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||
#include "shared/source/os_interface/linux/system_info.h"
|
||||
#include "shared/source/os_interface/product_helper.h"
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/helpers/gtest_helpers.h"
|
||||
|
@ -89,6 +90,49 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFalseThenSystem
|
|||
EXPECT_TRUE(isEmpty(::testing::internal::GetCapturedStderr()));
|
||||
}
|
||||
|
||||
TEST(DrmSystemInfoTest, whenSetupHardwareInfoThenReleaseHelperContainsCorrectIpVersion) {
|
||||
struct DrmMockToQuerySystemInfo : public DrmMock {
|
||||
DrmMockToQuerySystemInfo(RootDeviceEnvironment &rootDeviceEnvironment)
|
||||
: DrmMock(rootDeviceEnvironment) {}
|
||||
bool querySystemInfo() override { return false; }
|
||||
};
|
||||
|
||||
class MyMockIoctlHelper : public IoctlHelperPrelim20 {
|
||||
public:
|
||||
using IoctlHelperPrelim20::IoctlHelperPrelim20;
|
||||
void setupIpVersion() override {
|
||||
drm.getRootDeviceEnvironment().getMutableHardwareInfo()->ipVersion.architecture = 12u;
|
||||
drm.getRootDeviceEnvironment().getMutableHardwareInfo()->ipVersion.release = 55u;
|
||||
}
|
||||
};
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->releaseHelper.reset(nullptr);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
DrmMockToQuerySystemInfo drm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drm.ioctlHelper = std::make_unique<MyMockIoctlHelper>(drm);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
auto setupHardwareInfo = [](HardwareInfo *, bool, const CompilerProductHelper &) {};
|
||||
DeviceDescriptor device = {0, &hwInfo, setupHardwareInfo};
|
||||
|
||||
int ret = drm.setupHardwareInfo(&device, false);
|
||||
ASSERT_EQ(ret, 0);
|
||||
|
||||
auto *releaseHelper = drm.getRootDeviceEnvironment().getReleaseHelper();
|
||||
|
||||
if (releaseHelper == nullptr) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
class ReleaseHelperExpose : public ReleaseHelper {
|
||||
public:
|
||||
using ReleaseHelper::hardwareIpVersion;
|
||||
};
|
||||
|
||||
ReleaseHelperExpose *exposedReleaseHelper = static_cast<ReleaseHelperExpose *>(releaseHelper);
|
||||
EXPECT_EQ(12u, exposedReleaseHelper->hardwareIpVersion.architecture);
|
||||
EXPECT_EQ(55u, exposedReleaseHelper->hardwareIpVersion.release);
|
||||
}
|
||||
|
||||
TEST(DrmSystemInfoTest, whenQueryingSystemInfoThenSystemInfoIsCreatedAndReturnsNonZeros) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMockEngine drm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
|
Loading…
Reference in New Issue