Skip to content

Commit 5f96480

Browse files
authored
Merge branch 'intel:sycl' into buf-test-fix
2 parents 051edd5 + e1f0d50 commit 5f96480

File tree

210 files changed

+1758
-2299
lines changed

Some content is hidden

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

210 files changed

+1758
-2299
lines changed

.github/workflows/ur-build-hw.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
127127
- name: Download DPC++
128128
run: |
129-
wget -O dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2024-12-12/sycl_linux.tar.gz
129+
wget -O dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2025-11-28/sycl_linux.tar.gz
130130
mkdir -p dpcpp_compiler
131131
tar -xvf dpcpp_compiler.tar.gz -C dpcpp_compiler
132132

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10023,6 +10023,26 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1002310023
// object that is fed to the linker from the wrapper generated bc file
1002410024
assert(isa<OffloadWrapperJobAction>(JA) && "Expecting wrapping job!");
1002510025

10026+
// Validate and propogate CLI options related to device image compression
10027+
// and enabling preview breaking changes.
10028+
auto addCLIOptions = [&](ArgStringList &Args) -> void {
10029+
// -offload-compress
10030+
if (C.getInputArgs().hasFlag(options::OPT_offload_compress,
10031+
options::OPT_no_offload_compress, false)) {
10032+
Args.push_back(C.getArgs().MakeArgString(Twine("-offload-compress")));
10033+
// -offload-compression-level=<>
10034+
if (Arg *A = C.getInputArgs().getLastArg(
10035+
options::OPT_offload_compression_level_EQ))
10036+
Args.push_back(C.getArgs().MakeArgString(
10037+
Twine("-offload-compression-level=") + A->getValue()));
10038+
}
10039+
// Enable preview breaking changes in clang-offload-wrapper,
10040+
// in case it needs to introduce any ABI breaking changes.
10041+
// For example, changes in offload binary descriptor format.
10042+
if (C.getArgs().hasArg(options::OPT_fpreview_breaking_changes))
10043+
Args.push_back("-fpreview-breaking-changes");
10044+
};
10045+
1002610046
Action::OffloadKind OffloadingKind = JA.getOffloadingDeviceKind();
1002710047
if (OffloadingKind == Action::OFK_SYCL) {
1002810048
// The wrapper command looks like this:
@@ -10054,18 +10074,7 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1005410074
llvm::Triple TT = getToolChain().getTriple();
1005510075
SmallString<128> TargetTripleOpt = TT.getArchName();
1005610076

10057-
// Validate and propogate CLI options related to device image compression.
10058-
// -offload-compress
10059-
if (C.getInputArgs().getLastArg(options::OPT_offload_compress)) {
10060-
WrapperArgs.push_back(
10061-
C.getArgs().MakeArgString(Twine("-offload-compress")));
10062-
// -offload-compression-level=<>
10063-
if (Arg *A = C.getInputArgs().getLastArg(
10064-
options::OPT_offload_compression_level_EQ))
10065-
WrapperArgs.push_back(C.getArgs().MakeArgString(
10066-
Twine("-offload-compression-level=") + A->getValue()));
10067-
}
10068-
10077+
addCLIOptions(WrapperArgs);
1006910078
addRunTimeWrapperOpts(C, OffloadingKind, TCArgs, WrapperArgs,
1007010079
getToolChain(), JA);
1007110080

@@ -10095,12 +10104,6 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1009510104
WrapperArgs.push_back(
1009610105
C.getArgs().MakeArgString(Twine("-kind=") + Twine(Kind)));
1009710106

10098-
// Enable preview breaking changes in clang-offload-wrapper,
10099-
// in case it needs to introduce any ABI breaking changes.
10100-
// For example, changes in offload binary descriptor format.
10101-
if (C.getArgs().hasArg(options::OPT_fpreview_breaking_changes))
10102-
WrapperArgs.push_back("-fpreview-breaking-changes");
10103-
1010410107
assert((Inputs.size() > 0) && "no inputs for clang-offload-wrapper");
1010510108
assert(((Inputs[0].getType() != types::TY_Tempfiletable) ||
1010610109
(Inputs.size() == 1)) &&
@@ -10168,19 +10171,8 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1016810171
"Not have inputs for all dependence actions??");
1016910172

1017010173
if (OffloadingKind == Action::OFK_None &&
10171-
C.getArgs().hasArg(options::OPT_fsycl_link_EQ)) {
10172-
10173-
// When compiling and linking separately, we need to propagate the
10174-
// compression related CLI options to offload-wrapper.
10175-
if (C.getInputArgs().getLastArg(options::OPT_offload_compress)) {
10176-
CmdArgs.push_back(C.getArgs().MakeArgString(Twine("-offload-compress")));
10177-
// -offload-compression-level=<>
10178-
if (Arg *A = C.getInputArgs().getLastArg(
10179-
options::OPT_offload_compression_level_EQ))
10180-
CmdArgs.push_back(C.getArgs().MakeArgString(
10181-
Twine("-offload-compression-level=") + A->getValue()));
10182-
}
10183-
}
10174+
C.getArgs().hasArg(options::OPT_fsycl_link_EQ))
10175+
addCLIOptions(CmdArgs);
1018410176

