Skip to content

Commit 6509eb1

Browse files
committed
[SYCL] Add initial drop for SYCL runtime.
Signed-off-by: Vladimir Lazarev <[email protected]>
1 parent 8963347 commit 6509eb1

File tree

154 files changed

+23924
-0
lines changed

Some content is hidden

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

154 files changed

+23924
-0
lines changed

llvm/projects/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ foreach(entry ${entries})
1111
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libunwind) AND
1212
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/test-suite) AND
1313
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/parallel-libs) AND
14+
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/sycl) AND
1415
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/llvm-spirv) AND
1516
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/openmp) AND
1617
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests))
@@ -43,6 +44,7 @@ endif()
4344
add_llvm_external_project(dragonegg)
4445
add_llvm_external_project(parallel-libs)
4546
add_llvm_external_project(openmp)
47+
add_llvm_external_project(sycl)
4648
add_llvm_external_project(llvm-spirv)
4749

4850
if(LLVM_INCLUDE_TESTS)

sycl/.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Checks: '-*,clang-analyzer-*,clang-diagnostic-*,cppcoreguidelines-*,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-member-init,google-*,-cppcoreguidelines-pro-type-union-access,-google-build-using-namespace,-google-explicit-constructor,-google-runtime-references,misc-*,-misc-macro-parentheses,-misc-unused-parameters'

