Skip to content
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

[SYCL] Move SYCL headers from standard clang location #1308

Merged
merged 2 commits into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions clang/lib/Driver/ToolChains/SYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,12 @@ SYCLToolChain::GetCXXStdlibType(const ArgList &Args) const {

void SYCLToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
SmallString<128> P(getDriver().getInstalledDir());
llvm::sys::path::append(P, "..");
llvm::sys::path::append(P, "include");
llvm::sys::path::append(P, "sycl");
CC1Args.push_back("-internal-isystem");
CC1Args.push_back(DriverArgs.MakeArgString(P));
HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
}

Expand Down
1 change: 1 addition & 0 deletions clang/test/Driver/sycl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED

// ENABLED: "-cc1"{{.*}} "-fsycl-is-device"
// ENABLED: "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"
// DISABLED-NOT: "-fsycl-is-device"

// RUN: %clang -### -fsycl-device-only -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
Expand Down
10 changes: 5 additions & 5 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ endif()
# Unlike PACKAGE_VERSION, CLANG_VERSION does not include LLVM_VERSION_SUFFIX.
set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION_PATCHLEVEL}")

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)
set(SYCL_INST_INC_DIRECTORY "include/sycl")
vladimirlaz marked this conversation as resolved.
Show resolved Hide resolved
set(dst_dir ${LLVM_BINARY_DIR}/${SYCL_INST_INC_DIRECTORY})
vladimirlaz marked this conversation as resolved.
Show resolved Hide resolved
set(dst_deploy_dir ${CMAKE_INSTALL_PREFIX}/${SYCL_INST_INC_DIRECTORY})

# Find OpenCL headers and libraries installed in the system and use them to
# build SYCL runtime.
Expand Down Expand Up @@ -137,7 +137,7 @@ target_include_directories(OpenCL-Headers
INTERFACE ${OPENCL_INCLUDE}
)
install(DIRECTORY ${OPENCL_INCLUDE}/CL
DESTINATION ${LLVM_INST_INC_DIRECTORY}
DESTINATION ${dst_deploy_dir}
COMPONENT opencl-headers
)

Expand All @@ -159,7 +159,7 @@ COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir}/CL ${dst_dir}/CL
COMMENT "Copying SYCL headers ...")

# Configure SYCL headers
install(DIRECTORY "${sycl_inc_dir}/." DESTINATION "${LLVM_INST_INC_DIRECTORY}" COMPONENT sycl-headers)
install(DIRECTORY "${sycl_inc_dir}/." DESTINATION ${dst_deploy_dir} COMPONENT sycl-headers)

set(SYCL_RT_LIBS sycl)
if (MSVC)
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/buffer/buffer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// REQUIRES: opencl

// RUN: %clangxx %s -o %t1.out -lsycl
// RUN: %clangxx %s -o %t1.out -lsycl -I %sycl_include
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t2.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t2.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/buffer/buffer_ctad.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//==------------------- buffer_ctad.cpp - SYCL buffer CTAD test ----------------==//
//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/buffer/buffer_dev_to_dev.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/basic_tests/buffer/buffer_full_copy.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clangxx %s -o %t1.out -lsycl
// RUN: %clangxx %s -o %t1.out -lsycl -I %sycl_include
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t2.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t2.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t2.out
// RUN: %CPU_RUN_PLACEHOLDER %t2.out
// RUN: %GPU_RUN_PLACEHOLDER %t2.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/context.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %s -o %t.out -lsycl
// RUN: %clangxx %s -o %t.out -lsycl -I %sycl_include
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out

//==--------------- context.cpp - SYCL context test ------------------------==//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/device.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %s -o %t.out -lsycl
// RUN: %clangxx %s -o %t.out -I %sycl_include -lsycl
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out

//==--------------- device.cpp - SYCL device test --------------------------==//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/id_ctad.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//==--------------- id_ctad.cpp - SYCL id CTAD test ----------------------==//
//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/image_accessor_types.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: not %clangxx -fsyntax-only %s 2>&1 | FileCheck %s
// RUN: not %clangxx -fsyntax-only %s -I %sycl_include 2>&1 | FileCheck %s
#include <CL/sycl.hpp>
#include <iostream>

