Skip to content

Commit

Permalink
[SYCL] Add initial drop for SYCL runtime.
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Lazarev <vladimir.lazarev@intel.com>
  • Loading branch information
vladimirlaz committed Jan 22, 2019
1 parent 8963347 commit 6509eb1
Show file tree
Hide file tree
Showing 154 changed files with 23,924 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/projects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ foreach(entry ${entries})
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libunwind) AND
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/test-suite) AND
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/parallel-libs) AND
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/sycl) AND
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/llvm-spirv) AND
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/openmp) AND
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests))
Expand Down Expand Up @@ -43,6 +44,7 @@ endif()
add_llvm_external_project(dragonegg)
add_llvm_external_project(parallel-libs)
add_llvm_external_project(openmp)
add_llvm_external_project(sycl)
add_llvm_external_project(llvm-spirv)

if(LLVM_INCLUDE_TESTS)
Expand Down
1 change: 1 addition & 0 deletions sycl/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +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'
147 changes: 147 additions & 0 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
cmake_minimum_required(VERSION 3.2)

project(sycl-solution)
# Requirements
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(MSVC)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()

# Get clang's version
include(VersionFromVCS)
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")

# If CLANG_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
if(NOT DEFINED CLANG_VERSION_MAJOR)
set(CLANG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
endif()
if(NOT DEFINED CLANG_VERSION_MINOR)
set(CLANG_VERSION_MINOR ${LLVM_VERSION_MINOR})
endif()
if(NOT DEFINED CLANG_VERSION_PATCHLEVEL)
set(CLANG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
endif()
# Unlike PACKAGE_VERSION, CLANG_VERSION does not include LLVM_VERSION_SUFFIX.
set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION_PATCHLEVEL}")

set ( LLVM_INST_INC_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include" )

find_package(OpenCL REQUIRED)

include_directories(${OpenCL_INCLUDE_DIRS})
link_libraries(OpenCL)

# Copy SYCL headers
set(sycl_inc_dir ${CMAKE_CURRENT_SOURCE_DIR}/include/CL)
set(dst_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include/CL)
add_custom_target(sycl-headers ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir} ${dst_dir}
COMMENT "Copying SYCL headers ...")

# Main library

set(sourceRootPath "${CMAKE_CURRENT_SOURCE_DIR}/source")
set(includeRootPath "${CMAKE_CURRENT_SOURCE_DIR}/include")

set(SYCLLibrary sycl)

#To-Do:
#1. Figure out why CMP0057 has to be set. Should have been taken care of earlier in the build
#2. Use AddLLVM to modify the build and access config options
#cmake_policy(SET CMP0057 NEW)
#include(AddLLVM)
set(LLVM_BUILD_LIBRARY_DIRS "${LLVM_BINARY_DIR}/lib/")

set(SYCL_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(SYCL_TESTS_BINARY_DIR ${SYCL_BINARY_DIR}/test)

set(CLANG_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang")

set(LLVM_TOOLS_DIR "${LLVM_BINARY_DIR}/bin/")

set(SYCL_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/include/")
set(OPENCL_INCLUDE "${OpenCL_INCLUDE_DIRS}")

add_library("${SYCLLibrary}" SHARED
"${includeRootPath}/CL/sycl.hpp"
"${sourceRootPath}/detail/common.cpp"
"${sourceRootPath}/detail/device_info.cpp"
"${sourceRootPath}/detail/event_impl.cpp"
"${sourceRootPath}/detail/force_device.cpp"
"${sourceRootPath}/detail/helpers.cpp"
"${sourceRootPath}/detail/kernel_impl.cpp"
"${sourceRootPath}/detail/kernel_info.cpp"
"${sourceRootPath}/detail/platform_host.cpp"
"${sourceRootPath}/detail/platform_opencl.cpp"
"${sourceRootPath}/detail/platform_info.cpp"
"${sourceRootPath}/detail/program_impl.cpp"
"${sourceRootPath}/detail/program_manager/program_manager.cpp"
"${sourceRootPath}/detail/queue_impl.cpp"
"${sourceRootPath}/detail/scheduler/commands.cpp"
"${sourceRootPath}/detail/scheduler/printers.cpp"
"${sourceRootPath}/detail/scheduler/scheduler.cpp"
"${sourceRootPath}/context.cpp"
"${sourceRootPath}/device.cpp"
"${sourceRootPath}/device_selector.cpp"
"${sourceRootPath}/event.cpp"
"${sourceRootPath}/exception.cpp"
"${sourceRootPath}/kernel.cpp"
"${sourceRootPath}/platform.cpp"
"${sourceRootPath}/queue.cpp"
"${sourceRootPath}/spirv_ops.cpp"
)

include_directories("${SYCLLibrary}" "${includeRootPath}")

target_link_libraries("${SYCLLibrary}" "${OpenCL_LIBRARIES}")
set_target_properties("${SYCLLibrary}" PROPERTIES LINKER_LANGUAGE CXX)

# Workaround for bug in GCC version 5.
# More information https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0 AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
target_link_libraries("${SYCLLibrary}" gcc_s gcc)
endif()

install(TARGETS "${SYCLLibrary}" DESTINATION "lib" COMPONENT ${SYCLLibrary})
install(DIRECTORY "${includeRootPath}/." DESTINATION "${LLVM_INST_INC_DIRECTORY}" COMPONENT sycl_headers)

add_subdirectory( test )
add_subdirectory( tools )

set(manifest_list)
set( DEPLOY_LIST
sycl
ocl_lib
ocl_headers
sycl_headers
clang
clang-offload-wrapper
clang-offload-bundler
llc
llvm-as
llvm-dis
llvm-spirv
llvm-link
opt
)

foreach( comp ${DEPLOY_LIST} )

message( STATUS "Adding component ${comp} to deploy")

set (manifest ${CMAKE_CURRENT_BINARY_DIR}/install_manifest_${comp}.txt)
add_custom_command(OUTPUT ${manifest}
COMMAND "${CMAKE_COMMAND}"
"-DCMAKE_INSTALL_COMPONENT=${comp}"
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
COMMENT "Deploying component ${comp}"
USES_TERMINAL)
list(APPEND manifest_list ${manifest})
endforeach( comp )

add_custom_target(deploy DEPENDS ${manifest_list})
68 changes: 68 additions & 0 deletions sycl/LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
==============================================================================
LLVM Release License
==============================================================================
University of Illinois/NCSA
Open Source License

Copyright (c) 2003-2018 University of Illinois at Urbana-Champaign.
All rights reserved.

Developed by:

LLVM Team

University of Illinois at Urbana-Champaign

http://llvm.org

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.

* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.

==============================================================================
Copyrights and Licenses for Third Party Software Distributed with LLVM:
==============================================================================
The LLVM software contains code written by third parties. Such software will
have its own individual LICENSE.TXT file in the directory in which it appears.
This file will describe the copyrights, license, and restrictions which apply
to that code.

The disclaimer of warranty in the University of Illinois Open Source License
applies to all code in the LLVM Distribution, and nothing in any of the
other licenses gives permission to use the names of the LLVM Team or the
University of Illinois to endorse or promote products derived from this
Software.

The following pieces of software have additional or alternate copyrights,
licenses, and/or restrictions:

Program Directory
------- ---------
Google Test llvm/utils/unittest/googletest
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
Loading

0 comments on commit 6509eb1

Please sign in to comment.