Skip to content

Commit f8902b8

Browse files
authored
[SYCL][Driver] Disable "early" optimizations for Intel FPGA by default (#2331)
Enabling standard LLVM passes for SPIR target by default might have negative impact on the metadata added specifically for Intel FPGA target. We might switch it back to "ON" by default after more thorough validation.
1 parent 5adfd79 commit f8902b8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4103,8 +4103,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
41034103
false))
41044104
CmdArgs.push_back("-fsycl-explicit-simd");
41054105

4106+
// Default value for FPGA is false, for all other targets is true.
41064107
if (!Args.hasFlag(options::OPT_fsycl_early_optimizations,
4107-
options::OPT_fno_sycl_early_optimizations, true))
4108+
options::OPT_fno_sycl_early_optimizations,
4109+
Triple.getSubArch() != llvm::Triple::SPIRSubArch_fpga))
41084110
CmdArgs.push_back("-fno-sycl-early-optimizations");
41094111
else if (RawTriple.isSPIR()) {
41104112
// Set `sycl-opt` option to configure LLVM passes for SPIR target

clang/test/Driver/sycl-device-optimizations.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
// RUN: | FileCheck -check-prefix=CHECK-DEFAULT %s
44
// RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \
55
// RUN: | FileCheck -check-prefix=CHECK-DEFAULT %s
6+
// RUN: %clang -### -fsycl -fintelfpga -fsycl-early-optimizations %s 2>&1 \
7+
// RUN: | FileCheck -check-prefix=CHECK-DEFAULT %s
68
// CHECK-DEFAULT-NOT: "-fno-sycl-early-optimizations"
79
// CHECK-DEFAULT-NOT: "-disable-llvm-passes"
810

911
/// Check "-fno-sycl-early-optimizations" is passed to the front-end:
1012
// RUN: %clang -### -fsycl -fno-sycl-early-optimizations %s 2>&1 \
11-
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-STD-OPTS %s
13+
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-EARLY-OPTS %s
1214
// RUN: %clang -### -fsycl -fsycl-device-only -fno-sycl-early-optimizations %s 2>&1 \
13-
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-STD-OPTS %s
14-
// CHECK-NO-SYCL-STD-OPTS: "-fno-sycl-early-optimizations"
15+
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-EARLY-OPTS %s
16+
// RUN: %clang -### -fsycl -fintelfpga %s 2>&1 \
17+
// RUN: | FileCheck -check-prefix=CHECK-NO-SYCL-EARLY-OPTS %s
18+
// CHECK-NO-SYCL-EARLY-OPTS: "-fno-sycl-early-optimizations"

0 commit comments

Comments
 (0)