Skip to content

Commit 9ac3529

Browse files
Remove template parameter from Wddm methods
Change-Id: Icd700c7215184d4c0f9564c61868a1f9f29a75e5 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent e613129 commit 9ac3529

25 files changed

+421
-470
lines changed

runtime/gen10/windows/wddm_gen10.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,12 @@
2121
*/
2222

2323
#include "hw_cmds.h"
24-
#include "runtime/os_interface/windows/wddm/wddm.h"
25-
#include "runtime/os_interface/windows/wddm/wddm.inl"
2624
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
2725
#include "runtime/os_interface/windows/wddm_engine_mapper.inl"
2826

2927
namespace OCLRT {
3028

3129
typedef CNLFamily Family;
3230

33-
template bool Wddm::configureDeviceAddressSpace<Family>();
34-
35-
template bool Wddm::init<Family>();
36-
3731
template class WddmEngineMapper<CNLFamily>;
3832
} // namespace OCLRT

runtime/gen8/windows/wddm_gen8.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,12 @@
2121
*/
2222

2323
#include "hw_cmds.h"
24-
#include "runtime/os_interface/windows/wddm/wddm.h"
25-
#include "runtime/os_interface/windows/wddm/wddm.inl"
2624
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
2725
#include "runtime/os_interface/windows/wddm_engine_mapper.inl"
2826

2927
namespace OCLRT {
3028

3129
typedef BDWFamily Family;
3230

33-
template bool Wddm::init<Family>();
34-
35-
template bool Wddm::configureDeviceAddressSpace<Family>();
36-
3731
template class WddmEngineMapper<BDWFamily>;
3832
} // namespace OCLRT

runtime/gen9/windows/wddm_gen9.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,12 @@
2121
*/
2222

2323
#include "hw_cmds.h"
24-
#include "runtime/os_interface/windows/wddm/wddm.h"
25-
#include "runtime/os_interface/windows/wddm/wddm.inl"
2624
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
2725
#include "runtime/os_interface/windows/wddm_engine_mapper.inl"
2826

2927
namespace OCLRT {
3028

3129
typedef SKLFamily Family;
3230

33-
template bool Wddm::configureDeviceAddressSpace<Family>();
34-
35-
template bool Wddm::init<Family>();
36-
3731
template class WddmEngineMapper<SKLFamily>;
3832
} // namespace OCLRT

runtime/gmm_helper/gmm_memory_base.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "gmm_client_context.h"
2424
#include "runtime/gmm_helper/gmm_memory_base.h"
2525
#include "runtime/gmm_helper/gmm_helper.h"
26+
#include "runtime/os_interface/windows/windows_defs.h"
2627

2728
namespace OCLRT {
2829
GmmMemoryBase::GmmMemoryBase() {
@@ -32,20 +33,27 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
3233
GMM_ESCAPE_HANDLE hDevice,
3334
GMM_ESCAPE_FUNC_TYPE pfnEscape,
3435
GMM_GFX_SIZE_T SvmSize,
35-
BOOLEAN FaultableSvm,
36-
BOOLEAN SparseReady,
37-
BOOLEAN BDWL3Coherency,
38-
GMM_GFX_SIZE_T SizeOverride,
39-
GMM_GFX_SIZE_T SlmGfxSpaceReserve) {
36+
BOOLEAN BDWL3Coherency) {
4037
return clientContext->ConfigureDeviceAddressSpace(
4138
{hAdapter},
4239
{hDevice},
4340
{pfnEscape},
4441
SvmSize,
45-
FaultableSvm,
46-
SparseReady,
42+
0,
43+
0,
4744
BDWL3Coherency,
48-
SizeOverride,
49-
SlmGfxSpaceReserve) != 0;
45+
0,
46+
0) != 0;
47+
}
48+
49+
bool GmmMemoryBase::configureDevice(GMM_ESCAPE_HANDLE hAdapter,
50+
GMM_ESCAPE_HANDLE hDevice,
51+
GMM_ESCAPE_FUNC_TYPE pfnEscape,
52+
GMM_GFX_SIZE_T SvmSize,
53+
BOOLEAN BDWL3Coherency,
54+
GMM_GFX_PARTITIONING &gfxPartition,
55+
uintptr_t &minAddress) {
56+
minAddress = windowsMinAddress;
57+
return configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, SvmSize, BDWL3Coherency);
5058
}
5159
}; // namespace OCLRT

runtime/gmm_helper/gmm_memory_base.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@ class GmmMemoryBase {
3333
GMM_ESCAPE_HANDLE hDevice,
3434
GMM_ESCAPE_FUNC_TYPE pfnEscape,
3535
GMM_GFX_SIZE_T SvmSize,
36-
BOOLEAN FaultableSvm,
37-
BOOLEAN SparseReady,
38-
BOOLEAN BDWL3Coherency,
39-
GMM_GFX_SIZE_T SizeOverride,
40-
GMM_GFX_SIZE_T SlmGfxSpaceReserve);
36+
BOOLEAN BDWL3Coherency);
37+
38+
virtual bool configureDevice(GMM_ESCAPE_HANDLE hAdapter,
39+
GMM_ESCAPE_HANDLE hDevice,
40+
GMM_ESCAPE_FUNC_TYPE pfnEscape,
41+
GMM_GFX_SIZE_T SvmSize,
42+
BOOLEAN BDWL3Coherency,
43+
GMM_GFX_PARTITIONING &gfxPartition,
44+
uintptr_t &minAddress);
4145

