Files
compute-runtime/runtime/gmm_helper/gmm_memory_base.cpp
Mateusz Jablonski c858a2b79f 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>
2020-01-07 11:57:58 +01:00

61 lines
2.1 KiB
C++

/*
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/gmm_helper/gmm_memory_base.h"
#include "core/gmm_helper/gmm_helper.h"
#include "core/os_interface/windows/windows_defs.h"
#include "runtime/platform/platform.h"
#include "gmm_client_context.h"
namespace NEO {
GmmMemoryBase::GmmMemoryBase() {
clientContext = platform()->peekGmmHelper()->getClientContext()->getHandle();
}
bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
GMM_ESCAPE_HANDLE hDevice,
GMM_ESCAPE_FUNC_TYPE pfnEscape,
GMM_GFX_SIZE_T SvmSize,
BOOLEAN BDWL3Coherency) {
return clientContext->ConfigureDeviceAddressSpace(
{hAdapter},
{hDevice},
{pfnEscape},
SvmSize,
0,
0,
BDWL3Coherency,
0,
0) != 0;
}
bool GmmMemoryBase::configureDevice(GMM_ESCAPE_HANDLE hAdapter,
GMM_ESCAPE_HANDLE hDevice,
GMM_ESCAPE_FUNC_TYPE pfnEscape,
GMM_GFX_SIZE_T SvmSize,
BOOLEAN BDWL3Coherency,
uintptr_t &minAddress,
bool obtainMinAddress) {
minAddress = windowsMinAddress;
auto retVal = configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, SvmSize, BDWL3Coherency);
if (obtainMinAddress) {
minAddress = getInternalGpuVaRangeLimit();
}
return retVal;
}
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
return static_cast<uintptr_t>(clientContext->GetInternalGpuVaRangeLimit());
}
bool GmmMemoryBase::setDeviceInfo(GMM_DEVICE_INFO *deviceInfo) {
auto status = clientContext->GmmSetDeviceInfo(deviceInfo);
DEBUG_BREAK_IF(status != GMM_SUCCESS);
return GMM_SUCCESS == status;
}
}; // namespace NEO