Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions clang/lib/Headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,30 @@ install(
DESTINATION ${header_install_dir}/zos_wrappers
COMPONENT clang-resource-headers)


# Install clang resource headers for the sycl-jit component
install(
FILES ${files} ${generated_files}
DESTINATION ${header_install_dir}
COMPONENT sycl-jit-resources)

# CP - TODO - remove these next two
install(
FILES ${cuda_wrapper_files}
DESTINATION ${header_install_dir}/cuda_wrappers
COMPONENT sycl-jit-resources)

install(
FILES ${openmp_wrapper_files}
DESTINATION ${header_install_dir}/openmp_wrappers
COMPONENT sycl-jit-resources)

install(
FILES ${llvm_offload_wrapper_files}
DESTINATION ${header_install_dir}/llvm_offload_wrappers
COMPONENT sycl-jit-resources)


#############################################################
# Install rules for separate header lists
install(
Expand Down
5 changes: 5 additions & 0 deletions libclc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,11 @@ install(DIRECTORY ${LIBCLC_LIBRARY_OUTPUT_INTDIR}
COMPONENT libspirv-builtins
FILES_MATCHING PATTERN "libspirv-*")

install(DIRECTORY ${LIBCLC_LIBRARY_OUTPUT_INTDIR}
DESTINATION lib${LLVM_LIBDIR_SUFFIX}
COMPONENT sycl-jit-resources
FILES_MATCHING PATTERN "*.bc")

if( LIBCLC_GENERATE_REMANGLED_VARIANTS )
install(DIRECTORY ${LIBCLC_LIBRARY_OUTPUT_INTDIR}
DESTINATION lib${LLVM_LIBDIR_SUFFIX}
Expand Down
4 changes: 4 additions & 0 deletions libdevice/cmake/modules/SYCLLibdevice.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ function(compile_lib_ext filename)
install( FILES ${devicelib-file}
DESTINATION ${install_dest_${ARG_FILETYPE}}
COMPONENT libsycldevice)

install( FILES ${devicelib-file}
DESTINATION ${install_dest_${ARG_FILETYPE}}
COMPONENT sycl-jit-resources)
endfunction()

# Links together one or more bytecode files
Expand Down
123 changes: 104 additions & 19 deletions sycl-jit/jit-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set(SYCL_JIT_RESOURCE_CPP "${CMAKE_CURRENT_BINARY_DIR}/resource.cpp")
set(SYCL_JIT_RESOURCE_OBJ "${CMAKE_CURRENT_BINARY_DIR}/resource.cpp.o")
set(SYCL_JIT_RESOURCE_INSTALL_CPP "${CMAKE_CURRENT_BINARY_DIR}/resource_install.cpp")

if (WIN32)
set(SYCL_JIT_VIRTUAL_TOOLCHAIN_ROOT "c:/sycl-jit-toolchain/")
Expand All @@ -10,8 +11,8 @@ set(SYCL_JIT_VIRTUAL_TOOLCHAIN_ROOT "/sycl-jit-toolchain/")
endif()

set(SYCL_JIT_RESOURCE_DEPS
sycl-headers # include/sycl
clang # lib/clang/N/include
sycl-headers # include/sycl
opencl-resource-headers # lib/clang/N/include
${CMAKE_CURRENT_SOURCE_DIR}/utils/generate.py)

if ("libclc" IN_LIST LLVM_ENABLE_PROJECTS)
Expand All @@ -23,11 +24,36 @@ if ("libdevice" IN_LIST LLVM_ENABLE_PROJECTS)
list(APPEND SYCL_JIT_RESOURCE_DEPS libsycldevice) # lib/*.bc
endif()

# DEV BUILD PATH ---
# This command generates resource.cpp for the normal 'ninja build' by globbing the build directory.
add_custom_command(
OUTPUT ${SYCL_JIT_RESOURCE_CPP}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/generate.py --toolchain-dir ${CMAKE_BINARY_DIR} --output ${SYCL_JIT_RESOURCE_CPP} --prefix ${SYCL_JIT_VIRTUAL_TOOLCHAIN_ROOT}
DEPENDS
${SYCL_JIT_RESOURCE_DEPS}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/generate.py --toolchain-dir ${CMAKE_BINARY_DIR} --output ${SYCL_JIT_RESOURCE_CPP} --prefix ${SYCL_JIT_VIRTUAL_TOOLCHAIN_ROOT}
DEPENDS ${SYCL_JIT_RESOURCE_DEPS}
COMMENT "Generating DEV sycl-jit resources from build directory..."
VERBATIM
)

add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resource_install.cpp
COMMAND ${Python3_EXECUTABLE} ${GENERATE_PY} --toolchain-dir ${CMAKE_INSTALL_PREFIX} ...
DEPENDS install-sycl-jit-resources
COMMENT "Generating INSTALL resource.cpp from install directory..."
)

# --- INSTALL BUILD PATH ---
# first define a target to run the partial install of resources.
add_custom_target(install-sycl-jit-resources
COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --component sycl-jit-resources
COMMENT "Installing intermediate sycl-jit toolchain resources..."
VERBATIM
)

# second generate a separate resource_install.cpp by globbing the clean install directory.
add_custom_command(
OUTPUT ${SYCL_JIT_RESOURCE_INSTALL_CPP}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/generate.py --toolchain-dir ${CMAKE_INSTALL_PREFIX} --output ${SYCL_JIT_RESOURCE_INSTALL_CPP} --prefix ${SYCL_JIT_VIRTUAL_TOOLCHAIN_ROOT}
DEPENDS install-sycl-jit-resources
)

# We use C23/C++26's `#embed` to implement this resource creation, and "current"
Expand Down Expand Up @@ -56,20 +82,21 @@ else()
endif()
endif()

add_custom_command(
OUTPUT ${SYCL_JIT_RESOURCE_OBJ}
COMMAND
# ${clang_exe}'s default target is not necessarily ${LLVM_HOST_TRIPLE}: when
# cross compiling, it will be whatever the host tools were configured with,
# and when building a cross compiler, it will be
# ${LLVM_DEFAULT_TARGET_TRIPLE}. Rather than special casing these, just always
# specify --target=${LLVM_HOST_TRIPLE}.
${clang_exe} --target=${LLVM_HOST_TRIPLE} ${SYCL_JIT_RESOURCE_CPP} -I ${CMAKE_CURRENT_SOURCE_DIR}/include -c -o ${SYCL_JIT_RESOURCE_OBJ} ${SYCL_JIT_RESOURCE_CXX_FLAGS}
DEPENDS
${SYCL_JIT_RESOURCE_CPP}
${CMAKE_CURRENT_SOURCE_DIR}/include/Resource.h
)
# add_custom_command(
# OUTPUT ${SYCL_JIT_RESOURCE_OBJ}
# COMMAND
# # ${clang_exe}'s default target is not necessarily ${LLVM_HOST_TRIPLE}: when
# # cross compiling, it will be whatever the host tools were configured with,
# # and when building a cross compiler, it will be
# # ${LLVM_DEFAULT_TARGET_TRIPLE}. Rather than special casing these, just always
# # specify --target=${LLVM_HOST_TRIPLE}.
# ${clang_exe} --target=${LLVM_HOST_TRIPLE} ${SYCL_JIT_RESOURCE_CPP} -I ${CMAKE_CURRENT_SOURCE_DIR}/include -c -o ${SYCL_JIT_RESOURCE_OBJ} ${SYCL_JIT_RESOURCE_CXX_FLAGS}
# DEPENDS
# ${SYCL_JIT_RESOURCE_CPP}
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Resource.h
# )

# Define the DEV library target
add_llvm_library(sycl-jit
lib/translation/JITContext.cpp
lib/translation/SPIRVLLVMTranslation.cpp
Expand All @@ -82,7 +109,7 @@ add_llvm_library(sycl-jit
lib/helper/ConfigHelper.cpp
lib/helper/ErrorHelper.cpp

${SYCL_JIT_RESOURCE_OBJ}
${SYCL_JIT_RESOURCE_CPP}

SHARED

Expand Down Expand Up @@ -120,6 +147,58 @@ add_llvm_library(sycl-jit
clangSerialization
)

# Define teh install library target
add_llvm_library(sycl-jit-installable
lib/translation/JITContext.cpp
lib/translation/SPIRVLLVMTranslation.cpp
lib/translation/Translation.cpp
lib/materializer/MaterializerPipeline.cpp
lib/materializer/Materializer.cpp
lib/rtc/DeviceCompilation.cpp
lib/rtc/ESIMD.cpp
lib/rtc/RTC.cpp
lib/helper/ConfigHelper.cpp
lib/helper/ErrorHelper.cpp

${SYCL_JIT_RESOURCE_INSTALL_CPP}

SHARED

EXCLUDE_FROM_ALL # Don't build this target during a normal 'ninja build'

LINK_COMPONENTS
BitReader
BitWriter
Core
Support
Option
Analysis
IPO
TransformUtils
Passes
IRReader
Linker
ScalarOpts
InstCombine
Target
TargetParser
MC
SYCLLowerIR
SYCLPostLink
SPIRVLib
${LLVM_TARGETS_TO_BUILD}

LINK_LIBS
clangBasic
clangDriver
clangFrontend
clangCodeGen
clangTooling
clangSerialization
)
set_target_properties(sycl-jit-installable PROPERTIES OUTPUT_NAME "sycl-jit")


if(WIN32)
target_link_libraries(sycl-jit PRIVATE Shlwapi)
endif()
Expand Down Expand Up @@ -170,3 +249,9 @@ if(NOT MSVC AND NOT APPLE)
sycl-jit PRIVATE "-Wl,--version-script=${linker_script}")
set_target_properties(sycl-jit PROPERTIES LINK_DEPENDS ${linker_script})
endif()


install(TARGETS sycl-jit-installable
LIBRARY DESTINATION lib
COMPONENT sycl-jit
)
11 changes: 11 additions & 0 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E copy ${UR_HEADERS_TO_COPY} ${SYCL_INCLUDE_BUILD_DIR}
COMMENT "Copying SYCL headers ...")


# Copy SYCL headers from source to install directory
install(DIRECTORY "${sycl_inc_dir}/sycl" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-headers)
install(DIRECTORY "${sycl_inc_dir}/CL" DESTINATION ${SYCL_INCLUDE_DIR}/ COMPONENT sycl-headers)
Expand All @@ -310,6 +311,16 @@ install(FILES "${UNIFIED_RUNTIME_INCLUDE_DIR}/ur_api_funcs.def" DESTINATION ${SY
install(FILES "${UNIFIED_RUNTIME_INCLUDE_DIR}/ur_print.hpp" DESTINATION ${SYCL_INCLUDE_DIR}
COMPONENT sycl-headers)

# Also install SYCL headers for the sycl-jit component
install(DIRECTORY "${sycl_inc_dir}/sycl" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-jit-resources)
install(DIRECTORY "${sycl_inc_dir}/CL" DESTINATION ${SYCL_INCLUDE_DIR}/ COMPONENT sycl-jit-resources)
install(DIRECTORY "${sycl_inc_dir}/std" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-jit-resources)
install(DIRECTORY "${sycl_inc_dir}/syclcompat" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-jit-resources)
install(FILES "${sycl_inc_dir}/syclcompat.hpp" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-jit-resources)
install(FILES "${UNIFIED_RUNTIME_INCLUDE_DIR}/ur_api.h" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-jit-resources)
install(FILES "${UNIFIED_RUNTIME_INCLUDE_DIR}/ur_api_funcs.def" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-jit-resources)
install(FILES "${UNIFIED_RUNTIME_INCLUDE_DIR}/ur_print.hpp" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-jit-resources)

if (WIN32)
set(SYCL_RT_LIBS sycl${SYCL_MAJOR_VERSION})
if(SYCL_ENABLE_MAJOR_RELEASE_PREVIEW_LIB)
Expand Down
Loading