Skip to content

Commit bea72e6

Browse files
authored
[Driver][SYCL] Set default device code split mode to off for FPGA (#4893)
The Driver passes default device code split mode (-split=auto) to sycl-post-link when -fsycl-device-code-split is not set. This should not be applied for FPGA, because FPGA is using SYCL_EXTERNAL for some of their library configurations but auto device code split mode impacts this behavior. Signed-off-by: Qichao Gu qichao.gu@intel.com
1 parent 7431afa commit bea72e6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9037,8 +9037,9 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
90379037
addArgs(CmdArgs, TCArgs, {"-split=auto"});
90389038
else { // Device code split is off
90399039
}
9040-
} else {
9041-
// auto is the default split mode
9040+
} else if (getToolChain().getTriple().getArchName() != "spir64_fpga") {
9041+
// for FPGA targets, off is the default split mode,
9042+
// otherwise auto is the default split mode
90429043
addArgs(CmdArgs, TCArgs, {"-split=auto"});
90439044
}
90449045

clang/test/Driver/sycl-offload-with-split.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,16 @@
312312
// RUN: | FileCheck %s -check-prefixes=CHK-NO-SPLIT
313313
// CHK-NO-SPLIT-NOT: sycl-post-link{{.*}} -split{{.*}}
314314

315+
// Check no device code split mode is passed to sycl-post-link when -fsycl-device-code-split is not set and the target is FPGA
316+
// RUN: %clang -### -fsycl -fsycl-targets=spir64_fpga-unknown-unknown %s 2>&1 | FileCheck %s -check-prefixes=CHK-NO-SPLIT
317+
318+
// Check device code split mode is honored when -fsycl-device-code-split is set and the target is FPGA
319+
// RUN: %clang -### -fsycl -fsycl-device-code-split -fsycl-targets=spir64_fpga-unknown-unknown %s 2>&1 | FileCheck %s -check-prefixes=CHK-AUTO
320+
// RUN: %clang -### -fsycl -fsycl-device-code-split=auto -fsycl-targets=spir64_fpga-unknown-unknown %s 2>&1 | FileCheck %s -check-prefixes=CHK-AUTO
321+
// RUN: %clang -### -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=spir64_fpga-unknown-unknown %s 2>&1 | FileCheck %s -check-prefixes=CHK-ONE-KERNEL
322+
// RUN: %clang -### -fsycl -fsycl-device-code-split=per_source -fsycl-targets=spir64_fpga-unknown-unknown %s 2>&1 | FileCheck %s -check-prefixes=CHK-PER-SOURCE
323+
// RUN: %clang -### -fsycl -fsycl-device-code-split=off -fsycl-targets=spir64_fpga-unknown-unknown %s 2>&1 | FileCheck %s -check-prefixes=CHK-NO-SPLIT
324+
315325
// Check ESIMD device code split.
316326
// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s -check-prefixes=CHK-ESIMD-SPLIT
317327
// RUN: %clang_cl -### -fsycl %s 2>&1 | FileCheck %s -check-prefixes=CHK-ESIMD-SPLIT

0 commit comments

Comments
 (0)