4246
protected:
4347
GmmMemoryBase();

runtime/helpers/hw_helper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class HwHelper {
4545
virtual void adjustDefaultEngineType(HardwareInfo *pHwInfo) = 0;
4646
virtual void setupHardwareCapabilities(HardwareCapabilities *caps) = 0;
4747
virtual SipKernelType getSipKernelType(bool debuggingActive) = 0;
48+
virtual uint32_t getConfigureAddressSpaceMode() = 0;
4849

4950
protected:
5051
HwHelper(){};
@@ -94,6 +95,8 @@ class HwHelperHw : public HwHelper {
9495

9596
SipKernelType getSipKernelType(bool debuggingActive) override;
9697

98+
uint32_t getConfigureAddressSpaceMode() override;
99+
97100
private:
98101
HwHelperHw(){};
99102
};

runtime/helpers/hw_helper.inl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,8 @@ SipKernelType HwHelperHw<Family>::getSipKernelType(bool debuggingActive) {
5959
return SipKernelType::DbgCsr;
6060
}
6161

62+
template <typename Family>
63+
uint32_t HwHelperHw<Family>::getConfigureAddressSpaceMode() {
64+
return 0u;
65+
}
6266
} // namespace OCLRT

runtime/os_interface/windows/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,13 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
7474
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
7575
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.cpp
7676
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.h
77-
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.inl
7877
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.h
7978
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.cpp
8079
)
8180

8281
if(WIN32)
83-
file(GLOB RUNTIME_SRCS_WDDM_INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm2[0-9]\.*")
84-
8582
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE
8683
${RUNTIME_SRCS_OS_INTERFACE_WINDOWS}
87-
${RUNTIME_SRCS_WDDM_INTERFACE}
8884
)
8985
endif()
9086

runtime/os_interface/windows/wddm/wddm.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "runtime/gmm_helper/page_table_mngr.h"
3131
#include "runtime/os_interface/windows/wddm/wddm.h"
3232
#include "runtime/os_interface/hw_info_config.h"
33+
#include "runtime/os_interface/windows/gdi_interface.h"
3334
#include "runtime/os_interface/windows/os_context_win.h"
3435
#include "runtime/os_interface/windows/wddm_allocation.h"
3536
#include "runtime/os_interface/windows/registry_reader.h"
@@ -893,4 +894,50 @@ MonitoredFence &Wddm::getMonitoredFence() { return osContext->getMonitoredFence(
893894
D3DKMT_HANDLE Wddm::getOsDeviceContext() const {
894895
return osContext->getContext();
895896
}
897+
898+
bool Wddm::configureDeviceAddressSpace() {
899+
SYSTEM_INFO sysInfo;
900+
Wddm::getSystemInfo(&sysInfo);
901+
maximumApplicationAddress = reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress);
902+
903+
return gmmMemory->configureDevice(adapter, device, gdi->escape,
904+
maximumApplicationAddress + 1u,
905+
featureTable->ftrL3IACoherency,
906+
gfxPartition, minAddress);
907+
}
908+
909+
bool Wddm::init() {
910+
if (gdi != nullptr && gdi->isInitialized() && !initialized) {
911+
if (!openAdapter()) {
912+
return false;
913+
}
914+
if (!queryAdapterInfo()) {
915+
return false;
916+
}
917+
918+
if (!wddmInterface) {
919+
if (featureTable->ftrWddmHwQueues) {
920+
wddmInterface = std::make_unique<WddmInterface23>(*this);
921+
} else {
922+
wddmInterface = std::make_unique<WddmInterface20>(*this);
923+
}
924+
}
925+
926+
if (!createDevice()) {
927+
return false;
928+
}
929+
if (!createPagingQueue()) {
930+
return false;
931+
}
932+
if (!gmmMemory) {
933+
gmmMemory.reset(GmmMemory::create());
934+
}
935+
if (!configureDeviceAddressSpace()) {
936+
return false;
937+
}
938+
osContext = std::make_unique<OsContextWin>(*this);
939+
initialized = osContext->isInitialized();
940+
}
941+
return initialized;
942+
}
896943
} // namespace OCLRT

