diff --git a/sycl/test/CMakeLists.txt b/sycl/test/CMakeLists.txt index 95dacdcffe48e..5d891547560fa 100644 --- a/sycl/test/CMakeLists.txt +++ b/sycl/test/CMakeLists.txt @@ -1,23 +1,11 @@ -set(LLVM_BUILD_LIBRARY_DIRS "${LLVM_BINARY_DIR}/lib/") -set(LLVM_BUILD_BINARY_DIRS "${LLVM_BINARY_DIR}/bin/") set(LLVM_TOOLS_DIR "${LLVM_BINARY_DIR}/bin/") -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) 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") +set(DEPLOY_RT_TEST_ARGS ${DEPLOY_RT_TEST_ARGS} "-v -D SYCL_TOOLS_DIR=${CMAKE_INSTALL_PREFIX}/bin -D SYCL_LIBS_DIR=${CMAKE_INSTALL_PREFIX}/lib -D SYCL_INCLUDE=${dst_deploy_dir}") configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in @@ -33,13 +21,6 @@ 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 @@ -49,11 +30,8 @@ list(APPEND SYCL_TEST_DEPS ) list(APPEND SYCL_DEPLOY_TEST_DEPS + ${SYCL_TEST_DEPS} deploy-sycl-toolchain - FileCheck - not - get_device_count_by_type - llvm-config ) add_lit_testsuite(check-sycl "Running the SYCL regression tests" @@ -62,10 +40,13 @@ add_lit_testsuite(check-sycl "Running the SYCL regression tests" PARAMS "SYCL_BE=PI_OPENCL" DEPENDS ${SYCL_TEST_DEPS} ) + add_lit_testsuite(check-sycl-deploy "Running the SYCL regression tests" ${CMAKE_CURRENT_BINARY_DIR} ARGS ${DEPLOY_RT_TEST_ARGS} + PARAMS "SYCL_BE=PI_OPENCL" DEPENDS ${SYCL_DEPLOY_TEST_DEPS} + EXCLUDE_FROM_CHECK_ALL ) set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests") @@ -76,7 +57,7 @@ add_lit_testsuites(SYCL ${CMAKE_CURRENT_SOURCE_DIR} if(SYCL_BUILD_PI_CUDA) add_lit_testsuite(check-sycl-cuda "Running the SYCL regression tests for CUDA" ${CMAKE_CURRENT_BINARY_DIR} - ARGS ${RT_TEST_ARGS} + ARGS ${RT_TEST_ARGS} PARAMS "SYCL_BE=PI_CUDA" DEPENDS ${SYCL_TEST_DEPS} ) diff --git a/sycl/test/basic_tests/handler/interop_task.cpp b/sycl/test/basic_tests/handler/interop_task.cpp index 1857a0e359db5..dba8cf0d8be2d 100644 --- a/sycl/test/basic_tests/handler/interop_task.cpp +++ b/sycl/test/basic_tests/handler/interop_task.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 // REQUIRES: opencl diff --git a/sycl/test/deploy-lit.site.cfg.py.in b/sycl/test/deploy-lit.site.cfg.py.in deleted file mode 100644 index e99cee34e1098..0000000000000 --- a/sycl/test/deploy-lit.site.cfg.py.in +++ /dev/null @@ -1,25 +0,0 @@ -@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/devicelib/assert-windows.cpp b/sycl/test/devicelib/assert-windows.cpp index 1451431b46946..266ec3845d766 100644 --- a/sycl/test/devicelib/assert-windows.cpp +++ b/sycl/test/devicelib/assert-windows.cpp @@ -5,7 +5,7 @@ // XFAIL: * // // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/../bin/libsycl-msvc.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/../bin/libsycl-msvc.o -o %t.out // // MSVC implementation of assert does not call an unreachable built-in, so the // program doesn't terminate when fallback is used. diff --git a/sycl/test/devicelib/assert.cpp b/sycl/test/devicelib/assert.cpp index d0f18fe8cb544..757647322cb64 100644 --- a/sycl/test/devicelib/assert.cpp +++ b/sycl/test/devicelib/assert.cpp @@ -1,6 +1,6 @@ // REQUIRES: cpu,linux // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-glibc.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-glibc.o -o %t.out // (see the other RUN lines below; it is a bit complicated) // // assert() call in device code guarantees nothing: on some devices it behaves diff --git a/sycl/test/devicelib/c99_complex_math_fp64_test.cpp b/sycl/test/devicelib/c99_complex_math_fp64_test.cpp index 7fdd07d4c3cd7..b7da3b6a9e37a 100644 --- a/sycl/test/devicelib/c99_complex_math_fp64_test.cpp +++ b/sycl/test/devicelib/c99_complex_math_fp64_test.cpp @@ -1,6 +1,6 @@ // UNSUPPORTED: windows // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-complex-fp64.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-complex-fp64.o -o %t.out #include #include #include diff --git a/sycl/test/devicelib/c99_complex_math_test.cpp b/sycl/test/devicelib/c99_complex_math_test.cpp index 8b28e943d6547..9637ccd4a0568 100644 --- a/sycl/test/devicelib/c99_complex_math_test.cpp +++ b/sycl/test/devicelib/c99_complex_math_test.cpp @@ -1,6 +1,6 @@ // UNSUPPORTED: windows // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-complex.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-complex.o -o %t.out #include #include #include diff --git a/sycl/test/devicelib/cmath_test.cpp b/sycl/test/devicelib/cmath_test.cpp index ded8d047a54d8..217ad4121f6c8 100644 --- a/sycl/test/devicelib/cmath_test.cpp +++ b/sycl/test/devicelib/cmath_test.cpp @@ -1,6 +1,6 @@ // UNSUPPORTED: windows // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath.o -o %t.out #include #include #include diff --git a/sycl/test/devicelib/cmath_test_fp64.cpp b/sycl/test/devicelib/cmath_test_fp64.cpp index 5ec7f1b34c24e..1c8b7afa5d4a5 100644 --- a/sycl/test/devicelib/cmath_test_fp64.cpp +++ b/sycl/test/devicelib/cmath_test_fp64.cpp @@ -1,6 +1,6 @@ // UNSUPPORTED: windows // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath-fp64.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath-fp64.o -o %t.out #include #include #include diff --git a/sycl/test/devicelib/math_fp64_test.cpp b/sycl/test/devicelib/math_fp64_test.cpp index b0eedae1e8f7e..30c21dbc3b77e 100644 --- a/sycl/test/devicelib/math_fp64_test.cpp +++ b/sycl/test/devicelib/math_fp64_test.cpp @@ -1,6 +1,6 @@ // UNSUPPORTED: windows // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath-fp64.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath-fp64.o -o %t.out #include #include #include diff --git a/sycl/test/devicelib/math_override_test.cpp b/sycl/test/devicelib/math_override_test.cpp index 92b419bfdca8b..62166b95ab1ab 100644 --- a/sycl/test/devicelib/math_override_test.cpp +++ b/sycl/test/devicelib/math_override_test.cpp @@ -1,6 +1,6 @@ // UNSUPPORTED: windows // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath.o -o %t.out #include #include #include diff --git a/sycl/test/devicelib/math_test.cpp b/sycl/test/devicelib/math_test.cpp index 4afba887681a2..1b5aa4332fe8e 100644 --- a/sycl/test/devicelib/math_test.cpp +++ b/sycl/test/devicelib/math_test.cpp @@ -1,6 +1,6 @@ // UNSUPPORTED: windows // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath.o -o %t.out #include #include #include diff --git a/sycl/test/devicelib/std_complex_math_fp64_test.cpp b/sycl/test/devicelib/std_complex_math_fp64_test.cpp index b59591b578981..e1213a713ad5b 100644 --- a/sycl/test/devicelib/std_complex_math_fp64_test.cpp +++ b/sycl/test/devicelib/std_complex_math_fp64_test.cpp @@ -1,6 +1,6 @@ // UNSUPPORTED: windows // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-complex-fp64.o %llvm_build_libs_dir/libsycl-cmath-fp64.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-complex-fp64.o %sycl_libs_dir/libsycl-cmath-fp64.o -o %t.out #include #include #include "math_utils.hpp" diff --git a/sycl/test/devicelib/std_complex_math_test.cpp b/sycl/test/devicelib/std_complex_math_test.cpp index 9c817e714a88f..f3fe5ae9ae510 100644 --- a/sycl/test/devicelib/std_complex_math_test.cpp +++ b/sycl/test/devicelib/std_complex_math_test.cpp @@ -1,6 +1,6 @@ // UNSUPPORTED: windows // RUN: %clangxx -fsycl -c %s -o %t.o -// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-complex.o %llvm_build_libs_dir/libsycl-cmath.o -o %t.out +// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-complex.o %sycl_libs_dir/libsycl-cmath.o -o %t.out #include #include #include "math_utils.hpp" diff --git a/sycl/test/lit.cfg.py b/sycl/test/lit.cfg.py index f4839e086efdb..999b6d1cd5584 100644 --- a/sycl/test/lit.cfg.py +++ b/sycl/test/lit.cfg.py @@ -38,21 +38,21 @@ config.available_features.add('linux') # Propagate 'LD_LIBRARY_PATH' through the environment. if 'LD_LIBRARY_PATH' in os.environ: - config.environment['LD_LIBRARY_PATH'] = os.path.pathsep.join((config.environment['LD_LIBRARY_PATH'], config.llvm_build_libs_dir)) + config.environment['LD_LIBRARY_PATH'] = os.path.pathsep.join((config.environment['LD_LIBRARY_PATH'], config.sycl_libs_dir)) else: - config.environment['LD_LIBRARY_PATH'] = config.llvm_build_libs_dir + config.environment['LD_LIBRARY_PATH'] = config.sycl_libs_dir elif platform.system() == "Windows": config.available_features.add('windows') if 'LIB' in os.environ: - config.environment['LIB'] = os.path.pathsep.join((config.environment['LIB'], config.llvm_build_libs_dir)) + config.environment['LIB'] = os.path.pathsep.join((config.environment['LIB'], config.sycl_libs_dir)) else: - config.environment['LIB'] = config.llvm_build_libs_dir + config.environment['LIB'] = config.sycl_libs_dir if 'PATH' in os.environ: - config.environment['PATH'] = os.path.pathsep.join((config.environment['PATH'], config.llvm_build_bins_dir)) + config.environment['PATH'] = os.path.pathsep.join((config.environment['PATH'], config.sycl_tools_dir)) else: - config.environment['PATH'] = config.llvm_build_bins_dir + config.environment['PATH'] = config.sycl_tools_dir elif platform.system() == "Darwin": # FIXME: surely there is a more elegant way to instantiate the Xcode directories. @@ -61,34 +61,31 @@ else: config.environment['CPATH'] = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1" config.environment['CPATH'] = os.path.pathsep.join((config.environment['CPATH'], "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/")) - config.environment['DYLD_LIBRARY_PATH'] = config.llvm_build_libs_dir + config.environment['DYLD_LIBRARY_PATH'] = config.sycl_libs_dir # propagate the environment variable OCL_ICD_FILANEMES to use proper runtime. if 'OCL_ICD_FILENAMES' in os.environ: config.environment['OCL_ICD_FILENAMES'] = os.environ['OCL_ICD_FILENAMES'] -config.substitutions.append( ('%clang_cc1', ' ' + config.clang + ' -cc1 ') ) -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( ('%sycl_libs_dir', config.sycl_libs_dir ) ) config.substitutions.append( ('%sycl_include', config.sycl_include ) ) config.substitutions.append( ('%opencl_libs_dir', config.opencl_libs_dir) ) config.substitutions.append( ('%sycl_source_dir', config.sycl_source_dir) ) +llvm_config.use_clang() + tools = ['llvm-spirv'] -tool_dirs = [config.llvm_tools_dir] +tool_dirs = [config.sycl_tools_dir] llvm_config.add_tool_substitutions(tools, tool_dirs) if "opencl-aot" in config.llvm_enable_projects: if 'PATH' in os.environ: print("Adding path to opencl-aot tool to PATH") - os.environ['PATH'] = os.path.pathsep.join((os.getenv('PATH'), config.llvm_build_bins_dir)) + os.environ['PATH'] = os.path.pathsep.join((os.getenv('PATH'), config.sycl_tools_dir)) backend=lit_config.params.get('SYCL_BE', "PI_OPENCL") -get_device_count_by_type_path = os.path.join(config.llvm_binary_dir, - "bin", "get_device_count_by_type") +get_device_count_by_type_path = os.path.join(config.llvm_tools_dir, "get_device_count_by_type") def getDeviceCount(device_type): is_cuda = False; @@ -186,7 +183,7 @@ def getDeviceCount(device_type): path = config.environment['PATH'] -path = os.path.pathsep.join((config.llvm_tools_dir, path)) +path = os.path.pathsep.join((config.sycl_tools_dir, path)) config.environment['PATH'] = path # Device AOT compilation tools aren't part of the SYCL project, diff --git a/sycl/test/lit.site.cfg.py.in b/sycl/test/lit.site.cfg.py.in index f1a66894b1f0f..18ef72f3a94e7 100644 --- a/sycl/test/lit.site.cfg.py.in +++ b/sycl/test/lit.site.cfg.py.in @@ -2,18 +2,16 @@ import sys -config.clang = "@CLANG_IN_BUILD@" -config.clangxx = "@CLANGXX_IN_BUILD@" -config.clang_cl = "@CLANGCL_IN_BUILD@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.sycl_tools_dir = lit_config.params.get('SYCL_TOOLS_DIR', "@LLVM_TOOLS_DIR@") 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.sycl_include = "@SYCL_INCLUDE@" +config.sycl_include = lit_config.params.get('SYCL_INCLUDE', "@SYCL_INCLUDE@") config.sycl_obj_root = "@SYCL_BINARY_DIR@" config.sycl_source_dir = "@SYCL_SOURCE_DIR@/source" config.opencl_libs_dir = os.path.dirname("@OpenCL_LIBRARIES@") +config.sycl_libs_dir = lit_config.params.get('SYCL_LIBS_DIR', "@LLVM_LIBS_DIR@") +config.target_triple = "@TARGET_TRIPLE@" +config.host_triple = "@LLVM_HOST_TRIPLE@" config.llvm_enable_projects = "@LLVM_ENABLE_PROJECTS@"