Add wddm ult for wsl build [3/n]

Related-To: NEO-6066
Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
Kamil Diedrich
2022-12-07 21:57:39 +01:00
committed by Compute-Runtime-Automation
parent c1ecba0c4c
commit db24428cd3
19 changed files with 170 additions and 55 deletions

View File

@@ -22,14 +22,20 @@ if(WIN32)
${CMAKE_CURRENT_SOURCE_DIR}/self_lib_win.cpp
${CMAKE_CURRENT_SOURCE_DIR}/um_km_data_translator_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_address_space_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_adapter_luid_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_command_stream_l0_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_mapper_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_preemption_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_shared_allocations_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_special_heap_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_reservation_tests.cpp
)
endif()
if(WIN32 OR(UNIX AND NOT DISABLE_WDDM_LINUX))
target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/wddm_tests.cpp
)
endif()
add_subdirectories()

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/helpers/string.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
#include "shared/test/common/test_macros/hw_test.h"
namespace NEO {
std::unique_ptr<HwDeviceIdWddm> createHwDeviceIdFromAdapterLuid(OsEnvironmentWin &osEnvironment, LUID adapterLuid);
using WddmOsContextDeviceLuidTests = WddmFixtureLuid;
TEST_F(WddmFixtureLuid, givenValidOsContextAndLuidDataRequestThenValidDataReturned) {
LUID adapterLuid = {0x12, 0x1234};
wddm->hwDeviceId = NEO::createHwDeviceIdFromAdapterLuid(*osEnvironment, adapterLuid);
std::vector<uint8_t> luidData;
size_t arraySize = 8;
osContext->getDeviceLuidArray(luidData, arraySize);
uint64_t luid = 0;
memcpy_s(&luid, sizeof(uint64_t), luidData.data(), sizeof(uint8_t) * luidData.size());
EXPECT_NE(luid, (uint64_t)0);
}
} // namespace NEO

View File

@@ -9,6 +9,7 @@
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_wddm.h"
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
#include "shared/test/common/test_macros/hw_test.h"
using namespace NEO;
@@ -140,3 +141,19 @@ TEST(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondNullThenReturnSeco
EXPECT_FALSE(ret);
EXPECT_EQ(expectedReserve, reinterpret_cast<uintptr_t>(reserve));
}
using WddmTests = WddmTestWithMockGdiDll;
TEST_F(WddmTests, whenInitializingWddmThenSetMinAddressToCorrectValue) {
constexpr static uintptr_t mockedInternalGpuVaRange = 0x9876u;
auto gmmMemory = new MockGmmMemoryBase(wddm->rootDeviceEnvironment.getGmmClientContext());
gmmMemory->overrideInternalGpuVaRangeLimit(mockedInternalGpuVaRange);
wddm->gmmMemory.reset(gmmMemory);
ASSERT_EQ(0u, wddm->getWddmMinAddress());
wddm->init();
const bool obtainFromGmm = defaultHwInfo->platform.eRenderCoreFamily == IGFX_GEN12LP_CORE;
const auto expectedMinAddress = obtainFromGmm ? mockedInternalGpuVaRange : windowsMinAddress;
ASSERT_EQ(expectedMinAddress, wddm->getWddmMinAddress());
}

View File

