Skip to content

[SYCL] Fix check-sycl-deploy target problems #1165

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 1 commit into from
Mar 2, 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
31 changes: 6 additions & 25 deletions sycl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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")

Expand All @@ -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}
)
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/handler/interop_task.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
// REQUIRES: opencl
Expand Down
25 changes: 0 additions & 25 deletions sycl/test/deploy-lit.site.cfg.py.in

This file was deleted.

2 changes: 1 addition & 1 deletion sycl/test/devicelib/assert-windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/assert.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/c99_complex_math_fp64_test.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <cassert>
#include <complex.h>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/c99_complex_math_test.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <cassert>
#include <complex.h>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/cmath_test.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <iostream>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/cmath_test_fp64.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <iostream>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/math_fp64_test.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <iostream>
#include <math.h>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/math_override_test.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <iostream>
#include <math.h>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/math_test.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <iostream>
#include <math.h>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/std_complex_math_fp64_test.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <cassert>
#include "math_utils.hpp"
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/devicelib/std_complex_math_test.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <cassert>
#include "math_utils.hpp"
Expand Down
31 changes: 14 additions & 17 deletions sycl/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 5 additions & 7 deletions sycl/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@"

Expand Down