Skip to content

Commit 5b33029

Browse files
mendell27bader
authored andcommitted
[SYCL][Driver] Re-implement -reuse-exe for FPGA (#647)
Move the processing from clang++ to the aoc command, in order to ensure that the aocl-extract-aocx program can be located and removing the need for the 'aocl do' invocation. Remove the message and message group previously added. Signed-off-by: Mark Mendell <[email protected]>
1 parent d3d9d2c commit 5b33029

File tree

3 files changed

+5
-28
lines changed

3 files changed

+5
-28
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,4 @@ def warn_drv_libstdcxx_not_found : Warning<
480480
InGroup<DiagGroup<"stdlibcxx-not-found">>;
481481

482482
def err_drv_cannot_mix_options : Error<"cannot specify '%1' along with '%0'">;
483-
484-
def warn_drv_reuse_exe_file_not_found : Warning<
485-
"-reuse-exe file '%0' not found; ignored">, InGroup<IntelFPGA>;
486483
}

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -346,28 +346,8 @@ void SYCL::fpga::BackendCompiler::ConstructJob(Compilation &C,
346346
TranslateSYCLTargetArgs(C, Args, getToolChain(), CmdArgs);
347347
// Look for -reuse-exe=XX option
348348
if (Arg *A = Args.getLastArg(options::OPT_reuse_exe_EQ)) {
349-
StringRef reuse_exe = A->getValue();
350349
Args.ClaimAllArgs(options::OPT_reuse_exe_EQ);
351-
if (llvm::sys::fs::exists(reuse_exe)) {
352-
SmallString<128> ExecPath(getToolChain().GetProgramPath("aocl"));
353-
const char *Exec = C.getArgs().MakeArgString(ExecPath);
354-
ArgStringList ExtractArgs{"do", "aocl-extract-aocx", "-i"};
355-
ExtractArgs.push_back(C.getArgs().MakeArgString(reuse_exe));
356-
std::string TmpName = C.getDriver().GetTemporaryPath("reused-exe", "aocx");
357-
auto OutputFileName = C.addTempFile(C.getArgs().MakeArgString(TmpName));
358-
ExtractArgs.push_back("-o");
359-
ExtractArgs.push_back(OutputFileName);
360-
Command run_extract(JA, *this, Exec, ExtractArgs, None);
361-
const Command* failingCommand = nullptr;
362-
auto res = C.ExecuteCommand(run_extract, failingCommand);
363-
if (res == 0) {
364-
// We extracted the aocx file. Pass it to the aoc command.
365-
CmdArgs.push_back(Args.MakeArgString(Twine("-reuse-aocx=") + TmpName));
366-
}
367-
} else {
368-
const Driver &D = getToolChain().getDriver();
369-
D.Diag(clang::diag::warn_drv_reuse_exe_file_not_found) << reuse_exe;
370-
}
350+
CmdArgs.push_back(Args.MakeArgString(A->getAsString(Args)));
371351
}
372352

373353
SmallString<128> ExecPath(getToolChain().GetProgramPath("aoc"));

clang/test/Driver/sycl-offload-intelfpga.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@
8585
// CHK-FPGA-LINK-SRC: 15: clang-offload-wrapper, {14}, object, (device-sycl)
8686
// CHK-FPGA-LINK-SRC: 16: offload, "host-sycl (x86_64-unknown-linux-gnu)" {9}, "device-sycl (spir64_fpga-unknown-{{linux|windows}}-sycldevice)" {15}, archive
8787

88-
// -fintelfpga -reuse-exe tests
89-
// RUN: %clang++ -### -fsycl -fintelfpga %s -reuse-exe=does_not_exist 2>&1 \
88+
/// -fintelfpga with -reuse-exe=
89+
// RUN: touch %t.cpp
90+
// RUN: %clang++ -### -reuse-exe=testing -target x86_64-unknown-linux-gnu -fsycl -fintelfpga %t.cpp 2>&1 \
9091
// RUN: | FileCheck -check-prefixes=CHK-FPGA-REUSE-EXE %s
91-
// CHK-FPGA-REUSE-EXE: warning: -reuse-exe file 'does_not_exist' not found; ignored
92-
//
92+
// CHK-FPGA-REUSE-EXE: aoc{{.*}} "-o" {{.*}} "-sycl" {{.*}} "-reuse-exe=testing"
9393

9494
// TODO: SYCL specific fail - analyze and enable
9595
// XFAIL: windows-msvc

0 commit comments

Comments
 (0)