Skip to content

Commit a4b5c7c

Browse files
committed
Fix build on Windows and export only pi* symbols in libpi_level0.so
Align with changes made for OpenCL plugin in intel#1638: * Fix build on Windows by defining __SYCL_BUILD_SYCL_DLL in cmake file * Export only pi* symbols in libpi_level0.so * Add test to check exported symbols Signed-off-by: Artur Gainullin <[email protected]>
1 parent e59ed9a commit a4b5c7c

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

sycl/plugins/Intel_level0/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,26 @@ add_library(pi_level0 SHARED
4646
"${CMAKE_CURRENT_SOURCE_DIR}/pi_level0.hpp"
4747
)
4848

49+
if (MSVC)
50+
# by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
51+
# which are individually tagged for all pi* symbols in pi.h
52+
target_compile_definitions(pi_level0 PRIVATE __SYCL_BUILD_SYCL_DLL)
53+
else()
54+
# we set the visibility of all symbols 'hidden' by default.
55+
# In pi.h file, we set exported symbols with visibility==default individually
56+
target_compile_options(pi_level0 PUBLIC -fvisibility=hidden)
57+
58+
# This script file is used to allow exporting pi* symbols only.
59+
# All other symbols are regarded as local (hidden)
60+
set(linker_script "${CMAKE_CURRENT_SOURCE_DIR}/../ld-version-script.txt")
61+
62+
# Filter symbols based on the scope defined in the script file,
63+
# and export pi* function symbols in the library.
64+
target_link_libraries( pi_level0
65+
PRIVATE "-Wl,--version-script=${linker_script}"
66+
)
67+
endif()
68+
4969
add_dependencies(pi_level0 l0-loader)
5070
add_dependencies(sycl-toolchain pi_level0)
5171

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# RUN: env LLVM_BIN_PATH=%llvm_build_bin_dir python %sycl_tools_src_dir/abi_check.py --mode check_symbols --reference %s %sycl_libs_dir/libpi_level0.so
2+
# REQUIRES: linux
3+
4+
piDeviceGetInfo
5+
piextContextGetNativeHandle
6+
piEnqueueMemImageWrite
7+
piEnqueueMemBufferWrite
8+
piextUSMFree
9+
piEnqueueNativeKernel
10+
piProgramRetain
11+
piProgramGetBuildInfo
12+
piextUSMEnqueueMemAdvise
13+
piKernelCreate
14+
piKernelGetSubGroupInfo
15+
piextUSMEnqueueMemset
16+
piSamplerRetain
17+
piEventRelease
18+
piextDeviceCreateWithNativeHandle
19+
piEventSetCallback
20+
piSamplerRelease
21+
piextMemCreateWithNativeHandle
22+
piEventRetain
23+
piProgramLink
24+
piextUSMSharedAlloc
25+
piContextCreate
26+
piSamplerGetInfo
27+
piEnqueueMemImageCopy
28+
piextMemGetNativeHandle
29+
piEnqueueMemBufferMap
30+
piPluginInit
31+
piextQueueCreateWithNativeHandle
32+
piContextRelease
33+
piextProgramCreateWithNativeHandle
34+
piMemBufferCreate
35+
piextUSMGetMemAllocInfo
36+
piDevicesGet
37+
piKernelRetain
38+
piSamplerCreate
39+
piEnqueueMemBufferRead
40+
piPlatformGetInfo
41+
piContextRetain
42+
piextDeviceSelectBinary
43+
piEnqueueMemImageFill
44+
piDeviceRelease
45+
piQueueFinish
46+
piKernelRelease
47+
piMemImageCreate
48+
piProgramCompile
49+
piMemGetInfo
50+
piextProgramSetSpecializationConstant
51+
piextQueueGetNativeHandle
52+
piEnqueueMemImageRead
53+
piextUSMEnqueueMemcpy
54+
piProgramCreate
55+
piextContextSetExtendedDeleter
56+
piProgramBuild
57+
piKernelSetExecInfo
58+
piPlatformsGet
59+
piEnqueueMemBufferFill
60+
piMemRetain
61+
piextUSMEnqueuePrefetch
62+
piextKernelSetArgPointer
63+
piEnqueueEventsWait
64+
piEnqueueMemBufferCopy
65+
piQueueGetInfo
66+
piDevicePartition
67+
piQueueRetain
68+
piextDeviceGetNativeHandle
69+
piEventGetInfo
70+
piMemImageGetInfo
71+
piContextGetInfo
72+
piclProgramCreateWithSource
73+
piextProgramGetNativeHandle
74+
piEventGetProfilingInfo
75+
piProgramGetInfo
76+
piextGetDeviceFunctionPointer
77+
piEnqueueMemUnmap
78+
piextKernelSetArgMemObj
79+
piQueueCreate
80+
piEventCreate
81+
piKernelGetInfo
82+
piQueueRelease
83+
piKernelSetArg
84+
piEnqueueMemBufferCopyRect
85+
piEnqueueKernelLaunch
86+
piextContextCreateWithNativeHandle
87+
piclProgramCreateWithBinary
88+
piKernelGetGroupInfo
89+
piextEventCreateWithNativeHandle
90+
piEventsWait
91+
piMemRelease
92+
piProgramRelease
93+
piDeviceRetain
94+
piextUSMDeviceAlloc
95+
piEventSetStatus
96+
piextEventGetNativeHandle
97+
piEnqueueMemBufferReadRect
98+
piMemBufferPartition
99+
piEnqueueMemBufferWriteRect
100+
piextUSMHostAlloc
101+

0 commit comments

Comments
 (0)