Clean up driver experimental headers
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
parent
1ee733e191
commit
9f79e432bb
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2020-2021 Intel Corporation
|
# Copyright (C) 2020-2022 Intel Corporation
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
#
|
||||||
|
@ -22,4 +22,5 @@ append_sources_from_properties(L0_API
|
||||||
L0_EXTENSIONS_SRCS_API
|
L0_EXTENSIONS_SRCS_API
|
||||||
L0_PUBLIC_EXTENSIONS_SRCS_API
|
L0_PUBLIC_EXTENSIONS_SRCS_API
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY L0_API ${L0_API})
|
set_property(GLOBAL PROPERTY L0_API ${L0_API})
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2020 Intel Corporation
|
# Copyright (C) 2020-2022 Intel Corporation
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
#
|
||||||
|
|
||||||
set(L0_EXPERIMENTAL_API
|
set(L0_EXPERIMENTAL_API
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/zex_api.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/zex_driver.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/zex_driver.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/zex_module.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/zex_module.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY L0_EXPERIMENTAL_API ${L0_EXPERIMENTAL_API})
|
set_property(GLOBAL PROPERTY L0_EXPERIMENTAL_API ${L0_EXPERIMENTAL_API})
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ZEX_API_H
|
||||||
|
#define _ZEX_API_H
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 'core' API headers
|
||||||
|
#include <level_zero/ze_api.h>
|
||||||
|
|
||||||
|
// driver experimental API headers
|
||||||
|
#include "zex_driver.h"
|
||||||
|
#include "zex_module.h"
|
||||||
|
|
||||||
|
#endif // _ZEX_API_H
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020-2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "level_zero/core/source/driver/driver.h"
|
||||||
|
#include "level_zero/core/source/driver/driver_handle.h"
|
||||||
|
|
||||||
|
#include "zex_api.h"
|
||||||
|
|
||||||
|
ZE_APIEXPORT ze_result_t ZE_APICALL
|
||||||
|
zexDriverImportExternalPointer(
|
||||||
|
ze_driver_handle_t hDriver,
|
||||||
|
void *ptr,
|
||||||
|
size_t size) {
|
||||||
|
return L0::DriverHandle::fromHandle(hDriver)->importExternalPointer(ptr, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZE_APIEXPORT ze_result_t ZE_APICALL
|
||||||
|
zexDriverReleaseImportedPointer(
|
||||||
|
ze_driver_handle_t hDriver,
|
||||||
|
void *ptr) {
|
||||||
|
return L0::DriverHandle::fromHandle(hDriver)->releaseImportedPointer(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZE_APIEXPORT ze_result_t ZE_APICALL
|
||||||
|
zexDriverGetHostPointerBaseAddress(
|
||||||
|
ze_driver_handle_t hDriver,
|
||||||
|
void *ptr,
|
||||||
|
void **baseAddress) {
|
||||||
|
return L0::DriverHandle::fromHandle(hDriver)->getHostPointerBaseAddress(ptr, baseAddress);
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020-2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ZEX_DRIVER_H
|
||||||
|
#define _ZEX_DRIVER_H
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "zex_api.h"
|
||||||
|
|
||||||
|
ZE_APIEXPORT ze_result_t ZE_APICALL
|
||||||
|
zexDriverImportExternalPointer(
|
||||||
|
ze_driver_handle_t hDriver, ///< [in] handle of the driver
|
||||||
|
void *ptr, ///< [in] pointer to be imported to the driver
|
||||||
|
size_t size ///< [in] size to be imported
|
||||||
|
);
|
||||||
|
|
||||||
|
ZE_APIEXPORT ze_result_t ZE_APICALL
|
||||||
|
zexDriverReleaseImportedPointer(
|
||||||
|
ze_driver_handle_t hDriver, ///< [in] handle of the driver
|
||||||
|
void *ptr ///< [in] pointer to be released from the driver
|
||||||
|
);
|
||||||
|
|
||||||
|
ZE_APIEXPORT ze_result_t ZE_APICALL
|
||||||
|
zexDriverGetHostPointerBaseAddress(
|
||||||
|
ze_driver_handle_t hDriver, ///< [in] handle of the driver
|
||||||
|
void *ptr, ///< [in] pointer to be checked if imported to the driver
|
||||||
|
void **baseAddress ///< [out] if not null, returns address of the base pointer of the imported pointer
|
||||||
|
);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _ZEX_DRIVER_H
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020-2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "level_zero/core/source/kernel/kernel.h"
|
||||||
|
#include "level_zero/core/source/module/module.h"
|
||||||
|
|
||||||
|
#include "zex_api.h"
|
||||||
|
|
||||||
|
ZE_DLLEXPORT ze_result_t ZE_APICALL
|
||||||
|
zexKernelGetBaseAddress(
|
||||||
|
ze_kernel_handle_t hKernel,
|
||||||
|
uint64_t *baseAddress) {
|
||||||
|
return L0::Kernel::fromHandle(hKernel)->getBaseAddress(baseAddress);
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020-2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ZEX_MODULE_H
|
||||||
|
#define _ZEX_MODULE_H
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "zex_api.h"
|
||||||
|
|
||||||
|
ZE_DLLEXPORT ze_result_t ZE_APICALL
|
||||||
|
zexKernelGetBaseAddress(
|
||||||
|
ze_kernel_handle_t hKernel,
|
||||||
|
uint64_t *baseAddress);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _ZEX_MODULE_H
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2021 Intel Corporation
|
* Copyright (C) 2020-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -7,9 +7,21 @@
|
||||||
|
|
||||||
#include "level_zero/core/source/get_extension_function_lookup_map.h"
|
#include "level_zero/core/source/get_extension_function_lookup_map.h"
|
||||||
|
|
||||||
|
#include "level_zero/api/experimental/zex_api.h"
|
||||||
|
|
||||||
namespace L0 {
|
namespace L0 {
|
||||||
std::unordered_map<std::string, void *> getExtensionFunctionsLookupMap() {
|
std::unordered_map<std::string, void *> getExtensionFunctionsLookupMap() {
|
||||||
return std::unordered_map<std::string, void *>();
|
std::unordered_map<std::string, void *> lookupMap;
|
||||||
|
|
||||||
|
#define addToMap(map, x) map[#x] = reinterpret_cast<void *>(&x)
|
||||||
|
addToMap(lookupMap, zexDriverImportExternalPointer);
|
||||||
|
addToMap(lookupMap, zexDriverReleaseImportedPointer);
|
||||||
|
addToMap(lookupMap, zexDriverGetHostPointerBaseAddress);
|
||||||
|
|
||||||
|
addToMap(lookupMap, zexKernelGetBaseAddress);
|
||||||
|
#undef addToMap
|
||||||
|
|
||||||
|
return lookupMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace L0
|
} // namespace L0
|
Loading…
Reference in New Issue