Skip to content

Commit c9cb58e

Browse files
Wrap L0 exported functions to prevent symbol collision
Signed-off-by: Kacper Nowak <[email protected]>
1 parent ce7de9d commit c9cb58e

File tree

61 files changed

+5082
-2546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+5082
-2546
lines changed

level_zero/api/core/CMakeLists.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
#
2-
# Copyright (C) 2020 Intel Corporation
2+
# Copyright (C) 2020-2022 Intel Corporation
33
#
44
# SPDX-License-Identifier: MIT
55
#
66

77
set(L0_SRCS_API
88
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
9-
${CMAKE_CURRENT_SOURCE_DIR}/ze_barrier.cpp
10-
${CMAKE_CURRENT_SOURCE_DIR}/ze_cmdlist.cpp
11-
${CMAKE_CURRENT_SOURCE_DIR}/ze_cmdqueue.cpp
12-
${CMAKE_CURRENT_SOURCE_DIR}/ze_context.cpp
13-
${CMAKE_CURRENT_SOURCE_DIR}/ze_copy.cpp
9+
${CMAKE_CURRENT_SOURCE_DIR}/ze_barrier_api_entrypoints.h
10+
${CMAKE_CURRENT_SOURCE_DIR}/ze_cmdlist_api_entrypoints.h
11+
${CMAKE_CURRENT_SOURCE_DIR}/ze_cmdqueue_api_entrypoints.h
12+
${CMAKE_CURRENT_SOURCE_DIR}/ze_context_api_entrypoints.h
13+
${CMAKE_CURRENT_SOURCE_DIR}/ze_copy_api_entrypoints.h
14+
${CMAKE_CURRENT_SOURCE_DIR}/ze_core_all_api_entrypoints.h
1415
${CMAKE_CURRENT_SOURCE_DIR}/ze_core_loader.cpp
15-
${CMAKE_CURRENT_SOURCE_DIR}/ze_device.cpp
16-
${CMAKE_CURRENT_SOURCE_DIR}/ze_driver.cpp
17-
${CMAKE_CURRENT_SOURCE_DIR}/ze_event.cpp
18-
${CMAKE_CURRENT_SOURCE_DIR}/ze_fence.cpp
19-
${CMAKE_CURRENT_SOURCE_DIR}/ze_image.cpp
20-
${CMAKE_CURRENT_SOURCE_DIR}/ze_memory.cpp
21-
${CMAKE_CURRENT_SOURCE_DIR}/ze_module.cpp
22-
${CMAKE_CURRENT_SOURCE_DIR}/ze_sampler.cpp
16+
${CMAKE_CURRENT_SOURCE_DIR}/ze_device_api_entrypoints.h
17+
${CMAKE_CURRENT_SOURCE_DIR}/ze_driver_api_entrypoints.h
18+
${CMAKE_CURRENT_SOURCE_DIR}/ze_event_api_entrypoints.h
19+
${CMAKE_CURRENT_SOURCE_DIR}/ze_fence_api_entrypoints.h
20+
${CMAKE_CURRENT_SOURCE_DIR}/ze_image_api_entrypoints.h
21+
${CMAKE_CURRENT_SOURCE_DIR}/ze_memory_api_entrypoints.h
22+
${CMAKE_CURRENT_SOURCE_DIR}/ze_module_api_entrypoints.h
23+
${CMAKE_CURRENT_SOURCE_DIR}/ze_sampler_api_entrypoints.h
2324
)
2425
set_property(GLOBAL PROPERTY L0_SRCS_API ${L0_SRCS_API})

level_zero/api/core/ze_barrier.cpp

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* Copyright (C) 2020-2022 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include "level_zero/core/source/cmdlist/cmdlist.h"
11+
#include <level_zero/ze_api.h>
12+
13+
namespace L0 {
14+
ze_result_t zeCommandListAppendBarrier(
15+
ze_command_list_handle_t hCommandList,
16+
ze_event_handle_t hSignalEvent,
17+
uint32_t numWaitEvents,
18+
ze_event_handle_t *phWaitEvents) {
19+
return L0::CommandList::fromHandle(hCommandList)->appendBarrier(hSignalEvent, numWaitEvents, phWaitEvents);
20+
}
21+
22+
ze_result_t zeCommandListAppendMemoryRangesBarrier(
23+
ze_command_list_handle_t hCommandList,
24+
uint32_t numRanges,
25+
const size_t *pRangeSizes,
26+
const void **pRanges,
27+
ze_event_handle_t hSignalEvent,
28+
uint32_t numWaitEvents,
29+
ze_event_handle_t *phWaitEvents) {
30+
return L0::CommandList::fromHandle(hCommandList)->appendMemoryRangesBarrier(numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents);
31+
}
32+
33+
ze_result_t zeDeviceSystemBarrier(
34+
ze_device_handle_t hDevice) {
35+
return L0::Device::fromHandle(hDevice)->systemBarrier();
36+
}
37+
38+
} // namespace L0
39+
40+
extern "C" {
41+
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendBarrier(
42+
ze_command_list_handle_t hCommandList,
43+
ze_event_handle_t hSignalEvent,
44+
uint32_t numWaitEvents,
45+
ze_event_handle_t *phWaitEvents) {
46+
return L0::zeCommandListAppendBarrier(
47+
hCommandList,
48+
hSignalEvent,
49+
numWaitEvents,
50+
phWaitEvents);
51+
}
52+
53+
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier(
54+
ze_command_list_handle_t hCommandList,
55+
uint32_t numRanges,
56+
const size_t *pRangeSizes,
57+
const void **pRanges,
58+
ze_event_handle_t hSignalEvent,
59+
uint32_t numWaitEvents,
60+
ze_event_handle_t *phWaitEvents) {
61+
return L0::zeCommandListAppendMemoryRangesBarrier(
62+
hCommandList,
63+
numRanges,
64+
pRangeSizes,
65+
pRanges,
66+
hSignalEvent,
67+
numWaitEvents,
68+
phWaitEvents);
69+
}
70+
71+
ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceSystemBarrier(
72+
ze_device_handle_t hDevice) {
73+
return L0::zeDeviceSystemBarrier(
74+
hDevice);
75+
}
76+
}