@@ -28,20 +28,6 @@ TEST_F(WddmTests, whenCreatingAllocation64kThenDoNotCreateResource) {
EXPECT_EQ(FALSE, gdiParam->Flags.CreateResource);
}
TEST_F(WddmTests, whenInitializingWddmThenSetMinAddressToCorrectValue) {
constexpr static uintptr_t mockedInternalGpuVaRange = 0x9876u;
auto gmmMemory = new MockGmmMemoryBase(wddm->rootDeviceEnvironment.getGmmClientContext());
gmmMemory->overrideInternalGpuVaRangeLimit(mockedInternalGpuVaRange);
wddm->gmmMemory.reset(gmmMemory);
ASSERT_EQ(0u, wddm->getWddmMinAddress());
wddm->init();
const bool obtainFromGmm = defaultHwInfo->platform.eRenderCoreFamily == IGFX_GEN12LP_CORE;
const auto expectedMinAddress = obtainFromGmm ? mockedInternalGpuVaRange : windowsMinAddress;
ASSERT_EQ(expectedMinAddress, wddm->getWddmMinAddress());
}
TEST_F(WddmTests, whenInitializingWddmThenSetTimestampFrequencyToCorrectValue) {
EXPECT_EQ(0u, wddm->timestampFrequency);
init();
@@ -192,7 +178,7 @@ TEST_F(WddmTests, GivengtSystemInfoSliceInfoHasEnabledSlicesAtHigherIndicesThenE
TEST_F(WddmTests, GivenProperTopologyDataAndDebugFlagsEnabledWhenInitializingWddmThenExpectTopologyMapCreateAndReturnTrue) {
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = 10;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = GT_MAX_SLICE;
defaultHwInfo.get()->gtSystemInfo.IsDynamicallyPopulated = true;
defaultHwInfo.get()->gtSystemInfo.SliceCount = 1; // Only one slice enabled
@@ -217,7 +203,7 @@ TEST_F(WddmTests, GivenProperTopologyDataAndDebugFlagsEnabledWhenInitializingWdd
TEST_F(WddmTests, GivenNoSubsliceEnabledAndDebugFlagsEnabledWhenInitializingWddmThenExpectTopologyMapNotCreateAndReturnFalse) {
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = 10;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = GT_MAX_SLICE;
defaultHwInfo.get()->gtSystemInfo.SliceCount = 1; // Only one slice enabled
defaultHwInfo.get()->gtSystemInfo.IsDynamicallyPopulated = true;
defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].DualSubSliceEnabledCount = 1;
@@ -239,7 +225,7 @@ TEST_F(WddmTests, GivenNoSubsliceEnabledAndDebugFlagsEnabledWhenInitializingWddm
TEST_F(WddmTests, GivenProperTopologyDataWhenQueryingTopologyThenExpectTrue) {
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
defaultHwInfo.get()->gtSystemInfo.MultiTileArchInfo.TileCount = 1;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = 10;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = GT_MAX_SLICE;
defaultHwInfo.get()->gtSystemInfo.IsDynamicallyPopulated = true;
defaultHwInfo.get()->gtSystemInfo.SliceCount = 1; // Only one slice enabled
@@ -274,7 +260,7 @@ TEST_F(WddmTests, GivenProperTopologyDataWhenQueryingTopologyThenExpectTrue) {
TEST_F(WddmTests, GivenMoreThanOneEnabledSliceWhenQueryingTopologyThenExpectTrueAndNoSubSliceIndicesInTopology) {
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
defaultHwInfo.get()->gtSystemInfo.MultiTileArchInfo.TileCount = 1;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = 10;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = GT_MAX_SLICE;
defaultHwInfo.get()->gtSystemInfo.SliceCount = 2;
defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].Enabled = false;
defaultHwInfo.get()->gtSystemInfo.IsDynamicallyPopulated = true;
@@ -307,7 +293,7 @@ TEST_F(WddmTests, GivenMoreThanOneEnabledSliceWhenQueryingTopologyThenExpectTrue
TEST_F(WddmTests, GivenNoSubsliceEnabledWhenQueryingTopologyThenExpectFalse) {
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
defaultHwInfo.get()->gtSystemInfo.MultiTileArchInfo.TileCount = 1;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = 10;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = GT_MAX_SLICE;
defaultHwInfo.get()->gtSystemInfo.SliceCount = 1;
defaultHwInfo.get()->gtSystemInfo.IsDynamicallyPopulated = true;
@@ -325,7 +311,7 @@ TEST_F(WddmTests, GivenNoSubsliceEnabledWhenQueryingTopologyThenExpectFalse) {
TEST_F(WddmTests, GivenNoEuThreadsEnabledWhenQueryingTopologyThenExpectFalse) {
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
defaultHwInfo.get()->gtSystemInfo.MultiTileArchInfo.TileCount = 1;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = 10;
defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = GT_MAX_SLICE;
defaultHwInfo.get()->gtSystemInfo.SliceCount = 1;
defaultHwInfo.get()->gtSystemInfo.IsDynamicallyPopulated = true;
@@ -389,17 +375,6 @@ TEST_F(WddmTests, GivenPlatformNotSupportEvictIfNecessaryWhenAdjustingEvictNeede
bool value = wddm->adjustEvictNeededParameter(false);
EXPECT_TRUE(value);
}
using WddmOsContextDeviceLuidTests = WddmFixtureLuid;
TEST_F(WddmFixtureLuid, givenValidOsContextAndLuidDataRequestThenValidDataReturned) {
LUID adapterLuid = {0x12, 0x1234};
wddm->hwDeviceId = NEO::createHwDeviceIdFromAdapterLuid(*osEnvironment, adapterLuid);
std::vector<uint8_t> luidData;
size_t arraySize = 8;
osContext->getDeviceLuidArray(luidData, arraySize);
uint64_t luid = 0;
memcpy_s(&luid, sizeof(uint64_t), luidData.data(), sizeof(uint8_t) * luidData.size());
EXPECT_NE(luid, (uint64_t)0);
}
uint64_t waitForSynchronizationObjectFromCpuCounter = 0u;