runtime/os_interface/windows/wddm/wddm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,8 @@ class Wddm {
9898
MOCKABLE_VIRTUAL void *virtualAlloc(void *inPtr, size_t size, unsigned long flags, unsigned long type);
9999
MOCKABLE_VIRTUAL int virtualFree(void *ptr, size_t size, unsigned long flags);
100100

101-
template <typename GfxFamily>
102101
bool configureDeviceAddressSpace();
103102

104-
template <typename GfxFamily>
105103
bool init();
106104

107105
bool isInitialized() const {

runtime/os_interface/windows/wddm/wddm.inl

Lines changed: 0 additions & 76 deletions
This file was deleted.

runtime/os_interface/windows/wddm_device_command_stream.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareIn
7575
this->dispatchMode = (DispatchMode)DebugManager.flags.CsrDispatchMode.get();
7676
}
7777

78-
bool success = this->wddm->init<GfxFamily>();
78+
bool success = this->wddm->init();
7979
DEBUG_BREAK_IF(!success);
8080
}
8181

unit_tests/device/device_win_timers_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ namespace ULT {
3232

3333
typedef ::testing::Test MockOSTimeWinTest;
3434

35-
HWTEST_F(MockOSTimeWinTest, DynamicResolution) {
35+
TEST_F(MockOSTimeWinTest, DynamicResolution) {
3636
auto wddmMock = std::unique_ptr<WddmMock>(new WddmMock());
3737
auto mDev = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
3838

39-
bool error = wddmMock->init<FamilyType>();
39+
bool error = wddmMock->init();
4040
EXPECT_EQ(1u, wddmMock->createContextResult.called);
4141

4242
std::unique_ptr<MockOSTimeWin> timeWin(new MockOSTimeWin(wddmMock.get()));

unit_tests/gen10/hw_helper_tests_gen10.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,8 @@ GEN10TEST_F(HwHelperTestCnl, givenGen10PlatformWhenSetupHardwareCapabilitiesIsCa
8080
// Test default method implementation
8181
testDefaultImplementationOfSetupHardwareCapabilities(helper);
8282
}
83+
84+
GEN10TEST_F(HwHelperTestCnl, whenGetConfigureAddressSpaceModeThenReturnZero) {
85+
auto &helper = HwHelper::get(renderCoreFamily);
86+
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
87+
}

unit_tests/gen8/hw_helper_tests_gen8.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@ GEN8TEST_F(HwHelperTestBdw, givenGen8PlatformWhenSetupHardwareCapabilitiesIsCall
6767
EXPECT_EQ(2048u, hwCaps.image3DMaxWidth);
6868
EXPECT_EQ(2 * MemoryConstants::gigaByte - 8 * MemoryConstants::megaByte, hwCaps.maxMemAllocSize);
6969
EXPECT_FALSE(hwCaps.isStatelesToStatefullWithOffsetSupported);
70+
}
71+
72+
GEN8TEST_F(HwHelperTestBdw, whenGetConfigureAddressSpaceModeThenReturnZero) {
73+
auto &helper = HwHelper::get(renderCoreFamily);
74+
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
7075
}

unit_tests/gen9/hw_helper_tests_gen9.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,9 @@ GEN9TEST_F(HwHelperTestSkl, givenDebuggingActiveWhenSipKernelTypeIsQueriedThenDb
7070

7171
auto sipType = helper.getSipKernelType(true);
7272
EXPECT_EQ(SipKernelType::DbgCsrLocal, sipType);
73+
}
74+
75+
GEN9TEST_F(HwHelperTestSkl, whenGetConfigureAddressSpaceModeThenReturnZero) {
76+
auto &helper = HwHelper::get(renderCoreFamily);
77+
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
7378
}

unit_tests/mocks/mock_gmm_memory_base.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ class MockGmmMemoryBase : public GmmMemory {
3737
GMM_ESCAPE_HANDLE hDevice,
3838
GMM_ESCAPE_FUNC_TYPE pfnEscape,
3939
GMM_GFX_SIZE_T SvmSize,
40-
BOOLEAN FaultableSvm,
41-
BOOLEAN SparseReady,
42-
BOOLEAN BDWL3Coherency,
43-
GMM_GFX_SIZE_T SizeOverride,
44-
GMM_GFX_SIZE_T SlmGfxSpaceReserve) override {
40+
BOOLEAN BDWL3Coherency) override {
4541
return true;
4642
}
4743
};
@@ -52,15 +48,11 @@ class GmockGmmMemoryBase : public GmmMemory {
5248

5349
GmockGmmMemoryBase() = default;
5450

55-
MOCK_METHOD9(configureDeviceAddressSpace,
51+
MOCK_METHOD5(configureDeviceAddressSpace,
5652
bool(GMM_ESCAPE_HANDLE hAdapter,
5753
GMM_ESCAPE_HANDLE hDevice,
5854
GMM_ESCAPE_FUNC_TYPE pfnEscape,
5955
GMM_GFX_SIZE_T SvmSize,
60-
BOOLEAN FaultableSvm,
61-
BOOLEAN SparseReady,
62-
BOOLEAN BDWL3Coherency,
63-
GMM_GFX_SIZE_T SizeOverride,
64-
GMM_GFX_SIZE_T SlmGfxSpaceReserve));
56+
BOOLEAN BDWL3Coherency));
6557
};
6658
} // namespace OCLRT

0 commit comments

Comments
 (0)