Skip to content

[SYCL][Driver] Disable "early" optimizations for Intel FPGA by default #2331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4103,8 +4103,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
false))
CmdArgs.push_back("-fsycl-explicit-simd");

// Default value for FPGA is false, for all other targets is true.
if (!Args.hasFlag(options::OPT_fsycl_early_optimizations,
options::OPT_fno_sycl_early_optimizations, true))
options::OPT_fno_sycl_early_optimizations,
Triple.getSubArch() != llvm::Triple::SPIRSubArch_fpga))
CmdArgs.push_back("-fno-sycl-early-optimizations");
else if (RawTriple.isSPIR()) {
// Set `sycl-opt` option to configure LLVM passes for SPIR target
Expand Down
10 changes: 7 additions & 3 deletions clang/test/Driver/sycl-device-optimizations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
// RUN: | FileCheck -check-prefix=CHECK-DEFAULT %s
// RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-DEFAULT %s
// RUN: %clang -### -fsycl -fintelfpga -fsycl-early-optimizations %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-DEFAULT %s
// CHECK-DEFAULT-NOT: "-fno-sycl-early-optimizations"
// CHECK-DEFAULT-NOT: "-disable-llvm-passes"

/// Check "-fno-sycl-early-optimizations" is passed to the front-end:
// RUN: %clang -### -fsycl -fno-sycl-early-optimizations %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-STD-OPTS %s
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-EARLY-OPTS %s
// RUN: %clang -### -fsycl -fsycl-device-only -fno-sycl-early-optimizations %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-STD-OPTS %s
// CHECK-NO-SYCL-STD-OPTS: "-fno-sycl-early-optimizations"
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-EARLY-OPTS %s
// RUN: %clang -### -fsycl -fintelfpga %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-EARLY-OPTS %s
// CHECK-NO-SYCL-EARLY-OPTS: "-fno-sycl-early-optimizations"