Create wrapper for Gmm exported functions
Related-To: NEO-2551 Change-Id: I6d2912b2cb020e9544e52af7c46f54d5174a1a52 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
cccb95bc4e
commit
9562daa2d0
|
@ -14,6 +14,7 @@ set(NEO_CORE_GMM_HELPER
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/gmm.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_lib.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/page_table_mngr.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/page_table_mngr_impl.cpp
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "core/gmm_helper/client_context/gmm_client_context_base.h"
|
||||
|
||||
#include "core/gmm_helper/gmm_helper.h"
|
||||
#include "core/gmm_helper/gmm_interface.h"
|
||||
#include "core/helpers/debug_helpers.h"
|
||||
#include "core/helpers/hw_info.h"
|
||||
#include "core/sku_info/operations/sku_info_transfer.h"
|
||||
|
@ -33,7 +34,7 @@ GmmClientContextBase::GmmClientContextBase(OSInterface *osInterface, HardwareInf
|
|||
osInterface->setGmmInputArgs(&inArgs);
|
||||
}
|
||||
|
||||
auto ret = InitializeGmm(&inArgs, &outArgs);
|
||||
auto ret = GmmInterface::initialize(&inArgs, &outArgs);
|
||||
|
||||
UNRECOVERABLE_IF(ret != GMM_SUCCESS);
|
||||
|
||||
|
@ -43,7 +44,7 @@ GmmClientContextBase::~GmmClientContextBase() {
|
|||
GMM_INIT_OUT_ARGS outArgs;
|
||||
outArgs.pGmmClientContext = clientContext;
|
||||
|
||||
GmmAdapterDestroy(&outArgs);
|
||||
GmmInterface::destroy(&outArgs);
|
||||
};
|
||||
|
||||
MEMORY_OBJECT_CONTROL_STATE GmmClientContextBase::cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage) {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/gmm_helper/gmm_lib.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
namespace GmmInterface {
|
||||
|
||||
GMM_STATUS initialize(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs);
|
||||
|
||||
void destroy(GMM_INIT_OUT_ARGS *pInArgs);
|
||||
} // namespace GmmInterface
|
||||
} // namespace NEO
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/gmm_helper/gmm_interface.h"
|
||||
namespace NEO {
|
||||
namespace GmmInterface {
|
||||
GMM_STATUS initialize(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs) {
|
||||
return InitializeGmm(pInArgs, pOutArgs);
|
||||
}
|
||||
|
||||
void destroy(GMM_INIT_OUT_ARGS *pInArgs) {
|
||||
GmmAdapterDestroy(pInArgs);
|
||||
}
|
||||
} // namespace GmmInterface
|
||||
} // namespace NEO
|
|
@ -16,7 +16,6 @@ set(NEO_CORE_OS_INTERFACE_WINDOWS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/debug_registry_reader.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener${KMDAF_FILE_SUFFIX}.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_inc.h
|
||||
|
|
|
@ -5,17 +5,19 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "core/gmm_helper/gmm_lib.h"
|
||||
#include "core/gmm_helper/gmm_interface.h"
|
||||
#include "core/helpers/debug_helpers.h"
|
||||
#include "core/os_interface/os_library.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace NEO;
|
||||
namespace NEO {
|
||||
|
||||
static std::unique_ptr<OsLibrary> gmmLib;
|
||||
|
||||
GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs) {
|
||||
namespace GmmInterface {
|
||||
|
||||
GMM_STATUS initialize(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs) {
|
||||
if (!gmmLib) {
|
||||
gmmLib.reset(OsLibrary::load(GMM_UMD_DLL));
|
||||
UNRECOVERABLE_IF(!gmmLib);
|
||||
|
@ -25,8 +27,10 @@ GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARG
|
|||
return initGmmFunc(pInArgs, pOutArgs);
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmAdapterDestroy(GMM_INIT_OUT_ARGS *pInArgs) {
|
||||
void destroy(GMM_INIT_OUT_ARGS *pInArgs) {
|
||||
auto destroyGmmFunc = reinterpret_cast<decltype(&GmmAdapterDestroy)>(gmmLib->getProcAddress(GMM_ADAPTER_DESTROY_NAME));
|
||||
UNRECOVERABLE_IF(!destroyGmmFunc);
|
||||
destroyGmmFunc(pInArgs);
|
||||
}
|
||||
} // namespace GmmInterface
|
||||
} // namespace NEO
|
|
@ -159,8 +159,8 @@ if(${GENERATE_EXECUTABLE})
|
|||
if(WIN32)
|
||||
target_link_libraries(${NEO_DYNAMIC_LIB_NAME} dxgi)
|
||||
add_dependencies(${NEO_DYNAMIC_LIB_NAME} ${GMM_TARGET_NAME})
|
||||
target_sources(${NEO_DYNAMIC_LIB_NAME} PRIVATE
|
||||
${NEO_SOURCE_DIR}/core/os_interface/windows/gmm_interface.cpp
|
||||
target_sources(${NEO_DYNAMIC_LIB_NAME} PRIVATE
|
||||
${NEO_SOURCE_DIR}/core/os_interface/windows/gmm_interface_win.cpp
|
||||
)
|
||||
else()
|
||||
target_link_libraries(${NEO_DYNAMIC_LIB_NAME} ${GMM_LINK_NAME})
|
||||
|
@ -174,6 +174,9 @@ if(${GENERATE_EXECUTABLE})
|
|||
APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-Bsymbolic"
|
||||
)
|
||||
set_property(TARGET ${NEO_DYNAMIC_LIB_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${ASAN_FLAGS})
|
||||
target_sources(${NEO_DYNAMIC_LIB_NAME} PRIVATE
|
||||
${NEO_SOURCE_DIR}/core/os_interface/linux/gmm_interface_linux.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(${NEO_DYNAMIC_LIB_NAME} PROPERTIES
|
||||
|
|
|
@ -54,9 +54,14 @@ target_sources(igdrcl_aub_tests PRIVATE
|
|||
|
||||
if(WIN32)
|
||||
target_sources(igdrcl_aub_tests PRIVATE
|
||||
${NEO_SOURCE_DIR}/core/os_interface/windows/gmm_interface_win.cpp
|
||||
${NEO_SOURCE_DIR}/runtime/gmm_helper/gmm_memory.cpp
|
||||
${NEO_SOURCE_DIR}/unit_tests/os_interface/windows/wddm_create.cpp
|
||||
)
|
||||
else()
|
||||
target_sources(igdrcl_aub_tests PRIVATE
|
||||
${NEO_SOURCE_DIR}/core/os_interface/linux/gmm_interface_linux.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
copy_gmm_dll_for(igdrcl_aub_tests)
|
||||
|
@ -71,7 +76,7 @@ if(UNIX)
|
|||
else()
|
||||
add_dependencies(igdrcl_aub_tests ${GMM_TARGET_NAME})
|
||||
target_sources(igdrcl_aub_tests PRIVATE
|
||||
${NEO_SOURCE_DIR}/core/os_interface/windows/gmm_interface.cpp
|
||||
${NEO_SOURCE_DIR}/core/os_interface/windows/gmm_interface_win.cpp
|
||||
)
|
||||
endif()
|
||||
target_include_directories(igdrcl_aub_tests BEFORE PRIVATE ${NEO_SOURCE_DIR}/core/unit_tests/test_macros${BRANCH_DIR_SUFFIX})
|
||||
|
|
|
@ -30,11 +30,13 @@
|
|||
|
||||
using namespace ::testing;
|
||||
|
||||
namespace NEO {
|
||||
|
||||
extern GMM_INIT_IN_ARGS passedInputArgs;
|
||||
extern SKU_FEATURE_TABLE passedFtrTable;
|
||||
extern WA_TABLE passedWaTable;
|
||||
extern bool copyInputArgs;
|
||||
namespace NEO {
|
||||
|
||||
struct GmmTests : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "core/debug_settings/debug_settings_manager.h"
|
||||
#include "core/gmm_helper/gmm_helper.h"
|
||||
#include "core/gmm_helper/gmm_interface.h"
|
||||
#include "core/gmm_helper/resource_info.h"
|
||||
#include "core/helpers/options.h"
|
||||
#include "core/unit_tests/helpers/memory_leak_listener.h"
|
||||
|
@ -457,7 +458,7 @@ int main(int argc, char **argv) {
|
|||
if (useMockGmm) {
|
||||
GmmHelper::createGmmContextWrapperFunc = GmmClientContextBase::create<MockGmmClientContext>;
|
||||
} else {
|
||||
InitializeGmm(nullptr, nullptr);
|
||||
GmmInterface::initialize(nullptr, nullptr);
|
||||
}
|
||||
initializeTestHelpers();
|
||||
|
||||
|
|
|
@ -5,14 +5,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "GmmLib.h"
|
||||
#include "core/gmm_helper/gmm_interface.h"
|
||||
|
||||
namespace NEO {
|
||||
GMM_INIT_IN_ARGS passedInputArgs = {};
|
||||
SKU_FEATURE_TABLE passedFtrTable = {};
|
||||
WA_TABLE passedWaTable = {};
|
||||
bool copyInputArgs = false;
|
||||
|
||||
GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs) {
|
||||
namespace GmmInterface {
|
||||
GMM_STATUS initialize(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs) {
|
||||
pOutArgs->pGmmClientContext = reinterpret_cast<GMM_CLIENT_CONTEXT *>(0x01);
|
||||
if (pInArgs) {
|
||||
if (pInArgs->Platform.eProductFamily == PRODUCT_FAMILY::IGFX_UNKNOWN &&
|
||||
|
@ -29,5 +31,7 @@ GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARG
|
|||
return GMM_INVALIDPARAM;
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmAdapterDestroy(GMM_INIT_OUT_ARGS *pInArgs) {
|
||||
void destroy(GMM_INIT_OUT_ARGS *pInArgs) {
|
||||
}
|
||||
} // namespace GmmInterface
|
||||
} // namespace NEO
|
||||
|
|
Loading…
Reference in New Issue