Skip to content

Commit 9ac3529

Browse files
Remove template parameter from Wddm methods
Change-Id: Icd700c7215184d4c0f9564c61868a1f9f29a75e5 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
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 {

0 commit comments

Comments
 (0)