2022-04-07 17:19:38 +08:00
|
|
|
/*
|
2024-06-19 09:43:25 +08:00
|
|
|
* Copyright (C) 2020-2024 Intel Corporation
|
2022-04-07 17:19:38 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-04-15 04:21:46 +08:00
|
|
|
#include "level_zero/api/driver_experimental/public/zex_api.h"
|
2022-04-07 17:19:38 +08:00
|
|
|
#include "level_zero/core/source/driver/driver.h"
|
|
|
|
#include "level_zero/core/source/driver/driver_handle.h"
|
|
|
|
|
2022-05-30 22:04:15 +08:00
|
|
|
namespace L0 {
|
|
|
|
|
|
|
|
ze_result_t ZE_APICALL
|
2022-04-07 17:19:38 +08:00
|
|
|
zexDriverImportExternalPointer(
|
|
|
|
ze_driver_handle_t hDriver,
|
|
|
|
void *ptr,
|
|
|
|
size_t size) {
|
|
|
|
return L0::DriverHandle::fromHandle(hDriver)->importExternalPointer(ptr, size);
|
|
|
|
}
|
|
|
|
|
2022-05-30 22:04:15 +08:00
|
|
|
ze_result_t ZE_APICALL
|
2022-04-07 17:19:38 +08:00
|
|
|
zexDriverReleaseImportedPointer(
|
|
|
|
ze_driver_handle_t hDriver,
|
|
|
|
void *ptr) {
|
|
|
|
return L0::DriverHandle::fromHandle(hDriver)->releaseImportedPointer(ptr);
|
|
|
|
}
|
|
|
|
|
2022-05-30 22:04:15 +08:00
|
|
|
ze_result_t ZE_APICALL
|
2022-04-07 17:19:38 +08:00
|
|
|
zexDriverGetHostPointerBaseAddress(
|
|
|
|
ze_driver_handle_t hDriver,
|
|
|
|
void *ptr,
|
|
|
|
void **baseAddress) {
|
|
|
|
return L0::DriverHandle::fromHandle(hDriver)->getHostPointerBaseAddress(ptr, baseAddress);
|
|
|
|
}
|
2022-05-30 22:04:15 +08:00
|
|
|
|
|
|
|
} // namespace L0
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
ZE_APIEXPORT ze_result_t ZE_APICALL
|
|
|
|
zexDriverImportExternalPointer(
|
|
|
|
ze_driver_handle_t hDriver,
|
|
|
|
void *ptr,
|
|
|
|
size_t size) {
|
|
|
|
return L0::zexDriverImportExternalPointer(hDriver, ptr, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
ZE_APIEXPORT ze_result_t ZE_APICALL
|
|
|
|
zexDriverReleaseImportedPointer(
|
|
|
|
ze_driver_handle_t hDriver,
|
|
|
|
void *ptr) {
|
|
|
|
return L0::zexDriverReleaseImportedPointer(hDriver, ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
ZE_APIEXPORT ze_result_t ZE_APICALL
|
|
|
|
zexDriverGetHostPointerBaseAddress(
|
|
|
|
ze_driver_handle_t hDriver,
|
|
|
|
void *ptr,
|
|
|
|
void **baseAddress) {
|
|
|
|
return L0::zexDriverGetHostPointerBaseAddress(hDriver, ptr, baseAddress);
|
|
|
|
}
|
|
|
|
}
|