Skip to content

Commit 31f4aef

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into llvmspirv_pulldown
2 parents b52628e + 20b247c commit 31f4aef

File tree

184 files changed

+2441
-1357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+2441
-1357
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5288,19 +5288,13 @@ static void ProcessVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
52885288
// Add SYCL dependent library
52895289
if (Args.hasArg(options::OPT_fsycl) &&
52905290
!Args.hasArg(options::OPT_nolibsycl)) {
5291-
if (RTOptionID == options::OPT__SLASH_MDd) {
5292-
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
5293-
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION
5294-
"-previewd");
5295-
else
5296-
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION "d");
5297-
} else {
5298-
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
5299-
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION
5300-
"-preview");
5301-
else
5302-
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION);
5303-
}
5291+
SmallString<128> SYCLLibName("sycl" SYCL_MAJOR_VERSION);
5292+
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
5293+
SYCLLibName += "-preview";
5294+
if (RTOptionID == options::OPT__SLASH_MDd)
5295+
SYCLLibName += "d";
5296+
CmdArgs.push_back(
5297+
Args.MakeArgString(Twine("--dependent-lib=") + SYCLLibName));
53045298
CmdArgs.push_back("--dependent-lib=sycl-devicelib-host");
53055299
}
53065300
}
@@ -6912,11 +6906,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
69126906
// Add the sycld debug library when --dependent-lib=msvcrtd is used from
69136907
// the command line. This is to allow for CMake based builds using the
69146908
// Linux based driver on Windows to correctly pull in the expected debug
6915-
// library.
6909+
// library. Do not add when -fms-runtime-lib is used, as that pulls in the
6910+
// libraries separately.
69166911
if (Args.hasArg(options::OPT_fsycl) && !Args.hasArg(options::OPT_nolibsycl) &&
69176912
!D.IsCLMode()) {
69186913
if (TC.getTriple().isWindowsMSVCEnvironment()) {
6919-
if (isDependentLibAdded(Args, "msvcrtd")) {
6914+
if (isDependentLibAdded(Args, "msvcrtd") &&
6915+
!Args.hasArg(options::OPT_fms_runtime_lib_EQ)) {
69206916
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
69216917
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION
69226918
"-previewd");

clang/lib/Driver/ToolChains/Cuda.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,20 @@ void CudaToolChain::AddIAMCUIncludeArgs(const ArgList &Args,
11621162
HostTC.AddIAMCUIncludeArgs(Args, CC1Args);
11631163
}
11641164

1165+
llvm::SmallVector<ToolChain::BitCodeLibraryInfo, 12>
1166+
CudaToolChain::getDeviceLibs(
1167+
const llvm::opt::ArgList &DriverArgs,
1168+
const Action::OffloadKind DeviceOffloadingKind) const {
1169+
StringRef GpuArch = DriverArgs.getLastArgValue(options::OPT_march_EQ);
1170+
std::string LibDeviceFile = CudaInstallation.getLibDeviceFile(GpuArch);
1171+
if (LibDeviceFile.empty()) {
1172+
getDriver().Diag(diag::err_drv_no_cuda_libdevice) << GpuArch;
1173+
return {};
1174+
}
1175+
1176+
return {BitCodeLibraryInfo{LibDeviceFile}};
1177+
}
1178+
11651179
SanitizerMask CudaToolChain::getSupportedSanitizers() const {
11661180
// The CudaToolChain only supports sanitizers in the sense that it allows
11671181
// sanitizer arguments on the command line if they are supported by the host

clang/lib/Driver/ToolChains/Cuda.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ class LLVM_LIBRARY_VISIBILITY CudaToolChain : public NVPTXToolChain {
248248
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
249249
llvm::opt::ArgStringList &CC1Args) const override;
250250

251+
llvm::SmallVector<BitCodeLibraryInfo, 12>
252+
getDeviceLibs(const llvm::opt::ArgList &Args,
253+
const Action::OffloadKind DeviceOffloadingKind) const override;
254+
251255
SanitizerMask getSupportedSanitizers() const override;
252256

253257
VersionTuple

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,12 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
9999
Args.hasArg(options::OPT_fsycl_host_compiler_EQ)) {
100100
CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") +
101101
TC.getDriver().Dir + "/../lib"));
102-
// When msvcrtd is added via --dependent-lib, we add the sycld
103-
// equivalent. Do not add the -defaultlib as it conflicts.
104-
if (!isDependentLibAdded(Args, "msvcrtd")) {
102+
// When msvcrtd is added via --dependent-lib or -fms-runtime-lib=dll_dbg we
103+
// add the sycld equivalent. Do not add the -defaultlib as it conflicts.
104+
StringRef RuntimeVal;
105+
if (const Arg *A = Args.getLastArg(options::OPT_fms_runtime_lib_EQ))
106+
RuntimeVal = A->getValue();
107+
if (!isDependentLibAdded(Args, "msvcrtd") && RuntimeVal != "dll_dbg") {
105108
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
106109
CmdArgs.push_back("-defaultlib:sycl" SYCL_MAJOR_VERSION "-preview.lib");
107110
else

clang/test/CodeGenSYCL/spirv-builtins-addr-space.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// The opencl_global, opencl_local, and opencl_private attributes get turned
99
// into sycl_global, sycl_local and sycl_private address spaces by clang.
1010
//
11-
// XFAIL: windows
11+
// XFAIL: *
1212
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/19497
1313

1414
#include "Inputs/sycl.hpp"
File renamed without changes.

0 commit comments

Comments
 (0)