Expand Down
3 changes: 1 addition & 2 deletions sycl/test/basic_tests/image_api.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// REQUIRES: opencl

// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -I %sycl_source_dir %s -o %t1.out
// RUN: %clangxx -I %sycl_source_dir %s -o %t3.out -lsycl
// RUN: %clangxx -I %sycl_source_dir %s -o %t3.out -lsycl -I %sycl_include
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t3.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
// RUN: %GPU_RUN_PLACEHOLDER %t1.out
// RUN: %ACC_RUN_PLACEHOLDER %t1.out


#include <CL/sycl.hpp>
// FIXME do not use internal methods in tests.
#include <CL/sycl/detail/cg.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/image_constructors.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %s -o %t1.out -lsycl
// RUN: %clangxx %s -o %t1.out -lsycl -I %sycl_include
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t2.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t2.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/implicit_conversion_error.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsyntax-only -Xclang -verify %s -Xclang -verify-ignore-unexpected=note,warning
// RUN: %clangxx -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
//==-- implicit_conversion_error.cpp - Unintended implicit conversion check --==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/basic_tests/kernel_info.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -L %opencl_libs_dir -lOpenCL
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
Expand Down Expand Up @@ -64,4 +64,4 @@ int main() {
const cl_ulong prvMemSize =
krn.get_work_group_info<info::kernel_work_group::private_mem_size>(dev);
CHECK(prvMemSize == 0);
}
}
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/parallel_for_indexers.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %s -o %t1.out -lsycl
// RUN: %clangxx %s -o %t1.out -lsycl -I %sycl_include -Wno-sycl-strict -Xclang -verify-ignore-unexpected=note,warning
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t2.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t2.out
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/property_list.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %s -o %t.out -lsycl
// RUN: %clangxx %s -o %t.out -lsycl -I%sycl_include
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
//
// CHECK: PASSED
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/range_ctad.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//==--------------- range_ctad.cpp - SYCL range CTAD test ----------------------==//
//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/range_error.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -Xclang -verify %s -Xclang -verify-ignore-unexpected=note,warning -fsyntax-only
// RUN: %clangxx -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning -fsyntax-only
//==--------------- range_error.cpp - SYCL range error test ----------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
6 changes: 3 additions & 3 deletions sycl/test/basic_tests/valid_kernel_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
//===----------------------------------------------------------------------===//

// The test checks that the types can be used to pass kernel parameters by value
// RUN: %clangxx -fsyntax-only %s
// RUN: %clangxx -fsyntax-only %s -I %sycl_include -Wno-sycl-strict -Xclang -verify-ignore-unexpected=note,warning

// Check that the test can be compiled with device compiler as well.
// RUN: %clangxx -fsycl-device-only -fsyntax-only %s
// RUN: %clangxx -fsycl-device-only -fsyntax-only %s -I %sycl_include -Wno-sycl-strict

#include <CL/sycl.hpp>