1018510177
// Add offload targets and inputs.
1018610178
for (unsigned I = 0; I < Inputs.size(); ++I) {

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,10 @@ const char *SYCLInstallationDetector::findLibspirvPath(
6464

6565
const SmallString<64> Basename =
6666
getLibSpirvBasename(DeviceTriple, HostTriple);
67-
auto searchAt = [&](StringRef Path, const Twine &a = "", const Twine &b = "",
68-
const Twine &c = "") -> const char * {
69-
SmallString<128> LibraryPath(Path);
70-
llvm::sys::path::append(LibraryPath, a, b, c, Basename);
71-
72-
if (D.getVFS().exists(LibraryPath))
73-
return Args.MakeArgString(LibraryPath);
74-
75-
return nullptr;
76-
};
77-
78-
for (const auto &IC : InstallationCandidates) {
79-
// Expected path w/out install.
80-
if (const char *R = searchAt(IC, "lib", "clc"))
81-
return R;
82-
83-
// Expected path w/ install.
84-
if (const char *R = searchAt(IC, "share", "clc"))
85-
return R;
86-
}
67+
SmallString<256> LibclcPath(D.ResourceDir);
68+
llvm::sys::path::append(LibclcPath, "lib", "libclc", Basename);
69+
if (D.getVFS().exists(LibclcPath))
70+
return Args.MakeArgString(LibclcPath);
8771

8872
return nullptr;
8973
}

clang/test/Driver/Inputs/SYCL/bin/.gitkeep

Whitespace-only changes.

clang/test/Driver/sycl-cuda-rdc.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
// UNSUPPORTED: system-windows
66

7-
// RUN: %clangxx -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend --cuda-gpu-arch=sm_61 -fgpu-rdc -nocudalib -fsycl-libspirv-path=%S/Inputs/SYCL/share/clc/remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc %s 2>&1 \
7+
// RUN: %clangxx -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend --cuda-gpu-arch=sm_61 -fgpu-rdc -nocudalib \
8+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/lib/clang/resource_dir/lib/libclc/remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc %s 2>&1 \
89
// RUN: | FileCheck %s -check-prefix=CHECK-SYCL_RDC_NVPTX
910

1011
// Verify that ptxas does not pass "-c"

clang/test/Driver/sycl-device-obj-asm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030

3131
/// -fsycl-device-obj=asm should always be accompanied by -fsycl-device-only
3232
/// and -S, check that the compiler issues a correct warning message:
33-
// RUN: %clang -### -nocudalib -fsycl-device-only -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_50 -fsycl-device-obj=asm %s 2>&1 -o - -fsycl-libspirv-path=%S/Inputs/SYCL/share/clc/remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc | FileCheck %s --check-prefix=CHECK-NO-DEV-ONLY-NO-S
33+
// RUN: %clang -### -nocudalib -fsycl-device-only -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_50 -fsycl-device-obj=asm %s 2>&1 -o - -fsycl-libspirv-path=%S/Inputs/SYCL/lib/clang/resource_dir/lib/libclc/remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc | FileCheck %s --check-prefix=CHECK-NO-DEV-ONLY-NO-S
3434
// CHECK-NO-DEV-ONLY-NO-S: warning: -fsycl-device-obj=asm flag has an effect only when compiling device code and emitting assembly, make sure both -fsycl-device-only and -S flags are present; will be ignored [-Wunused-command-line-argument]
3535

3636
/// -fsycl-device-obj=asm will finish at generating assembly stage, hence
3737
/// inform users that generating library will not be possible (ignore -c)
38-
// RUN: %clang -### -nocudalib -fsycl-device-only -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_50 -fsycl-device-obj=asm %s 2>&1 -fsycl-device-only -S -c -o - -fsycl-libspirv-path=%S/Inputs/SYCL/share/clc/remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc | FileCheck %s --check-prefix=CHECK-DASH-C-IGNORE
38+
// RUN: %clang -### -nocudalib -fsycl-device-only -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_50 -fsycl-device-obj=asm %s 2>&1 -fsycl-device-only -S -c -o - -fsycl-libspirv-path=%S/Inputs/SYCL/lib/clang/resource_dir/lib/libclc/remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc | FileCheck %s --check-prefix=CHECK-DASH-C-IGNORE
3939
// CHECK-DASH-C-IGNORE: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]

0 commit comments

Comments
 (0)