mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
test: move gmm client context initialize tests to single place
Related-To: NEO-11080 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0696340d3d
commit
4e90d80bae
@@ -23,8 +23,7 @@ class MockDriverModel : public NEO::DriverModel {
|
||||
MockDriverModel() : MockDriverModel(NEO::DriverModelType::unknown) {}
|
||||
MockDriverModel(DriverModelType driverModelType) : DriverModel(driverModelType) {}
|
||||
ADDMETHOD_NOBASE_VOIDRETURN(cleanup, ());
|
||||
|
||||
void setGmmInputArgs(void *args) override {}
|
||||
ADDMETHOD_NOBASE_VOIDRETURN(setGmmInputArgs, (void *));
|
||||
|
||||
uint32_t getDeviceHandle() const override { return {}; }
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ uint64_t MockGmmClientContextBase::freeGpuVirtualAddress(FreeGpuVirtualAddressGm
|
||||
}
|
||||
|
||||
void MockGmmClientContextBase::initialize(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
initializeCalled++;
|
||||
clientContext = {reinterpret_cast<GMM_CLIENT_CONTEXT *>(0x08), [](auto) {}};
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -37,6 +37,7 @@ class MockGmmClientContextBase : public GmmClientContext {
|
||||
uint32_t getMediaSurfaceStateCompressionFormatCalled = 0u;
|
||||
uint32_t mapGpuVirtualAddressCalled = 0u;
|
||||
uint32_t freeGpuVirtualAddressCalled = 0u;
|
||||
uint32_t initializeCalled = 0u;
|
||||
bool returnErrorOnPatIndexQuery = false;
|
||||
|
||||
bool passedCompressedSettingForGetPatIndexQuery = false;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Copyright (C) 2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
target_sources(neo_shared_tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_client_context_initialize_tests.cpp
|
||||
)
|
||||
|
||||
add_subdirectories()
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/sku_info/operations/sku_info_transfer.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/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_driver_model.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
namespace NEO {
|
||||
extern GMM_INIT_IN_ARGS passedInputArgs;
|
||||
extern GT_SYSTEM_INFO passedGtSystemInfo;
|
||||
extern SKU_FEATURE_TABLE passedFtrTable;
|
||||
extern WA_TABLE passedWaTable;
|
||||
extern bool copyInputArgs;
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
TEST(GmmClientContextTest, whenInitializeIsCalledThenClientContextHandleIsSet) {
|
||||
auto hwInfo = defaultHwInfo.get();
|
||||
MockExecutionEnvironment executionEnvironment{hwInfo};
|
||||
|
||||
GmmClientContext clientContext{};
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_NE(nullptr, clientContext.getHandle());
|
||||
}
|
||||
|
||||
TEST(GmmClientContextTest, givenNoOsInterfaceWhenIntializeIsCalledThenProperFlagsArePassedToGmmlib) {
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedGtSystemInfo)> passedGtSystemInfoBackup(&passedGtSystemInfo);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
VariableBackup<decltype(copyInputArgs)> copyInputArgsBackup(©InputArgs, true);
|
||||
|
||||
SKU_FEATURE_TABLE expectedFtrTable = {};
|
||||
WA_TABLE expectedWaTable = {};
|
||||
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
|
||||
SkuInfoTransfer::transferFtrTableForGmm(&expectedFtrTable, &hwInfo->featureTable);
|
||||
SkuInfoTransfer::transferWaTableForGmm(&expectedWaTable, &hwInfo->workaroundTable);
|
||||
|
||||
GmmClientContext clientContext{};
|
||||
clientContext.initialize(rootDeviceEnvironment);
|
||||
|
||||
EXPECT_EQ(nullptr, rootDeviceEnvironment.osInterface.get());
|
||||
EXPECT_EQ(0, memcmp(&hwInfo->platform, &passedInputArgs.Platform, sizeof(PLATFORM)));
|
||||
EXPECT_EQ(0, memcmp(&hwInfo->gtSystemInfo, &passedGtSystemInfo, sizeof(GT_SYSTEM_INFO)));
|
||||
EXPECT_EQ(0, memcmp(&expectedFtrTable, &passedFtrTable, sizeof(SKU_FEATURE_TABLE)));
|
||||
EXPECT_EQ(0, memcmp(&expectedWaTable, &passedWaTable, sizeof(WA_TABLE)));
|
||||
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, passedInputArgs.ClientType);
|
||||
}
|
||||
|
||||
TEST(GmmClientContextTest, givenOsInterfaceWhenIntializeIsCalledThenSetGmmInputArgsFuncIsCalled) {
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
rootDeviceEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
auto &osInterface = *rootDeviceEnvironment.osInterface;
|
||||
osInterface.setDriverModel(std::make_unique<MockDriverModel>());
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedGtSystemInfo)> passedGtSystemInfoBackup(&passedGtSystemInfo);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
VariableBackup<decltype(copyInputArgs)> copyInputArgsBackup(©InputArgs, true);
|
||||
|
||||
SKU_FEATURE_TABLE expectedFtrTable = {};
|
||||
WA_TABLE expectedWaTable = {};
|
||||
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
|
||||
SkuInfoTransfer::transferFtrTableForGmm(&expectedFtrTable, &hwInfo->featureTable);
|
||||
SkuInfoTransfer::transferWaTableForGmm(&expectedWaTable, &hwInfo->workaroundTable);
|
||||
|
||||
GmmClientContext clientContext{};
|
||||
clientContext.initialize(rootDeviceEnvironment);
|
||||
|
||||
EXPECT_NE(nullptr, rootDeviceEnvironment.osInterface.get());
|
||||
EXPECT_EQ(0, memcmp(&hwInfo->platform, &passedInputArgs.Platform, sizeof(PLATFORM)));
|
||||
EXPECT_EQ(0, memcmp(&hwInfo->gtSystemInfo, &passedGtSystemInfo, sizeof(GT_SYSTEM_INFO)));
|
||||
EXPECT_EQ(0, memcmp(&expectedFtrTable, &passedFtrTable, sizeof(SKU_FEATURE_TABLE)));
|
||||
EXPECT_EQ(0, memcmp(&expectedWaTable, &passedWaTable, sizeof(WA_TABLE)));
|
||||
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, passedInputArgs.ClientType);
|
||||
|
||||
EXPECT_EQ(1u, static_cast<MockDriverModel *>(osInterface.getDriverModel())->setGmmInputArgsCalled);
|
||||
}
|
||||
|
||||
TEST(GmmClientContextTest, givenEnableFtrTile64OptimizationDebugKeyWhenInitializeIsCalledThenProperValueIsPassedToGmmlib) {
|
||||
auto hwInfo = defaultHwInfo.get();
|
||||
MockExecutionEnvironment executionEnvironment{hwInfo};
|
||||
DebugManagerStateRestore restorer;
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedGtSystemInfo)> passedGtSystemInfoBackup(&passedGtSystemInfo);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
VariableBackup<decltype(copyInputArgs)> copyInputArgsBackup(©InputArgs, true);
|
||||
|
||||
GmmClientContext clientContext{};
|
||||
{
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(0u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(-1);
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(0u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(0);
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(0u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(1);
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(1u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
}
|
||||
@@ -1140,73 +1140,8 @@ TEST(GmmHelperTest, whenGmmHelperIsInitializedThenClientContextIsSet) {
|
||||
MockExecutionEnvironment executionEnvironment{hwInfo};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
ASSERT_NE(nullptr, rootDeviceEnvironment.getGmmHelper());
|
||||
EXPECT_NE(nullptr, rootDeviceEnvironment.getGmmClientContext());
|
||||
}
|
||||
|
||||
TEST(GmmHelperTest, whenGmmClientContextIsInitializedThenClientContextHandleIsSet) {
|
||||
auto hwInfo = defaultHwInfo.get();
|
||||
MockExecutionEnvironment executionEnvironment{hwInfo};
|
||||
|
||||
GmmClientContext clientContext{};
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_NE(nullptr, clientContext.getHandle());
|
||||
}
|
||||
|
||||
TEST(GmmHelperTest, givenValidGmmFunctionsWhenCreateGmmHelperWithoutOsInterfaceThenInitializationDoesntCrashAndProperParametersArePassed) {
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedGtSystemInfo)> passedGtSystemInfoBackup(&passedGtSystemInfo);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
VariableBackup<decltype(copyInputArgs)> copyInputArgsBackup(©InputArgs, true);
|
||||
|
||||
SKU_FEATURE_TABLE expectedFtrTable = {};
|
||||
WA_TABLE expectedWaTable = {};
|
||||
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
|
||||
SkuInfoTransfer::transferFtrTableForGmm(&expectedFtrTable, &hwInfo->featureTable);
|
||||
SkuInfoTransfer::transferWaTableForGmm(&expectedWaTable, &hwInfo->workaroundTable);
|
||||
|
||||
GmmClientContext clientContext{};
|
||||
clientContext.initialize(rootDeviceEnvironment);
|
||||
|
||||
EXPECT_EQ(nullptr, rootDeviceEnvironment.osInterface.get());
|
||||
EXPECT_EQ(0, memcmp(&hwInfo->platform, &passedInputArgs.Platform, sizeof(PLATFORM)));
|
||||
EXPECT_EQ(0, memcmp(&hwInfo->gtSystemInfo, &passedGtSystemInfo, sizeof(GT_SYSTEM_INFO)));
|
||||
EXPECT_EQ(0, memcmp(&expectedFtrTable, &passedFtrTable, sizeof(SKU_FEATURE_TABLE)));
|
||||
EXPECT_EQ(0, memcmp(&expectedWaTable, &passedWaTable, sizeof(WA_TABLE)));
|
||||
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, passedInputArgs.ClientType);
|
||||
}
|
||||
TEST(GmmHelperTest, givenEnableFtrTile64OptimizationDebugKeyWhenSetThenProperValueIsPassedToGmmlib) {
|
||||
auto hwInfo = defaultHwInfo.get();
|
||||
MockExecutionEnvironment executionEnvironment{hwInfo};
|
||||
DebugManagerStateRestore restorer;
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedGtSystemInfo)> passedGtSystemInfoBackup(&passedGtSystemInfo);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
VariableBackup<decltype(copyInputArgs)> copyInputArgsBackup(©InputArgs, true);
|
||||
|
||||
GmmClientContext clientContext{};
|
||||
{
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(0u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(-1);
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(0u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(0);
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(0u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(1);
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(1u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
ASSERT_NE(nullptr, rootDeviceEnvironment.getGmmClientContext());
|
||||
EXPECT_EQ(1u, static_cast<MockGmmClientContextBase *>(rootDeviceEnvironment.getGmmClientContext())->initializeCalled);
|
||||
}
|
||||
|
||||
TEST(GmmHelperTest, givenNewCoherencyModelWhenGetMocsThenDeferToPat) {
|
||||
|
||||
@@ -68,32 +68,24 @@ TEST(OsInterfaceTest, GivenLinuxOsInterfaceWhenCallingGetAggregatedProcessCountT
|
||||
EXPECT_EQ(5u, osInterface.getAggregatedProcessCount());
|
||||
}
|
||||
|
||||
TEST(OsInterfaceTest, whenOsInterfaceSetupGmmInputArgsThenArgsAreSet) {
|
||||
TEST(OsInterfaceTest, whenOsInterfaceSetupsGmmInputArgsThenFileDescriptorIsSetWithValueOfAdapterBdf) {
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
auto drm = std::make_unique<DrmMock>(rootDeviceEnvironment);
|
||||
rootDeviceEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
rootDeviceEnvironment.osInterface->setDriverModel(std::move(drm));
|
||||
auto drm = std::make_unique<DrmMock>(rootDeviceEnvironment);
|
||||
drm->setPciPath("0000:01:23.4");
|
||||
EXPECT_EQ(0, drm->queryAdapterBDF());
|
||||
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedGtSystemInfo)> passedGtSystemInfoBackup(&passedGtSystemInfo);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
VariableBackup<decltype(copyInputArgs)> copyInputArgsBackup(©InputArgs, true);
|
||||
GMM_INIT_IN_ARGS gmmInputArgs = {};
|
||||
EXPECT_EQ(0u, gmmInputArgs.FileDescriptor);
|
||||
drm->Drm::setGmmInputArgs(&gmmInputArgs);
|
||||
EXPECT_NE(0u, gmmInputArgs.FileDescriptor);
|
||||
|
||||
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
|
||||
SKU_FEATURE_TABLE expectedFtrTable = {};
|
||||
WA_TABLE expectedWaTable = {};
|
||||
SkuInfoTransfer::transferFtrTableForGmm(&expectedFtrTable, &hwInfo->featureTable);
|
||||
SkuInfoTransfer::transferWaTableForGmm(&expectedWaTable, &hwInfo->workaroundTable);
|
||||
|
||||
GmmClientContext clientContext{};
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(0, memcmp(&hwInfo->platform, &passedInputArgs.Platform, sizeof(PLATFORM)));
|
||||
EXPECT_EQ(&hwInfo->gtSystemInfo, passedInputArgs.pGtSysInfo);
|
||||
EXPECT_EQ(0, memcmp(&expectedFtrTable, &passedFtrTable, sizeof(SKU_FEATURE_TABLE)));
|
||||
EXPECT_EQ(0, memcmp(&expectedWaTable, &passedWaTable, sizeof(WA_TABLE)));
|
||||
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, passedInputArgs.ClientType);
|
||||
ADAPTER_BDF expectedAdapterBDF{};
|
||||
expectedAdapterBDF.Bus = 0x1;
|
||||
expectedAdapterBDF.Device = 0x23;
|
||||
expectedAdapterBDF.Function = 0x4;
|
||||
EXPECT_EQ(expectedAdapterBDF.Data, gmmInputArgs.FileDescriptor);
|
||||
}
|
||||
|
||||
TEST(OsInterfaceTest, GivenLinuxOsInterfaceWhenGetThresholdForStagingCalledThenReturnThresholdForIntegratedDevices) {
|
||||
|
||||
@@ -13,7 +13,6 @@ if(WIN32)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/file_logger_win_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_adapter_luid_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper_tests_win.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/product_helper_win_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/product_helper_win_tests.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_win_tests.cpp
|
||||
@@ -62,4 +61,4 @@ if(NOT WIN32 AND NOT DISABLE_WDDM_LINUX)
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectories()
|
||||
add_subdirectories()
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/gmm_helper/gmm_lib.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
extern GMM_INIT_IN_ARGS passedInputArgs;
|
||||
extern bool copyInputArgs;
|
||||
|
||||
TEST(GmmHelperTest, whenInitializeGmmClientContextWithoutOsInterfaceThenPassedAdapterBDFIsZeroed) {
|
||||
ADAPTER_BDF expectedAdapterBDF{};
|
||||
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(copyInputArgs)> copyInputArgsBackup(©InputArgs, true);
|
||||
GmmClientContext clientContext{};
|
||||
clientContext.initialize(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
EXPECT_EQ(0, memcmp(&expectedAdapterBDF, &passedInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF)));
|
||||
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, passedInputArgs.ClientType);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -86,71 +86,13 @@ TEST_F(OsInterfaceTest, whenOsInterfaceSetupGmmInputArgsThenArgsAreSet) {
|
||||
uint32_t function = 0x56;
|
||||
adapterBDF.Function = function;
|
||||
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedGtSystemInfo)> passedGtSystemInfoBackup(&passedGtSystemInfo);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
VariableBackup<decltype(copyInputArgs)> copyInputArgsBackup(©InputArgs, true);
|
||||
GMM_INIT_IN_ARGS gmmInputArgs = {};
|
||||
wddm->Wddm::setGmmInputArgs(&gmmInputArgs);
|
||||
|
||||
GmmClientContext clientContext{};
|
||||
clientContext.initialize(rootDeviceEnvironment);
|
||||
|
||||
EXPECT_EQ(0, memcmp(&wddm->adapterBDF, &passedInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF)));
|
||||
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, passedInputArgs.ClientType);
|
||||
EXPECT_STREQ(expectedRegistryPath, passedInputArgs.DeviceRegistryPath);
|
||||
EXPECT_EQ(expectedCoreFamily, passedInputArgs.Platform.eRenderCoreFamily);
|
||||
EXPECT_EQ(expectedCoreFamily, passedInputArgs.Platform.eDisplayCoreFamily);
|
||||
EXPECT_EQ(wddm->gfxFeatureTable.get(), passedInputArgs.pSkuTable);
|
||||
EXPECT_EQ(wddm->gfxWorkaroundTable.get(), passedInputArgs.pWaTable);
|
||||
EXPECT_EQ(&rootDeviceEnvironment.getHardwareInfo()->gtSystemInfo, passedInputArgs.pGtSysInfo);
|
||||
}
|
||||
|
||||
TEST_F(OsInterfaceTest, givenEnableFtrTile64OptimizationDebugKeyWhenSetThenProperValueIsPassedToGmmlib) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
auto wddm = new WddmMock(rootDeviceEnvironment);
|
||||
EXPECT_EQ(nullptr, rootDeviceEnvironment.osInterface.get());
|
||||
wddm->init();
|
||||
EXPECT_NE(nullptr, rootDeviceEnvironment.osInterface.get());
|
||||
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedGtSystemInfo)> passedGtSystemInfoBackup(&passedGtSystemInfo);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
VariableBackup<decltype(copyInputArgs)> copyInputArgsBackup(©InputArgs, true);
|
||||
DebugManagerStateRestore restorer;
|
||||
GmmClientContext clientContext{};
|
||||
{
|
||||
wddm->gfxFeatureTable->FtrTile64Optimization = 1;
|
||||
clientContext.initialize(rootDeviceEnvironment);
|
||||
EXPECT_EQ(0u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(-1);
|
||||
wddm->gfxFeatureTable->FtrTile64Optimization = 1;
|
||||
clientContext.initialize(rootDeviceEnvironment);
|
||||
EXPECT_EQ(1u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(-1);
|
||||
wddm->gfxFeatureTable->FtrTile64Optimization = 0;
|
||||
clientContext.initialize(rootDeviceEnvironment);
|
||||
EXPECT_EQ(0u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(0);
|
||||
wddm->gfxFeatureTable->FtrTile64Optimization = 1;
|
||||
clientContext.initialize(rootDeviceEnvironment);
|
||||
EXPECT_EQ(0u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
|
||||
{
|
||||
debugManager.flags.EnableFtrTile64Optimization.set(1);
|
||||
wddm->gfxFeatureTable->FtrTile64Optimization = 0;
|
||||
clientContext.initialize(rootDeviceEnvironment);
|
||||
EXPECT_EQ(1u, passedFtrTable.FtrTile64Optimization);
|
||||
}
|
||||
EXPECT_EQ(0, memcmp(&wddm->adapterBDF, &gmmInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF)));
|
||||
EXPECT_STREQ(expectedRegistryPath, gmmInputArgs.DeviceRegistryPath);
|
||||
EXPECT_EQ(expectedCoreFamily, gmmInputArgs.Platform.eRenderCoreFamily);
|
||||
EXPECT_EQ(expectedCoreFamily, gmmInputArgs.Platform.eDisplayCoreFamily);
|
||||
}
|
||||
|
||||
TEST_F(OsInterfaceTest, whenGetThresholdForStagingCalledThenReturnNoThreshold) {
|
||||
@@ -162,4 +104,4 @@ TEST_F(OsInterfaceTest, whenGetThresholdForStagingCalledThenReturnNoThreshold) {
|
||||
EXPECT_NE(nullptr, rootDeviceEnvironment.osInterface.get());
|
||||
auto alignedPtr = reinterpret_cast<const void *>(2 * MemoryConstants::megaByte);
|
||||
EXPECT_TRUE(rootDeviceEnvironment.osInterface->isSizeWithinThresholdForStaging(alignedPtr, MemoryConstants::gigaByte));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user