Skip to content

Commit c858a2b

Browse files
Refactor configuring device address space logic:
1. call GmmSetDeviceInfo 2. call ConfigureDeviceAddressSpace 3. obtain min address - only for gen12lp platforms remove getConfigureAddressSpaceMode method Resolves: NEO-4076 Change-Id: Ib72789c834df1307a3d105131943dcf9a54afc03 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
1 parent 902ee28 commit c858a2b

File tree

17 files changed

+240
-77
lines changed

17 files changed

+240
-77
lines changed

core/helpers/hw_helper.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2019 Intel Corporation
2+
* Copyright (C) 2017-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -37,7 +37,6 @@ class HwHelper {
3737
virtual void setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) = 0;
3838
virtual bool isL3Configurable(const HardwareInfo &hwInfo) = 0;
3939
virtual SipKernelType getSipKernelType(bool debuggingActive) = 0;
40-
virtual uint32_t getConfigureAddressSpaceMode() = 0;
4140
virtual bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const = 0;
4241
virtual bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const = 0;
4342
virtual const AubMemDump::LrcaHelper &getCsTraits(aub_stream::EngineType engineType) const = 0;
@@ -134,8 +133,6 @@ class HwHelperHw : public HwHelper {
134133

135134
SipKernelType getSipKernelType(bool debuggingActive) override;
136135

137-
uint32_t getConfigureAddressSpaceMode() override;
138-
139136
bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const override;
140137

141138
bool hvAlign4Required() const override;

core/helpers/hw_helper_bdw_plus.inl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 Intel Corporation
2+
* Copyright (C) 2019-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -25,11 +25,6 @@ void HwHelperHw<GfxFamily>::setCapabilityCoherencyFlag(const HardwareInfo *pHwIn
2525
coherencyFlag = true;
2626
}
2727

28-
template <typename GfxFamily>
29-
uint32_t HwHelperHw<GfxFamily>::getConfigureAddressSpaceMode() {
30-
return 0u;
31-
}
32-
3328
template <typename GfxFamily>
3429
bool HwHelperHw<GfxFamily>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) const {
3530
return false;

runtime/gen12lp/hw_helper_gen12lp.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 Intel Corporation
2+
* Copyright (C) 2019-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -45,11 +45,6 @@ uint32_t HwHelperHw<Family>::getComputeUnitsUsedForScratch(const HardwareInfo *p
4545
return pHwInfo->gtSystemInfo.MaxSubSlicesSupported * pHwInfo->gtSystemInfo.MaxEuPerSubSlice * 8;
4646
}
4747

48-
template <>
49-
uint32_t HwHelperHw<Family>::getConfigureAddressSpaceMode() {
50-
return 1u;
51-
}
52-
5348
template <>
5449
bool HwHelperHw<Family>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) const {
5550
return Gen12LPHelpers::isLocalMemoryEnabled(hwInfo);

runtime/gmm_helper/gmm_memory_base.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2019 Intel Corporation
2+
* Copyright (C) 2018-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -39,9 +39,22 @@ bool GmmMemoryBase::configureDevice(GMM_ESCAPE_HANDLE hAdapter,
3939
GMM_ESCAPE_FUNC_TYPE pfnEscape,
4040
GMM_GFX_SIZE_T SvmSize,
4141
BOOLEAN BDWL3Coherency,
42-
GMM_GFX_PARTITIONING &gfxPartition,
43-
uintptr_t &minAddress) {
42+
uintptr_t &minAddress,
43+
bool obtainMinAddress) {
4444
minAddress = windowsMinAddress;
45-
return configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, SvmSize, BDWL3Coherency);
45+
auto retVal = configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, SvmSize, BDWL3Coherency);
46+
if (obtainMinAddress) {
47+
minAddress = getInternalGpuVaRangeLimit();
48+
}
49+
return retVal;
50+
}
51+
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
52+
return static_cast<uintptr_t>(clientContext->GetInternalGpuVaRangeLimit());
53+
}
54+
55+
bool GmmMemoryBase::setDeviceInfo(GMM_DEVICE_INFO *deviceInfo) {
56+
auto status = clientContext->GmmSetDeviceInfo(deviceInfo);
57+
DEBUG_BREAK_IF(status != GMM_SUCCESS);
58+
return GMM_SUCCESS == status;
4659
}
4760
}; // namespace NEO

runtime/gmm_helper/gmm_memory_base.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2019 Intel Corporation
2+
* Copyright (C) 2018-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -21,13 +21,17 @@ class GmmMemoryBase {
2121
GMM_GFX_SIZE_T SvmSize,
2222
BOOLEAN BDWL3Coherency);
2323

24-
virtual bool configureDevice(GMM_ESCAPE_HANDLE hAdapter,
25-
GMM_ESCAPE_HANDLE hDevice,
26-
GMM_ESCAPE_FUNC_TYPE pfnEscape,
27-
GMM_GFX_SIZE_T SvmSize,
28-
BOOLEAN BDWL3Coherency,
29-
GMM_GFX_PARTITIONING &gfxPartition,
30-
uintptr_t &minAddress);
24+
bool configureDevice(GMM_ESCAPE_HANDLE hAdapter,
25+
GMM_ESCAPE_HANDLE hDevice,
26+
GMM_ESCAPE_FUNC_TYPE pfnEscape,
27+
GMM_GFX_SIZE_T SvmSize,
28+
BOOLEAN BDWL3Coherency,
29+
uintptr_t &minAddress,
30+
bool obtainMinAddress);
31+
32+
MOCKABLE_VIRTUAL uintptr_t getInternalGpuVaRangeLimit();
33+
34+
MOCKABLE_VIRTUAL bool setDeviceInfo(GMM_DEVICE_INFO *deviceInfo);
3135

