Skip to content

Commit 8f61479

Browse files
add arch to the input file to the sycl-post-link; next step is to add test for this feature
1 parent 0e6bab6 commit 8f61479

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,14 +723,19 @@ runSYCLPostLinkTool(ArrayRef<StringRef> InputFiles, const ArgList &Args) {
723723
return SYCLPostLinkPath.takeError();
724724

725725
// Create a new file to write the output of sycl-post-link to.
726+
const llvm::Triple Triple(Args.getLastArgValue(OPT_triple_EQ));
726727
auto TempFileOrErr =
727728
createOutputFile(sys::path::filename(ExecutableName), "table");
728729
if (!TempFileOrErr)
729730
return TempFileOrErr.takeError();
731+
std::string OutputPathWithArch = TempFileOrErr->str();
732+
StringRef Arch = Args.getLastArgValue(OPT_arch_EQ);
733+
if (Triple.getSubArch() == llvm::Triple::SPIRSubArch_gen && Arch.data()) {
734+
std::string OutputPathWithArch = "intel_gpu_" + Arch.str() + "," + OutputPathWithArch;
735+
}
730736

731737
SmallVector<StringRef, 8> CmdArgs;
732738
CmdArgs.push_back(*SYCLPostLinkPath);
733-
const llvm::Triple Triple(Args.getLastArgValue(OPT_triple_EQ));
734739
Arg *SYCLDeviceLibLoc = Args.getLastArg(OPT_sycl_device_library_location_EQ);
735740
if (SYCLDeviceLibLoc && !Triple.isSPIRAOT()) {
736741
std::string SYCLDeviceLibLocParam = SYCLDeviceLibLoc->getValue();
@@ -748,7 +753,7 @@ runSYCLPostLinkTool(ArrayRef<StringRef> InputFiles, const ArgList &Args) {
748753
SYCLPostLinkOptions.split(CmdArgs, " ", /* MaxSplit = */ -1,
749754
/* KeepEmpty = */ false);
750755
CmdArgs.push_back("-o");
751-
CmdArgs.push_back(*TempFileOrErr);
756+
CmdArgs.push_back(Args.MakeArgString(OutputPathWithArch));
752757
for (auto &File : InputFiles)
753758
CmdArgs.push_back(File);
754759
if (Error Err = executeCommands(*SYCLPostLinkPath, CmdArgs))

sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-1.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@
1717
// UNSUPPORTED: cuda, hip
1818
// UNSUPPORTED-INTENDED: FP64 emulation is an Intel specific feature.
1919

20-
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu --no-offload-new-driver %O0 %s -o %t.out
20+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu %O0 %s -o %t.out
2121
// RUN: %{run} %t.out
2222

23-
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu --offload-new-driver %O0 %s -o %t.out
24-
// RUN: %{run} %t.out
25-
26-
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu --offload-new-driver -g %O0 %s -o %t.out
23+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu -g %O0 %s -o %t.out
2724
// RUN: %{run} %t.out
2825

2926
// Tests that aspect::fp64 is not emitted correctly when -fsycl-fp64-conv-emu

sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
// UNSUPPORTED: cuda, hip
2121
// UNSUPPORTED-INTENDED: FP64 emulation is an Intel specific feature.
2222

23-
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu --no-offload-new-driver %O0 %s -o %t.out
23+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu %O0 %s -o %t.out
2424
// RUN: %{run} %t.out
2525

26-
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu --offload-new-driver %O0 %s -o %t.out
27-
// RUN: %{run} %t.out
28-
29-
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu --offload-new-driver -g %O0 %s -o %t.out
26+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,intel_gpu_dg2_g11,intel_gpu_dg2_g12,intel_gpu_pvc,intel_gpu_mtl_h,intel_gpu_mtl_u -fsycl-fp64-conv-emu -g %O0 %s -o %t.out
3027
// RUN: %{run} %t.out
3128

3229
#include <sycl/detail/core.hpp>

0 commit comments

Comments
 (0)