diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index 2593aab6ed86c..2fedec8470756 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -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. diff --git a/sycl/test/CMakeLists.txt b/sycl/test/CMakeLists.txt index fbbd72bcd0ab6..d2ec0c46cdced 100644 --- a/sycl/test/CMakeLists.txt +++ b/sycl/test/CMakeLists.txt @@ -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 @@ -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 @@ -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} diff --git a/sycl/test/basic_tests/buffer/buffer_interop.cpp b/sycl/test/basic_tests/buffer/buffer_interop.cpp index 86f794da9c2a2..68f4230652392 100644 --- a/sycl/test/basic_tests/buffer/buffer_interop.cpp +++ b/sycl/test/basic_tests/buffer/buffer_interop.cpp @@ -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 diff --git a/sycl/test/basic_tests/buffer/subbuffer_interop.cpp b/sycl/test/basic_tests/buffer/subbuffer_interop.cpp index 9c6cdf8fb99c1..ac5fe1350078e 100644 --- a/sycl/test/basic_tests/buffer/subbuffer_interop.cpp +++ b/sycl/test/basic_tests/buffer/subbuffer_interop.cpp @@ -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 diff --git a/sycl/test/basic_tests/event.cpp b/sycl/test/basic_tests/event.cpp index fc873725e2336..2005decfee78e 100644 --- a/sycl/test/basic_tests/event.cpp +++ b/sycl/test/basic_tests/event.cpp @@ -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 ----------------------------==// // diff --git a/sycl/test/basic_tests/kernel_interop.cpp b/sycl/test/basic_tests/kernel_interop.cpp index 0abf79874a4f7..2b5e294b61e27 100644 --- a/sycl/test/basic_tests/kernel_interop.cpp +++ b/sycl/test/basic_tests/kernel_interop.cpp @@ -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 diff --git a/sycl/test/basic_tests/sampler/sampler.cpp b/sycl/test/basic_tests/sampler/sampler.cpp index d8d0a31414390..5b5b5388099e7 100644 --- a/sycl/test/basic_tests/sampler/sampler.cpp +++ b/sycl/test/basic_tests/sampler/sampler.cpp @@ -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 diff --git a/sycl/test/basic_tests/set_arg_interop.cpp b/sycl/test/basic_tests/set_arg_interop.cpp index 3e8362720e54d..be0dff3eab2c2 100644 --- a/sycl/test/basic_tests/set_arg_interop.cpp +++ b/sycl/test/basic_tests/set_arg_interop.cpp @@ -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 diff --git a/sycl/test/deploy-lit.site.cfg.py.in b/sycl/test/deploy-lit.site.cfg.py.in new file mode 100644 index 0000000000000..e99cee34e1098 --- /dev/null +++ b/sycl/test/deploy-lit.site.cfg.py.in @@ -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") diff --git a/sycl/test/fpga_tests/fpga_queue.cpp b/sycl/test/fpga_tests/fpga_queue.cpp index 587c01b3a594a..8fa1cc71c435b 100644 --- a/sycl/test/fpga_tests/fpga_queue.cpp +++ b/sycl/test/fpga_tests/fpga_queue.cpp @@ -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 diff --git a/sycl/test/function-pointers/fp-as-kernel-arg.cpp b/sycl/test/function-pointers/fp-as-kernel-arg.cpp index 70ebac362324a..f4d515b5770c8 100644 --- a/sycl/test/function-pointers/fp-as-kernel-arg.cpp +++ b/sycl/test/function-pointers/fp-as-kernel-arg.cpp @@ -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 diff --git a/sycl/test/function-pointers/pass-fp-through-buffer.cpp b/sycl/test/function-pointers/pass-fp-through-buffer.cpp index 4891c31b19412..bcc203f092b90 100644 --- a/sycl/test/function-pointers/pass-fp-through-buffer.cpp +++ b/sycl/test/function-pointers/pass-fp-through-buffer.cpp @@ -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 diff --git a/sycl/test/kernel-and-program/kernel-and-program.cpp b/sycl/test/kernel-and-program/kernel-and-program.cpp index ded76c2f16171..f07767f09a317 100644 --- a/sycl/test/kernel-and-program/kernel-and-program.cpp +++ b/sycl/test/kernel-and-program/kernel-and-program.cpp @@ -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 diff --git a/sycl/test/lit.cfg.py b/sycl/test/lit.cfg.py index fe57931bade45..60437bfd03c73 100644 --- a/sycl/test/lit.cfg.py +++ b/sycl/test/lit.cfg.py @@ -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] diff --git a/sycl/test/lit.site.cfg.py.in b/sycl/test/lit.site.cfg.py.in index 7205b06a96e7e..da09c97616aac 100644 --- a/sycl/test/lit.site.cfg.py.in +++ b/sycl/test/lit.site.cfg.py.in @@ -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@" diff --git a/sycl/test/ordered_queue/ordered_buffs.cpp b/sycl/test/ordered_queue/ordered_buffs.cpp index 05d0d69baaa8b..4ef34008a52fb 100644 --- a/sycl/test/ordered_queue/ordered_buffs.cpp +++ b/sycl/test/ordered_queue/ordered_buffs.cpp @@ -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 diff --git a/sycl/test/ordered_queue/ordered_dmemll.cpp b/sycl/test/ordered_queue/ordered_dmemll.cpp index 279677a5d3c4d..6674a2aedb97d 100644 --- a/sycl/test/ordered_queue/ordered_dmemll.cpp +++ b/sycl/test/ordered_queue/ordered_dmemll.cpp @@ -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 diff --git a/sycl/test/ordered_queue/ordered_queue.cpp b/sycl/test/ordered_queue/ordered_queue.cpp index c15b38d3c22b4..442b8db358594 100644 --- a/sycl/test/ordered_queue/ordered_queue.cpp +++ b/sycl/test/ordered_queue/ordered_queue.cpp @@ -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 -----------------==// // diff --git a/sycl/test/ordered_queue/prop.cpp b/sycl/test/ordered_queue/prop.cpp index 713915a460c6d..733a121067e0a 100644 --- a/sycl/test/ordered_queue/prop.cpp +++ b/sycl/test/ordered_queue/prop.cpp @@ -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 diff --git a/sycl/test/sub_group/common_ocl.cpp b/sycl/test/sub_group/common_ocl.cpp index 19f125d5036f0..8f198735eccc2 100644 --- a/sycl/test/sub_group/common_ocl.cpp +++ b/sycl/test/sub_group/common_ocl.cpp @@ -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 diff --git a/sycl/test/usm/prefetch.cpp b/sycl/test/usm/prefetch.cpp index 78b6fa9561e59..a8179329d0cb5 100644 --- a/sycl/test/usm/prefetch.cpp +++ b/sycl/test/usm/prefetch.cpp @@ -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