Skip to content

Commit 8a45134

Browse files
authored
[SYCL] Implement check-sycl-deploy target (#1142)
This target allows to run SYCL LIT tests with deploy bits Signed-off-by: Mariya Podchishchaeva <[email protected]>
1 parent 9a34a11 commit 8a45134

21 files changed

+75
-21
lines changed

sycl/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION
5252

5353
set(LLVM_INST_INC_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include")
5454
set(dst_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
55+
set(dst_deploy_dir ${CMAKE_INSTALL_PREFIX}/lib/clang/${CLANG_VERSION}/include)
5556

5657
# Find OpenCL headers and libraries installed in the system and use them to
5758
# build SYCL runtime.

sycl/test/CMakeLists.txt

+28
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ set(CLANG_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang")
55
set(CLANGXX_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang++")
66
set(CLANGCL_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang-cl")
77

8+
set(LLVM_DEPLOY_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib/")
9+
set(LLVM_DEPLOY_BINARY_DIRS "${CMAKE_INSTALL_PREFIX}/bin/")
10+
set(CLANG_IN_DEPLOY "${CMAKE_INSTALL_PREFIX}/bin/clang")
11+
set(CLANGXX_IN_DEPLOY "${CMAKE_INSTALL_PREFIX}/bin/clang++")
12+
set(CLANGCL_IN_DEPLOY "${CMAKE_INSTALL_PREFIX}/bin/clang-cl")
13+
814
get_target_property(SYCL_BINARY_DIR sycl-toolchain BINARY_DIR)
915
get_target_property(SYCL_SOURCE_DIR sycl-toolchain SOURCE_DIR)
1016

1117
set(SYCL_INCLUDE "${dst_dir}")
18+
set(SYCL_DEPLOY_INCLUDE "${dst_deploy_dir}")
1219

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

1523
configure_lit_site_cfg(
1624
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
@@ -26,6 +34,13 @@ configure_lit_site_cfg(
2634
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
2735
)
2836

37+
configure_lit_site_cfg(
38+
${CMAKE_CURRENT_SOURCE_DIR}/deploy-lit.site.cfg.py.in
39+
${CMAKE_CURRENT_BINARY_DIR}/deploy-lit.site.cfg.py
40+
MAIN_CONFIG
41+
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
42+
)
43+
2944
list(APPEND SYCL_TEST_DEPS
3045
sycl-toolchain
3146
FileCheck
@@ -34,11 +49,24 @@ list(APPEND SYCL_TEST_DEPS
3449
llvm-config
3550
)
3651

52+
list(APPEND SYCL_DEPLOY_TEST_DEPS
53+
deploy-sycl-toolchain
54+
FileCheck
55+
not
56+
get_device_count_by_type
57+
llvm-config
58+
)
59+
3760
add_lit_testsuite(check-sycl "Running the SYCL regression tests"
3861
${CMAKE_CURRENT_BINARY_DIR}
3962
ARGS ${RT_TEST_ARGS}
4063
DEPENDS ${SYCL_TEST_DEPS}
4164
)
65+
add_lit_testsuite(check-sycl-deploy "Running the SYCL regression tests"
66+
${CMAKE_CURRENT_BINARY_DIR}
67+
ARGS ${DEPLOY_RT_TEST_ARGS}
68+
DEPENDS ${SYCL_DEPLOY_TEST_DEPS}
69+
)
4270
set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests")
4371

4472
add_lit_testsuites(SYCL ${CMAKE_CURRENT_SOURCE_DIR}

sycl/test/basic_tests/buffer/buffer_interop.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: %CPU_RUN_PLACEHOLDER %t.out
33
// RUN: %GPU_RUN_PLACEHOLDER %t.out
44
// RUN: %ACC_RUN_PLACEHOLDER %t.out

sycl/test/basic_tests/buffer/subbuffer_interop.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: %CPU_RUN_PLACEHOLDER %t.out
33
// RUN: %GPU_RUN_PLACEHOLDER %t.out
44
// RUN: %ACC_RUN_PLACEHOLDER %t.out

sycl/test/basic_tests/event.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
33
//==--------------- event.cpp - SYCL event test ----------------------------==//
44
//

sycl/test/basic_tests/kernel_interop.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: %CPU_RUN_PLACEHOLDER %t.out
33
// RUN: %GPU_RUN_PLACEHOLDER %t.out
44
// RUN: %ACC_RUN_PLACEHOLDER %t.out

sycl/test/basic_tests/sampler/sampler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
33
// RUN: %CPU_RUN_PLACEHOLDER %t.out
44
// RUN: %GPU_RUN_PLACEHOLDER %t.out

sycl/test/basic_tests/set_arg_interop.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL -O3
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL -O3
22
// RUN: %CPU_RUN_PLACEHOLDER %t.out
33
// RUN: %GPU_RUN_PLACEHOLDER %t.out
44
// RUN: %ACC_RUN_PLACEHOLDER %t.out

sycl/test/deploy-lit.site.cfg.py.in

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@LIT_SITE_CFG_IN_HEADER@
2+
3+
import sys
4+
5+
config.clang = "@CLANG_IN_DEPLOY@"
6+
config.clangxx = "@CLANGXX_IN_DEPLOY@"
7+
config.clang_cl = "@CLANGCL_IN_DEPLOY@"
8+
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
9+
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
10+
config.llvm_build_libs_dir = "@LLVM_DEPLOY_LIBRARY_DIRS@"
11+
config.llvm_build_bins_dir = "@LLVM_DEPLOY_BINARY_DIRS@"
12+
config.llvm_binary_dir = "@LLVM_BINARY_DIR@"
13+
config.sycl_include = "@SYCL_DEPLOY_INCLUDE@"
14+
config.sycl_obj_root = "@SYCL_BINARY_DIR@"
15+
config.opencl_lib = "@OpenCL_LIBRARIES@"
16+
config.opencl_libs_dir = os.path.dirname("@OpenCL_LIBRARIES@")
17+
18+
config.llvm_enable_projects = "@LLVM_ENABLE_PROJECTS@"
19+
20+
21+
import lit.llvm
22+
lit.llvm.initialize(lit_config, config)
23+
24+
# Let the main config do the real work.
25+
lit_config.load_config(config, "@SYCL_SOURCE_DIR@/test/lit.cfg.py")

sycl/test/fpga_tests/fpga_queue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
33
// RUN: %ACC_RUN_PLACEHOLDER %t.out
44
// RUN: %CPU_RUN_PLACEHOLDER %t.out

sycl/test/function-pointers/fp-as-kernel-arg.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -Xclang -fsycl-allow-func-ptr -std=c++14 -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -Xclang -fsycl-allow-func-ptr -std=c++14 -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
33
// RUN: %CPU_RUN_PLACEHOLDER %t.out
44
// RUN: %GPU_RUN_PLACEHOLDER %t.out

sycl/test/function-pointers/pass-fp-through-buffer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -Xclang -fsycl-allow-func-ptr -std=c++14 -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -Xclang -fsycl-allow-func-ptr -std=c++14 -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
33
// RUN: %CPU_RUN_PLACEHOLDER %t.out
44
// RUN: %GPU_RUN_PLACEHOLDER %t.out

sycl/test/kernel-and-program/kernel-and-program.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
33
// RUN: %CPU_RUN_PLACEHOLDER %t.out
44
// RUNx: %GPU_RUN_PLACEHOLDER %t.out

sycl/test/lit.cfg.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@
6868
config.environment['OCL_ICD_FILENAMES'] = os.environ['OCL_ICD_FILENAMES']
6969

7070
config.substitutions.append( ('%clang_cc1', ' ' + config.clang + ' -cc1 ') )
71-
config.substitutions.append( ('%clangxx', ' ' + config.clangxx + ' -I'+config.opencl_include ) )
72-
config.substitutions.append( ('%clang_cl', ' ' + config.clang_cl + ' /I '+config.opencl_include ) )
73-
config.substitutions.append( ('%clang', ' ' + config.clang + ' -I'+config.opencl_include ) )
71+
config.substitutions.append( ('%clangxx', ' ' + config.clangxx ) )
72+
config.substitutions.append( ('%clang_cl', ' ' + config.clang_cl ) )
73+
config.substitutions.append( ('%clang', ' ' + config.clang ) )
7474
config.substitutions.append( ('%llvm_build_libs_dir', config.llvm_build_libs_dir ) )
75-
config.substitutions.append( ('%opencl_include', config.opencl_include ) )
7675
config.substitutions.append( ('%sycl_include', config.sycl_include ) )
76+
config.substitutions.append( ('%opencl_libs_dir', config.opencl_libs_dir) )
7777

7878
tools = ['llvm-spirv']
7979
tool_dirs = [config.llvm_tools_dir]

sycl/test/lit.site.cfg.py.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
1010
config.llvm_build_libs_dir = "@LLVM_BUILD_LIBRARY_DIRS@"
1111
config.llvm_build_bins_dir = "@LLVM_BUILD_BINARY_DIRS@"
1212
config.llvm_binary_dir = "@LLVM_BINARY_DIR@"
13-
config.opencl_include = "@OPENCL_INCLUDE@"
1413
config.sycl_include = "@SYCL_INCLUDE@"
1514
config.sycl_obj_root = "@SYCL_BINARY_DIR@"
15+
config.opencl_libs_dir = os.path.dirname("@OpenCL_LIBRARIES@")
1616

1717
config.llvm_enable_projects = "@LLVM_ENABLE_PROJECTS@"
1818

sycl/test/ordered_queue/ordered_buffs.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: %ACC_RUN_PLACEHOLDER %t.out
33
// RUN: %CPU_RUN_PLACEHOLDER %t.out
44
// RUN: %GPU_RUN_PLACEHOLDER %t.out

sycl/test/ordered_queue/ordered_dmemll.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t1.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t1.out -L %opencl_libs_dir -lOpenCL
22
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
33
// RUN: %GPU_RUN_PLACEHOLDER %t1.out
44

sycl/test/ordered_queue/ordered_queue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
33
//==---------- ordered_queue.cpp - SYCL ordered queue test -----------------==//
44
//

sycl/test/ordered_queue/prop.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t1.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t1.out -L %opencl_libs_dir -lOpenCL
22
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
33
// RUN: %GPU_RUN_PLACEHOLDER %t1.out
44

sycl/test/sub_group/common_ocl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// 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
22
// RUN: llvm-spirv %T/kernel_ocl.bc -o %T/kernel_ocl.spv
3-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
3+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
44
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
55
// RUN: %CPU_RUN_PLACEHOLDER %t.out %T/kernel_ocl.spv
66
// RUN: %GPU_RUN_PLACEHOLDER %t.out %T/kernel_ocl.spv

sycl/test/usm/prefetch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8-
// RUN: %clangxx -fsycl %s -o %t1.out -lOpenCL
8+
// RUN: %clangxx -fsycl %s -o %t1.out -L %opencl_libs_dir -lOpenCL
99
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
1010
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
1111

0 commit comments

Comments
 (0)