3236
protected:
3337
GmmMemoryBase();

runtime/os_interface/windows/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
5252
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
5353
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.cpp
5454
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.h
55-
${CMAKE_CURRENT_SOURCE_DIR}/wddm${BRANCH_DIR_SUFFIX}/wddm_configure_device.cpp
5655
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.h
5756
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.cpp
5857
)

runtime/os_interface/windows/wddm/wddm.cpp

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "core/utilities/stackvec.h"
2222
#include "runtime/execution_environment/execution_environment.h"
2323
#include "runtime/gmm_helper/gmm.h"
24+
#include "runtime/helpers/windows/gmm_callbacks.h"
2425
#include "runtime/memory_manager/memory_manager.h"
2526
#include "runtime/os_interface/hw_info_config.h"
2627
#include "runtime/os_interface/windows/gdi_interface.h"
@@ -938,7 +939,37 @@ int Wddm::virtualFree(void *ptr, size_t size, unsigned long flags) {
938939
return virtualFreeFnc(ptr, size, flags);
939940
}
940941

941-
bool Wddm::configureDeviceAddressSpaceImpl() {
942+
long __stdcall notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate) {
943+
return notifyAubCaptureImpl(csrHandle, gfxAddress, gfxSize, allocate);
944+
}
945+
bool Wddm::configureDeviceAddressSpace() {
946+
GMM_DEVICE_CALLBACKS_INT deviceCallbacks{};
947+
deviceCallbacks.Adapter.KmtHandle = adapter;
948+
deviceCallbacks.hCsr = nullptr;
949+
deviceCallbacks.hDevice.KmtHandle = device;
950+
deviceCallbacks.PagingQueue = pagingQueue;
951+
deviceCallbacks.PagingFence = pagingQueueSyncObject;
952+
953+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnAllocate = gdi->createAllocation;
954+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnDeallocate = gdi->destroyAllocation;
955+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnMapGPUVA = gdi->mapGpuVirtualAddress;
956+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnMakeResident = gdi->makeResident;
957+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnEvict = gdi->evict;
958+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnReserveGPUVA = gdi->reserveGpuVirtualAddress;
959+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnUpdateGPUVA = gdi->updateGpuVirtualAddress;
960+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnWaitFromCpu = gdi->waitForSynchronizationObjectFromCpu;
961+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnLock = gdi->lock2;
962+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnUnLock = gdi->unlock2;
963+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnEscape = gdi->escape;
964+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnFreeGPUVA = gdi->freeGpuVirtualAddress;
965+
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture = notifyAubCapture;
966+
967+
GMM_DEVICE_INFO deviceInfo{};
968+
deviceInfo.pGfxPartition = &gfxPartition;
969+
deviceInfo.pDeviceCb = &deviceCallbacks;
970+
if (!gmmMemory->setDeviceInfo(&deviceInfo)) {
971+
return false;
972+
}
942973
SYSTEM_INFO sysInfo;
943974
Wddm::getSystemInfo(&sysInfo);
944975
maximumApplicationAddress = reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress);
@@ -950,7 +981,8 @@ bool Wddm::configureDeviceAddressSpaceImpl() {
950981
? maximumApplicationAddress + 1u
951982
: 0u;
952983

953-
return gmmMemory->configureDevice(adapter, device, gdi->escape, svmSize, featureTable->ftrL3IACoherency, gfxPartition, minAddress);
984+
bool obtainMinAddress = gfxPlatform->eRenderCoreFamily == IGFX_GEN12LP_CORE;
985+
return gmmMemory->configureDevice(adapter, device, gdi->escape, svmSize, featureTable->ftrL3IACoherency, minAddress, obtainMinAddress);
954986
}
955987

956988
void Wddm::waitOnPagingFenceFromCpu() {

runtime/os_interface/windows/wddm/wddm.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2019 Intel Corporation
2+
* Copyright (C) 2017-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -195,7 +195,6 @@ class Wddm {
195195
bool closeAdapter();
196196
void getDeviceState();
197197
void handleCompletion(OsContextWin &osContext);
198-
bool configureDeviceAddressSpaceImpl();
199198

200199
static CreateDXGIFactoryFcn createDxgiFactory;
201200
static GetSystemInfoFcn getSystemInfo;

runtime/os_interface/windows/wddm/wddm_configure_device.cpp

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

unit_tests/gen11/hw_helper_tests_gen11.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2019 Intel Corporation
2+
* Copyright (C) 2018-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -42,11 +42,6 @@ GEN11TEST_F(HwHelperTestGen11, givenGen11PlatformWhenSetupHardwareCapabilitiesIs
4242
testDefaultImplementationOfSetupHardwareCapabilities(helper, hardwareInfo);
4343
}
4444

45-
GEN11TEST_F(HwHelperTestGen11, whenGetConfigureAddressSpaceModeThenReturnZero) {
46-
auto &helper = HwHelper::get(renderCoreFamily);
47-
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
48-
}
49-
5045
GEN11TEST_F(HwHelperTestGen11, whenGetGpgpuEnginesThenReturnTwoRcsEngines) {
5146
whenGetGpgpuEnginesThenReturnTwoRcsEngines<FamilyType>();
5247
EXPECT_EQ(2u, pDevice->engines.size());

0 commit comments

Comments
 (0)