Skip to content

Commit

Permalink
Pass -offload-lto instead of -lto for cuda/hip kernels and enable fai…
Browse files Browse the repository at this point in the history
…led tests
  • Loading branch information
omarahmed1111 committed Jan 13, 2025
1 parent 1a7e2f0 commit d24ae0e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
7 changes: 5 additions & 2 deletions clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1533,14 +1533,17 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, const ArgList &Args,
};

// Forward all of the `--offload-opt` and similar options to the device.
CmdArgs.push_back("-flto");
for (auto &Arg : Args.filtered(OPT_offload_opt_eq_minus, OPT_mllvm))
CmdArgs.append(
{"-Xlinker",
Args.MakeArgString("--plugin-opt=" + StringRef(Arg->getValue()))});

if (!Triple.isNVPTX() && !Triple.isSPIRV())
if (Triple.isAMDGPU() || Triple.isNVPTX()) {
CmdArgs.push_back("-foffload-lto");
} else {
CmdArgs.push_back("-flto");
CmdArgs.push_back("-Wl,--no-undefined");
}

if (IsSYCLKind && Triple.isNVPTX())
CmdArgs.push_back("-S");
Expand Down
2 changes: 0 additions & 2 deletions sycl/test-e2e/NewOffloadDriver/multisource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// XFAIL: cuda
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/16413
// Separate kernel sources and host code sources
// Test with `--offload-new-driver`
// RUN: %{build} --offload-new-driver -c -o %t.kernel.o -DINIT_KERNEL -DCALC_KERNEL
Expand Down
3 changes: 0 additions & 3 deletions sycl/test-e2e/NewOffloadDriver/split-per-source-main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// RUN: %{build} -Wno-error=unused-command-line-argument -fsycl-device-code-split=per_source -I %S/Inputs -o %t.out %S/Inputs/split-per-source-second-file.cpp \
// RUN: --offload-new-driver -fsycl-dead-args-optimization
// RUN: %{run} %t.out
//
// XFAIL: cuda
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/16413

#include "Inputs/split-per-source.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// RUN: %{build} -DSOURCE2 --offload-new-driver -c -o %t2.o
// RUN: %clangxx -Wno-error=unused-command-line-argument -fsycl -fsycl-targets=%{sycl_triple} --offload-new-driver %t1.o %t2.o -o %t.exe
// RUN: %{run} %t.exe
// XFAIL: cuda
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/16413

#ifdef SOURCE1
#include <iostream>
Expand Down

0 comments on commit d24ae0e

Please sign in to comment.