Skip to content

[SYCL] Implement check-sycl-deploy target #1142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2020
Merged
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
1 change: 1 addition & 0 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION

set(LLVM_INST_INC_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include")
set(dst_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
set(dst_deploy_dir ${CMAKE_INSTALL_PREFIX}/lib/clang/${CLANG_VERSION}/include)

# Find OpenCL headers and libraries installed in the system and use them to
# build SYCL runtime.
Expand Down
28 changes: 28 additions & 0 deletions sycl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ set(CLANG_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang")
set(CLANGXX_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang++")
set(CLANGCL_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang-cl")

set(LLVM_DEPLOY_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib/")
set(LLVM_DEPLOY_BINARY_DIRS "${CMAKE_INSTALL_PREFIX}/bin/")
set(CLANG_IN_DEPLOY "${CMAKE_INSTALL_PREFIX}/bin/clang")
set(CLANGXX_IN_DEPLOY "${CMAKE_INSTALL_PREFIX}/bin/clang++")
set(CLANGCL_IN_DEPLOY "${CMAKE_INSTALL_PREFIX}/bin/clang-cl")

get_target_property(SYCL_BINARY_DIR sycl-toolchain BINARY_DIR)
get_target_property(SYCL_SOURCE_DIR sycl-toolchain SOURCE_DIR)

set(SYCL_INCLUDE "${dst_dir}")
set(SYCL_DEPLOY_INCLUDE "${dst_deploy_dir}")

set(RT_TEST_ARGS ${RT_TEST_ARGS} "-v")
set(DEPLOY_RT_TEST_ARGS ${DEPLOY_RT_TEST_ARGS} "-v --config-prefix=deploy-lit")

configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
Expand All @@ -26,6 +34,13 @@ configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
)

configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/deploy-lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/deploy-lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)

list(APPEND SYCL_TEST_DEPS
sycl-toolchain
FileCheck
Expand All @@ -34,11 +49,24 @@ list(APPEND SYCL_TEST_DEPS
llvm-config
)

list(APPEND SYCL_DEPLOY_TEST_DEPS
deploy-sycl-toolchain
FileCheck
not
get_device_count_by_type
llvm-config
)

add_lit_testsuite(check-sycl "Running the SYCL regression tests"
${CMAKE_CURRENT_BINARY_DIR}
ARGS ${RT_TEST_ARGS}
DEPENDS ${SYCL_TEST_DEPS}
)
add_lit_testsuite(check-sycl-deploy "Running the SYCL regression tests"
${CMAKE_CURRENT_BINARY_DIR}
ARGS ${DEPLOY_RT_TEST_ARGS}
DEPENDS ${SYCL_DEPLOY_TEST_DEPS}
)
set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests")

add_lit_testsuites(SYCL ${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/buffer/buffer_interop.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/buffer/subbuffer_interop.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/event.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
//==--------------- event.cpp - SYCL event test ----------------------------==//
//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/kernel_interop.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/sampler/sampler.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/set_arg_interop.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL -O3
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL -O3
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
Expand Down
25 changes: 25 additions & 0 deletions sycl/test/deploy-lit.site.cfg.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@LIT_SITE_CFG_IN_HEADER@

import sys

config.clang = "@CLANG_IN_DEPLOY@"
config.clangxx = "@CLANGXX_IN_DEPLOY@"
config.clang_cl = "@CLANGCL_IN_DEPLOY@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.llvm_build_libs_dir = "@LLVM_DEPLOY_LIBRARY_DIRS@"
config.llvm_build_bins_dir = "@LLVM_DEPLOY_BINARY_DIRS@"
config.llvm_binary_dir = "@LLVM_BINARY_DIR@"
config.sycl_include = "@SYCL_DEPLOY_INCLUDE@"
config.sycl_obj_root = "@SYCL_BINARY_DIR@"
config.opencl_lib = "@OpenCL_LIBRARIES@"
config.opencl_libs_dir = os.path.dirname("@OpenCL_LIBRARIES@")

config.llvm_enable_projects = "@LLVM_ENABLE_PROJECTS@"


import lit.llvm
lit.llvm.initialize(lit_config, config)

# Let the main config do the real work.
lit_config.load_config(config, "@SYCL_SOURCE_DIR@/test/lit.cfg.py")
2 changes: 1 addition & 1 deletion sycl/test/fpga_tests/fpga_queue.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/function-pointers/fp-as-kernel-arg.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -Xclang -fsycl-allow-func-ptr -std=c++14 -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -Xclang -fsycl-allow-func-ptr -std=c++14 -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/function-pointers/pass-fp-through-buffer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -Xclang -fsycl-allow-func-ptr -std=c++14 -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -Xclang -fsycl-allow-func-ptr -std=c++14 -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/kernel-and-program/kernel-and-program.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUNx: %GPU_RUN_PLACEHOLDER %t.out
Expand Down
8 changes: 4 additions & 4 deletions sycl/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
config.environment['OCL_ICD_FILENAMES'] = os.environ['OCL_ICD_FILENAMES']

config.substitutions.append( ('%clang_cc1', ' ' + config.clang + ' -cc1 ') )
config.substitutions.append( ('%clangxx', ' ' + config.clangxx + ' -I'+config.opencl_include ) )
config.substitutions.append( ('%clang_cl', ' ' + config.clang_cl + ' /I '+config.opencl_include ) )
config.substitutions.append( ('%clang', ' ' + config.clang + ' -I'+config.opencl_include ) )
config.substitutions.append( ('%clangxx', ' ' + config.clangxx ) )
config.substitutions.append( ('%clang_cl', ' ' + config.clang_cl ) )
config.substitutions.append( ('%clang', ' ' + config.clang ) )
config.substitutions.append( ('%llvm_build_libs_dir', config.llvm_build_libs_dir ) )
config.substitutions.append( ('%opencl_include', config.opencl_include ) )
config.substitutions.append( ('%sycl_include', config.sycl_include ) )
config.substitutions.append( ('%opencl_libs_dir', config.opencl_libs_dir) )

tools = ['llvm-spirv']
tool_dirs = [config.llvm_tools_dir]
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.llvm_build_libs_dir = "@LLVM_BUILD_LIBRARY_DIRS@"
config.llvm_build_bins_dir = "@LLVM_BUILD_BINARY_DIRS@"
config.llvm_binary_dir = "@LLVM_BINARY_DIR@"
config.opencl_include = "@OPENCL_INCLUDE@"
config.sycl_include = "@SYCL_INCLUDE@"
config.sycl_obj_root = "@SYCL_BINARY_DIR@"
config.opencl_libs_dir = os.path.dirname("@OpenCL_LIBRARIES@")

config.llvm_enable_projects = "@LLVM_ENABLE_PROJECTS@"

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/ordered_queue/ordered_buffs.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/ordered_queue/ordered_dmemll.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t1.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t1.out -L %opencl_libs_dir -lOpenCL
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
// RUN: %GPU_RUN_PLACEHOLDER %t1.out

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/ordered_queue/ordered_queue.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
//==---------- ordered_queue.cpp - SYCL ordered queue test -----------------==//
//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/ordered_queue/prop.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t1.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t1.out -L %opencl_libs_dir -lOpenCL
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
// RUN: %GPU_RUN_PLACEHOLDER %t1.out

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/sub_group/common_ocl.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %S/sg.cl -triple spir64-unknown-unknown -emit-llvm-bc -o %T/kernel_ocl.bc -include opencl-c.h
// RUN: llvm-spirv %T/kernel_ocl.bc -o %T/kernel_ocl.spv
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out %T/kernel_ocl.spv
// RUN: %GPU_RUN_PLACEHOLDER %t.out %T/kernel_ocl.spv
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/usm/prefetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// RUN: %clangxx -fsycl %s -o %t1.out -lOpenCL
// RUN: %clangxx -fsycl %s -o %t1.out -L %opencl_libs_dir -lOpenCL
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out

Expand Down