level_zero/api/core/ze_cmdlist.cpp

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/*
2+
* Copyright (C) 2020-2022 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include "level_zero/core/source/cmdlist/cmdlist.h"
11+
#include "level_zero/core/source/context/context.h"
12+
#include <level_zero/ze_api.h>
13+
14+
namespace L0 {
15+
ze_result_t zeCommandListCreate(
16+
ze_context_handle_t hContext,
17+
ze_device_handle_t hDevice,
18+
const ze_command_list_desc_t *desc,
19+
ze_command_list_handle_t *phCommandList) {
20+
return L0::Context::fromHandle(hContext)->createCommandList(hDevice, desc, phCommandList);
21+
}
22+
23+
ze_result_t zeCommandListCreateImmediate(
24+
ze_context_handle_t hContext,
25+
ze_device_handle_t hDevice,
26+
const ze_command_queue_desc_t *altdesc,
27+
ze_command_list_handle_t *phCommandList) {
28+
return L0::Context::fromHandle(hContext)->createCommandListImmediate(hDevice, altdesc, phCommandList);
29+
}
30+
31+
ze_result_t zeCommandListDestroy(
32+
ze_command_list_handle_t hCommandList) {
33+
return L0::CommandList::fromHandle(hCommandList)->destroy();
34+
}
35+
36+
ze_result_t zeCommandListClose(
37+
ze_command_list_handle_t hCommandList) {
38+
return L0::CommandList::fromHandle(hCommandList)->close();
39+
}
40+
41+
ze_result_t zeCommandListReset(
42+
ze_command_list_handle_t hCommandList) {
43+
return L0::CommandList::fromHandle(hCommandList)->reset();
44+
}
45+
46+
ze_result_t zeCommandListAppendWriteGlobalTimestamp(
47+
ze_command_list_handle_t hCommandList,
48+
uint64_t *dstptr,
49+
ze_event_handle_t hSignalEvent,
50+
uint32_t numWaitEvents,
51+
ze_event_handle_t *phWaitEvents) {
52+
return L0::CommandList::fromHandle(hCommandList)->appendWriteGlobalTimestamp(dstptr, hSignalEvent, numWaitEvents, phWaitEvents);
53+
}
54+
55+
ze_result_t zeCommandListAppendQueryKernelTimestamps(
56+
ze_command_list_handle_t hCommandList,
57+
uint32_t numEvents,
58+
ze_event_handle_t *phEvents,
59+
void *dstptr,
60+
const size_t *pOffsets,
61+
ze_event_handle_t hSignalEvent,
62+
uint32_t numWaitEvents,
63+
ze_event_handle_t *phWaitEvents) {
64+
return L0::CommandList::fromHandle(hCommandList)->appendQueryKernelTimestamps(numEvents, phEvents, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEvents);
65+
}
66+
67+
} // namespace L0
68+
69+
extern "C" {
70+
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListCreate(
71+
ze_context_handle_t hContext,
72+
ze_device_handle_t hDevice,
73+
const ze_command_list_desc_t *desc,
74+
ze_command_list_handle_t *phCommandList) {
75+
return L0::zeCommandListCreate(
76+
hContext,
77+
hDevice,
78+
desc,
79+
phCommandList);
80+
}
81+
82+
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListCreateImmediate(
83+
ze_context_handle_t hContext,
84+
ze_device_handle_t hDevice,
85+
const ze_command_queue_desc_t *altdesc,
86+
ze_command_list_handle_t *phCommandList) {
87+
return L0::zeCommandListCreateImmediate(
88+
hContext,
89+
hDevice,
90+
altdesc,
91+
phCommandList);
92+
}
93+
94+
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListDestroy(
95+
ze_command_list_handle_t hCommandList) {
96+
return L0::zeCommandListDestroy(
97+
hCommandList);
98+
}
99+
100+
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListClose(
101+
ze_command_list_handle_t hCommandList) {
102+
return L0::zeCommandListClose(
103+
hCommandList);
104+
}
105+
106+
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListReset(
107+
ze_command_list_handle_t hCommandList) {
108+
return L0::zeCommandListReset(
109+
hCommandList);
110+
}
111+
112+
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendWriteGlobalTimestamp(
113+
ze_command_list_handle_t hCommandList,
114+
uint64_t *dstptr,
115+
ze_event_handle_t hSignalEvent,
116+
uint32_t numWaitEvents,
117+
ze_event_handle_t *phWaitEvents) {
118+
return L0::zeCommandListAppendWriteGlobalTimestamp(
119+
hCommandList,
120+
dstptr,
121+
hSignalEvent,
122+
numWaitEvents,
123+
phWaitEvents);
124+
}
125+
}

level_zero/api/core/ze_cmdqueue.cpp

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

0 commit comments

Comments
 (0)