Skip to content
Closed
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
4 changes: 2 additions & 2 deletions clang/include/clang/Driver/SyclInstallationDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class SYCLInstallationDetector {
void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;

// Return the filesystem path to the SYCL runtime library (libsycl.so), that
// was detected.
// Return the filesystem path to the SYCL runtime library (libLLVMSYCL.so),
// that was detected.
StringRef getSYCLRTLibPath() const { return SYCLRTLibPath; }
void print(llvm::raw_ostream &OS) const;

Expand Down
3 changes: 2 additions & 1 deletion clang/lib/Driver/ToolChains/Linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,8 @@ void Linux::addOffloadRTLibs(unsigned ActiveKinds, const ArgList &Args,
if (ActiveKinds & Action::OFK_HIP)
Libraries.emplace_back(RocmInstallation->getLibPath(), "libamdhip64.so");
else if (ActiveKinds & Action::OFK_SYCL)
Libraries.emplace_back(SYCLInstallation->getSYCLRTLibPath(), "libsycl.so");
Libraries.emplace_back(SYCLInstallation->getSYCLRTLibPath(),
"libLLVMSYCL.so");

for (auto [Path, Library] : Libraries) {
if (Args.hasFlag(options::OPT_frtlib_add_rpath,
Expand Down
10 changes: 6 additions & 4 deletions clang/lib/Driver/ToolChains/SYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ SYCLInstallationDetector::SYCLInstallationDetector(
const Driver &D, const llvm::Triple &HostTriple,
const llvm::opt::ArgList &Args)
: D(D), InstallationCandidates() {
// Detect the presence of the SYCL runtime library (libsycl.so) in the
// Detect the presence of the SYCL runtime library (libLLVMSYCL.so) in the
// filesystem. This is used to determine whether a usable SYCL installation
// is available for the current driver invocation.
StringRef SysRoot = D.SysRoot;
SmallString<128> DriverDir(D.Dir);
SmallString<128> LibPath(DriverDir);
llvm::sys::path::append(LibPath, "..", "lib", HostTriple.str(),
"libLLVMSYCL.so");
if (DriverDir.starts_with(SysRoot) &&
(Args.hasArg(options::OPT_fsycl) ||
D.getVFS().exists(DriverDir + "/../lib/libsycl.so"))) {
llvm::sys::path::append(DriverDir, "..", "lib");
(Args.hasArg(options::OPT_fsycl) || D.getVFS().exists(LibPath))) {
llvm::sys::path::append(DriverDir, "..", "lib", HostTriple.str());
SYCLRTLibPath = DriverDir;
}
InstallationCandidates.emplace_back(D.Dir + "/..");
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/link-device-code.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# RUN: llvm-as %S/Inputs/SYCL/foo.ll -o %t.foo.bc
# RUN: llvm-as %S/Inputs/SYCL/bar.ll -o %t.bar.bc
# RUN: llvm-as %S/Inputs/SYCL/baz.ll -o %t.baz.bc
# RUN: llvm-as %S/Inputs/SYCL/libsycl.ll -o %t.libsycl.bc
# RUN: llvm-as %S/Inputs/SYCL/libLLVMSYCL.ll -o %t.libLLVMSYCL.bc
# RUN: clang-sycl-linker %t.foo.bc %t.bar.bc -triple=spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-SIMPLE

# RUN: not clang-sycl-linker %t.bar.bc %t.baz.bc -triple=spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-MULTIPLE-DEFS

# RUN: clang-sycl-linker %t.foo.bc %t.bar.bc -device-libs=%t.libsycl.bc -library-path= -triple=spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-DEVICE-LIB
# RUN: clang-sycl-linker %t.foo.bc %t.bar.bc -device-libs=%t.libLLVMSYCL.bc -library-path= -triple=spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-DEVICE-LIB

; CHECK-SIMPLE: define {{.*}}foo_func1{{.*}}
; CHECK-SIMPLE: define {{.*}}foo_func2{{.*}}
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/sycl-offload-jit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
// CHK-DEVICE-TRIPLE-SAME: "-O2"
// CHK-DEVICE-TRIPLE: llvm-offload-binary{{.*}} "--image=file={{.*}}.bc,triple=spir64-unknown-unknown,arch=generic,kind=sycl{{.*}}"

// Check if path to libsycl.so is passed to clang-linker-wrapper tool by default for SYCL compilation.
// Check if path to libLLVMSYCL.so is passed to clang-linker-wrapper tool by default for SYCL compilation.
// The test also checks if SYCL header include paths are added to the SYCL host and device compilation.
// INTEL-RUN: %clang --offload-new-driver -### --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \
// RUN: | FileCheck -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s
// CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include"
// CHECK-SYCL-HEADERS-HOST: "-fsycl-is-host"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include"
// CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}libsycl.so"
// CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}x86_64-unknown-linux-gnu{{[/\\]+}}libLLVMSYCL.so"

/// Check -fsycl-is-device is passed when compiling for the device.
/// Check -fsycl-is-host is passed when compiling for host.
Expand Down