Skip to content

Commit 251bb39

Browse files
committed
[SYCL] Change kernel/program cache data structures and get rid of boost
Signed-off-by: Sarnie, Nick <[email protected]>
1 parent e3f7e33 commit 251bb39

16 files changed

+249
-348
lines changed

sycl/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ if(MSVC)
8282
endif()
8383
endif()
8484

85+
include(FetchEmhash)
8586
include(FetchUnifiedRuntime)
8687

8788
# The change in SYCL_MAJOR_VERSION must be accompanied with the same update in
@@ -213,9 +214,6 @@ install(FILES
213214
DESTINATION "${SYCL_INCLUDE_DIR}/sycl"
214215
COMPONENT sycl-headers)
215216

216-
include(AddBoostMp11Headers)
217-
include(FetchBoostUnorderedHeaders)
218-
219217
# This is workaround to detect changes (add or modify) in subtree which
220218
# are not detected by copy_directory command.
221219
# TODO: detect and process remove header/directory case
@@ -250,7 +248,7 @@ add_custom_target(sycl-headers
250248
${OUT_HEADERS_IN_SYCLCOMPAT_DIR}
251249
${OUT_UR_HEADERS}
252250
sycl-device-aspect-macros-header
253-
boost_mp11-headers)
251+
)
254252

255253
add_custom_command(
256254
OUTPUT ${OUT_HEADERS_IN_SYCL_DIR}
@@ -275,7 +273,6 @@ add_custom_command(
275273
install(DIRECTORY "${sycl_inc_dir}/sycl" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-headers)
276274
install(DIRECTORY "${sycl_inc_dir}/CL" DESTINATION ${SYCL_INCLUDE_DIR}/ COMPONENT sycl-headers)
277275
install(DIRECTORY "${sycl_inc_dir}/std" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-headers)
278-
install(DIRECTORY ${BOOST_MP11_DESTINATION_DIR} DESTINATION ${SYCL_INCLUDE_DIR}/sycl/detail COMPONENT boost_mp11-headers)
279276
install(DIRECTORY "${sycl_inc_dir}/syclcompat" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-headers)
280277
install(FILES "${sycl_inc_dir}/syclcompat.hpp" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-headers)
281278
install(FILES "${UNIFIED_RUNTIME_INCLUDE_DIR}/ur_api.h" DESTINATION ${SYCL_INCLUDE_DIR}
@@ -458,7 +455,6 @@ get_property(SYCL_TOOLCHAIN_DEPS GLOBAL PROPERTY SYCL_TOOLCHAIN_INSTALL_COMPONEN
458455
# Listed here are component names contributing the package
459456
set( SYCL_TOOLCHAIN_DEPLOY_COMPONENTS
460457
append-file
461-
boost_mp11-headers
462458
clang
463459
clang-offload-wrapper
464460
clang-offload-bundler

sycl/cmake/modules/AddBoostMp11Headers.cmake

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

sycl/cmake/modules/FetchBoostUnorderedHeaders.cmake

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

sycl/cmake/modules/FetchEmhash.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Finds or fetches emhash.
2+
find_file(EMHASH_SYS_LOC "hash_table8.hpp" PATH_SUFFIXES "emhash")
3+
if(NOT EMHASH_SYS_LOC)
4+
set(EMHASH_REPO https://github.com/ktprime/emhash)
5+
message(STATUS "Will fetch emhash from ${EMHASH_REPO}")
6+
FetchContent_Declare(emhash
7+
GIT_REPOSITORY ${EMHASH_REPO}
8+
GIT_TAG 3ba9abdfdc2e0430fcc2fd8993cad31945b6a02b
9+
SOURCE_SUBDIR emhash
10+
)
11+
FetchContent_MakeAvailable(emhash)
12+
13+
# FetchContent downloads the files into a directory with
14+
# '-src' as the suffix and emhash has the headers in the
15+
# top level directory in the repo, so copy the headers to a directory
16+
# named `emhash` so source files can include with <emhash/header.hpp>
17+
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include/emhash)
18+
file(GLOB HEADERS "${emhash_SOURCE_DIR}/*.h*")
19+
file(COPY ${HEADERS} DESTINATION ${CMAKE_BINARY_DIR}/include/emhash)
20+
set(SYCL_EMHASH_DIR ${CMAKE_BINARY_DIR}/include/ CACHE INTERNAL "")
21+
endif()

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
358358
-DUMF_BUILD_SHARED_LIBRARY:BOOL=${UMF_BUILD_SHARED_LIBRARY}
359359
-DUMF_LINK_HWLOC_STATICALLY:BOOL=${UMF_LINK_HWLOC_STATICALLY}
360360
-DUMF_DISABLE_HWLOC:BOOL=${UMF_DISABLE_HWLOC}
361+
-DSYCL_EMHASH_DIR:STRING=${SYCL_EMHASH_DIR}
361362
# Enable d suffix in UMF
362363
-DUMF_USE_DEBUG_POSTFIX:BOOL=ON
363364
)

sycl/cmake/modules/PreprocessBoostMp11Headers.cmake

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

sycl/source/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
149149
target_include_directories(${LIB_OBJ_NAME} PRIVATE ${zstd_INCLUDE_DIR})
150150
endif()
151151

152+
if (EMHASH_SYS_LOC)
153+
# If we are using system emhash, include the system directory
154+
# containing the emhash folder and note this location so
155+
# other modules using emhash can find it.
156+
cmake_path(GET EMHASH_SYS_LOC PARENT_PATH EMHASH_SYS_LOC)
157+
set(SYCL_EMHASH_DIR ${EMHASH_SYS_LOC} CACHE INTERNAL "")
158+
target_include_directories(${LIB_OBJ_NAME} PRIVATE ${EMHASH_SYS_LOC})
159+
endif()
160+
152161
# ur_win_proxy_loader
153162
if (WIN32)
154163
include_directories(${LLVM_EXTERNAL_SYCL_SOURCE_DIR}/ur_win_proxy_loader)

sycl/source/detail/context_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ std::optional<ur_program_handle_t> context_impl::getProgramForDevImgs(
530530

531531
auto KeyMappingsIt = KeyMap.find(OuterKey);
532532
assert(KeyMappingsIt != KeyMap.end());
533-
auto CachedProgIt = Cache.find(KeyMappingsIt->second);
533+
auto CachedProgIt = Cache.find((*KeyMappingsIt).second);
534534
assert(CachedProgIt != Cache.end());
535535
BuildRes = CachedProgIt->second;
536536
}

0 commit comments

Comments
 (0)