sycl/CMakeLists.txt

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
cmake_minimum_required(VERSION 3.2)
2+
3+
project(sycl-solution)
4+
# Requirements
5+
set(CMAKE_CXX_STANDARD 11)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
set(CMAKE_CXX_EXTENSIONS OFF)
8+
9+
if(MSVC)
10+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
11+
endif()
12+
13+
# Get clang's version
14+
include(VersionFromVCS)
15+
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
16+
17+
# If CLANG_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
18+
if(NOT DEFINED CLANG_VERSION_MAJOR)
19+
set(CLANG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
20+
endif()
21+
if(NOT DEFINED CLANG_VERSION_MINOR)
22+
set(CLANG_VERSION_MINOR ${LLVM_VERSION_MINOR})
23+
endif()
24+
if(NOT DEFINED CLANG_VERSION_PATCHLEVEL)
25+
set(CLANG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
26+
endif()
27+
# Unlike PACKAGE_VERSION, CLANG_VERSION does not include LLVM_VERSION_SUFFIX.
28+
set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION_PATCHLEVEL}")
29+
30+
set ( LLVM_INST_INC_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include" )
31+
32+
find_package(OpenCL REQUIRED)
33+
34+
include_directories(${OpenCL_INCLUDE_DIRS})
35+
link_libraries(OpenCL)
36+
37+
# Copy SYCL headers
38+
set(sycl_inc_dir ${CMAKE_CURRENT_SOURCE_DIR}/include/CL)
39+
set(dst_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include/CL)
40+
add_custom_target(sycl-headers ALL
41+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir} ${dst_dir}
42+
COMMENT "Copying SYCL headers ...")
43+
44+
# Main library
45+
46+
set(sourceRootPath "${CMAKE_CURRENT_SOURCE_DIR}/source")
47+
set(includeRootPath "${CMAKE_CURRENT_SOURCE_DIR}/include")
48+
49+
set(SYCLLibrary sycl)
50+
51+
#To-Do:
52+
#1. Figure out why CMP0057 has to be set. Should have been taken care of earlier in the build
53+
#2. Use AddLLVM to modify the build and access config options
54+
#cmake_policy(SET CMP0057 NEW)
55+
#include(AddLLVM)
56+
set(LLVM_BUILD_LIBRARY_DIRS "${LLVM_BINARY_DIR}/lib/")
57+
58+
set(SYCL_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
59+
set(SYCL_TESTS_BINARY_DIR ${SYCL_BINARY_DIR}/test)
60+
61+
set(CLANG_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang")
62+
63+
set(LLVM_TOOLS_DIR "${LLVM_BINARY_DIR}/bin/")
64+
65+
set(SYCL_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/include/")
66+
set(OPENCL_INCLUDE "${OpenCL_INCLUDE_DIRS}")
67+
68+
add_library("${SYCLLibrary}" SHARED
69+
"${includeRootPath}/CL/sycl.hpp"
70+
"${sourceRootPath}/detail/common.cpp"
71+
"${sourceRootPath}/detail/device_info.cpp"
72+
"${sourceRootPath}/detail/event_impl.cpp"
73+
"${sourceRootPath}/detail/force_device.cpp"
74+
"${sourceRootPath}/detail/helpers.cpp"
75+
"${sourceRootPath}/detail/kernel_impl.cpp"
76+
"${sourceRootPath}/detail/kernel_info.cpp"
77+
"${sourceRootPath}/detail/platform_host.cpp"
78+
"${sourceRootPath}/detail/platform_opencl.cpp"
79+
"${sourceRootPath}/detail/platform_info.cpp"
80+
"${sourceRootPath}/detail/program_impl.cpp"
81+
"${sourceRootPath}/detail/program_manager/program_manager.cpp"
82+
"${sourceRootPath}/detail/queue_impl.cpp"
83+
"${sourceRootPath}/detail/scheduler/commands.cpp"
84+
"${sourceRootPath}/detail/scheduler/printers.cpp"
85+
"${sourceRootPath}/detail/scheduler/scheduler.cpp"
86+
"${sourceRootPath}/context.cpp"
87+
"${sourceRootPath}/device.cpp"
88+
"${sourceRootPath}/device_selector.cpp"
89+
"${sourceRootPath}/event.cpp"
90+
"${sourceRootPath}/exception.cpp"
91+
"${sourceRootPath}/kernel.cpp"
92+
"${sourceRootPath}/platform.cpp"
93+
"${sourceRootPath}/queue.cpp"
94+
"${sourceRootPath}/spirv_ops.cpp"
95+
)
96+
97+
include_directories("${SYCLLibrary}" "${includeRootPath}")
98+
99+
target_link_libraries("${SYCLLibrary}" "${OpenCL_LIBRARIES}")
100+
set_target_properties("${SYCLLibrary}" PROPERTIES LINKER_LANGUAGE CXX)
101+
102+
# Workaround for bug in GCC version 5.
103+
# More information https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899
104+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
105+
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0 AND
106+
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
107+
target_link_libraries("${SYCLLibrary}" gcc_s gcc)
108+
endif()
109+
110+
install(TARGETS "${SYCLLibrary}" DESTINATION "lib" COMPONENT ${SYCLLibrary})
111+
install(DIRECTORY "${includeRootPath}/." DESTINATION "${LLVM_INST_INC_DIRECTORY}" COMPONENT sycl_headers)
112+
113+
add_subdirectory( test )
114+
add_subdirectory( tools )
115+
116+
set(manifest_list)
117+
set( DEPLOY_LIST
118+
sycl
119+
ocl_lib
120+
ocl_headers
121+
sycl_headers
122+
clang
123+
clang-offload-wrapper
124+
clang-offload-bundler
125+
llc
126+
llvm-as
127+
llvm-dis
128+
llvm-spirv
129+
llvm-link
130+
opt
131+
)
132+
133+
foreach( comp ${DEPLOY_LIST} )
134+
135+
message( STATUS "Adding component ${comp} to deploy")
136+
137+
set (manifest ${CMAKE_CURRENT_BINARY_DIR}/install_manifest_${comp}.txt)
138+
add_custom_command(OUTPUT ${manifest}
139+
COMMAND "${CMAKE_COMMAND}"
140+
"-DCMAKE_INSTALL_COMPONENT=${comp}"
141+
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
142+
COMMENT "Deploying component ${comp}"
143+
USES_TERMINAL)
144+
list(APPEND manifest_list ${manifest})
145+
endforeach( comp )
146+
147+
add_custom_target(deploy DEPENDS ${manifest_list})

sycl/LICENSE.TXT

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
==============================================================================
2+
LLVM Release License
3+
==============================================================================
4+
University of Illinois/NCSA
5+
Open Source License
6+
7+
Copyright (c) 2003-2018 University of Illinois at Urbana-Champaign.
8+
All rights reserved.
9+
10+
Developed by:
11+
12+
LLVM Team
13+
14+
University of Illinois at Urbana-Champaign
15+
16+
http://llvm.org
17+
18+
Permission is hereby granted, free of charge, to any person obtaining a copy of
19+
this software and associated documentation files (the "Software"), to deal with
20+
the Software without restriction, including without limitation the rights to
21+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
22+
of the Software, and to permit persons to whom the Software is furnished to do
23+
so, subject to the following conditions:
24+
25+
* Redistributions of source code must retain the above copyright notice,
26+
this list of conditions and the following disclaimers.
27+
28+
* Redistributions in binary form must reproduce the above copyright notice,
29+
this list of conditions and the following disclaimers in the
30+
documentation and/or other materials provided with the distribution.
31+
32+
* Neither the names of the LLVM Team, University of Illinois at
33+
Urbana-Champaign, nor the names of its contributors may be used to
34+
endorse or promote products derived from this Software without specific
35+
prior written permission.
36+
37+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
39+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40+
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
43+
SOFTWARE.
44+
45+
==============================================================================
46+
Copyrights and Licenses for Third Party Software Distributed with LLVM:
47+
==============================================================================
48+
The LLVM software contains code written by third parties. Such software will
49+
have its own individual LICENSE.TXT file in the directory in which it appears.
50+
This file will describe the copyrights, license, and restrictions which apply
51+
to that code.
52+
53+
The disclaimer of warranty in the University of Illinois Open Source License
54+
applies to all code in the LLVM Distribution, and nothing in any of the
55+
other licenses gives permission to use the names of the LLVM Team or the
56+
University of Illinois to endorse or promote products derived from this
57+
Software.
58+
59+
The following pieces of software have additional or alternate copyrights,
60+
licenses, and/or restrictions:
61+
62+
Program Directory
63+
------- ---------
64+
Google Test llvm/utils/unittest/googletest
65+
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
66+
pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
67+
ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
68+
md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h

0 commit comments

Comments
 (0)