Expand All @@ -33,4 +33,4 @@ struct SomeStructure {
CHECK_PASSING_TO_KERNEL_BY_VALUE(int)
CHECK_PASSING_TO_KERNEL_BY_VALUE(cl::sycl::cl_uchar4)
CHECK_PASSING_TO_KERNEL_BY_VALUE(SomeStructure)
#endif
#endif
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/vectors/ctad.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s
// RUN: %clangxx -std=c++17 -I %sycl_include -fsyntax-only -Xclang -verify %s -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//==--------------- ctad.cpp - SYCL vector CTAD test --------------------==//
//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/vectors/ctad_fail.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected %s
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected
//==--------------- ctad.cpp - SYCL vector CTAD fail test ------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/vectors/vectors.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %s -o %t.out -lsycl
// RUN: %clangxx %s -o %t.out -lsycl -I %sycl_include
// RUN: %t.out
//==--------------- vectors.cpp - SYCL vectors test ------------------------==//
//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/check_device_code/kernel_arguments_as.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl-device-only -Xclang -fsycl-is-device -emit-llvm %s -S -o %t.ll
// RUN: %clangxx -fsycl-device-only -Xclang -fsycl-is-device -emit-llvm %s -S -o %t.ll -I %sycl_include -Wno-sycl-strict -Xclang -verify-ignore-unexpected=note,warning
// RUN: FileCheck %s --input-file %t.ll
//
// Check the address space of the pointer in accessor class.
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/kernel_from_file/hw.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-fsycl-targets=%sycl_triple
// RUN: %clangxx -fsycl-device-only -fno-sycl-use-bitcode -Xclang -fsycl-int-header=%t.h -c %s -o %t.spv
// RUN: %clangxx -include %t.h -g %s -o %t.out -lsycl
// RUN: %clangxx -fsycl-device-only -fno-sycl-use-bitcode -Xclang -fsycl-int-header=%t.h -c %s -o %t.spv -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning -Wno-sycl-strict
// RUN: %clangxx -include %t.h -g %s -o %t.out -lsycl -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
// RUN: env SYCL_USE_KERNEL_SPV=%t.spv %t.out | FileCheck %s
// CHECK: Passed

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/multi_ptr/ctad.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//==--------------- ctad.cpp - SYCL multi_ptr CTAD test --------------------==//
//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/constexpr-fp16-numeric-limits.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl-device-only -fsyntax-only -Xclang -verify %s
// RUN: %clangxx -fsycl-device-only -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning -Wno-sycl-strict
// expected-no-diagnostics
#include <CL/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/macro_conflict.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsyntax-only -Xclang -verify %s -o %t.out
// RUN: %clangxx -fsyntax-only -I %sycl_include -Xclang -verify %s -o %t.out -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//
//===----------------------------------------------------------------------===//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/sub-group-store-const-ref.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -I %sycl_include -fsyntax-only -Xclang -verify %s
// RUN: %clangxx -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//
//==-- sub-group-store-const-ref.cpp ---------------------------------------==//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/unable-to-redeclare-device.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -I %sycl_include -fsyntax-only -Xclang -verify -DCL_TARGET_OPENCL_VERSION=220 %s
// RUN: %clangxx -fsyntax-only -Xclang -verify -DCL_TARGET_OPENCL_VERSION=220 %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//
//==-- unable-to-redeclare-device.cpp --------------------------------------==//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/vec-to-half.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang -O0 -fsyntax-only -Xclang -verify %s
// RUN: %clang -O0 -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics

#include <CL/sycl.hpp>
Expand Down
8 changes: 4 additions & 4 deletions sycl/test/separate-compile/test.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// >> ---- compile src1
// >> device compilation...
// RUN: %clangxx -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_a.h %s -c -o a_kernel.bc
// RUN: %clangxx -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_a.h %s -c -o a_kernel.bc -I %sycl_include -Wno-sycl-strict
// >> host compilation...
// RUN: %clangxx -include sycl_ihdr_a.h -g -c %s -o a.o
// RUN: %clangxx -include sycl_ihdr_a.h -g -c %s -o a.o -I %sycl_include -Wno-sycl-strict
//
// >> ---- compile src2
// >> device compilation...
// RUN: %clangxx -DB_CPP=1 -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_b.h %s -c -o b_kernel.bc
// RUN: %clangxx -DB_CPP=1 -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_b.h %s -c -o b_kernel.bc -I %sycl_include -Wno-sycl-strict
// >> host compilation...
// RUN: %clangxx -DB_CPP=1 -include sycl_ihdr_b.h -g -c %s -o b.o
// RUN: %clangxx -DB_CPP=1 -include sycl_ihdr_b.h -g -c %s -o b.o -I %sycl_include -Wno-sycl-strict
//
// >> ---- bundle .o with .spv
// >> run bundler
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/xmethods/accessors-device.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl-device-only -c -fno-color-diagnostics -Xclang -ast-dump %s | FileCheck %s
// RUN: %clangxx -fsycl-device-only -c -fno-color-diagnostics -Xclang -ast-dump %s -I %sycl_include -Wno-sycl-strict | FileCheck %s
// UNSUPPORTED: windows
#include <CL/sycl/accessor.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/xmethods/accessors.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -c -fno-color-diagnostics -Xclang -ast-dump %s | FileCheck %s
// RUN: %clangxx -c -fno-color-diagnostics -I %sycl_include -Xclang -ast-dump %s | FileCheck %s
// UNSUPPORTED: windows
#include <CL/sycl/accessor.hpp>

Expand Down