Skip to content

Commit b6b01b4

Browse files
authored
[Driver][SYCL] Add support for -ftarget-compile-fast (#8995)
Adds support for -ftarget-compile-fast, which is used with offloading target compilations for spir64_gen. This enables additional igc options which can improve compile time. For JIT, use of environment variables is needed as option passing does not look to be supported at this time.
1 parent e83e16d commit b6b01b4

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,6 +3087,9 @@ def fsycl_max_parallel_jobs_EQ : Joined<["-"], "fsycl-max-parallel-link-jobs=">,
30873087
HelpText<"Experimental feature: Controls the maximum parallelism of actions performed "
30883088
"on SYCL device code post-link, i.e. the generation of SPIR-V device images "
30893089
"or AOT compilation of each device image.">;
3090+
def ftarget_compile_fast : Flag<["-"], "ftarget-compile-fast">,
3091+
Flags<[CoreOption]>, HelpText<"Experimental feature: Reduce target "
3092+
"compilation time, with potential runtime performance trade-off.">;
30903093
def : Flag<["-"], "fsycl-rdc">, Flags<[CoreOption]>, Alias<fgpu_rdc>;
30913094
def : Flag<["-"], "fno-sycl-rdc">, Flags<[CoreOption]>, Alias<fno_gpu_rdc>;
30923095
def fsycl_optimize_non_user_code : Flag<["-"], "fsycl-optimize-non-user-code">,

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,11 @@ void SYCLToolChain::AddImpliedTargetArgs(const llvm::Triple &Triple,
977977
CmdArgs.push_back("-device");
978978
CmdArgs.push_back(Args.MakeArgString(DepInfo));
979979
}
980+
// -ftarget-compile-fast
981+
if (Args.hasArg(options::OPT_ftarget_compile_fast)) {
982+
BeArgs.push_back(
983+
"\"-igc_opts PartitionUnit=1,SubroutineThreshold=50000\"");
984+
}
980985
}
981986
if (BeArgs.empty())
982987
return;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Test -ftarget-compile-fast behaviors
2+
3+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl \
4+
// RUN: -fsycl-targets=spir64_gen -ftarget-compile-fast %s 2>&1 \
5+
// RUN: | FileCheck -check-prefix=TARGET_COMPILE_FAST_GEN %s
6+
// RUN: %clang_cl -### --target=x86_64-pc-windows-msvc -fsycl \
7+
// RUN: -fsycl-targets=spir64_gen -ftarget-compile-fast %s 2>&1 \
8+
// RUN: | FileCheck -check-prefix=TARGET_COMPILE_FAST_GEN %s
9+
10+
// TARGET_COMPILE_FAST_GEN: ocloc{{.*}} "-output"
11+
// TARGET_COMPILE_FAST_GEN: "-options" "{{.*}}-igc_opts PartitionUnit=1,SubroutineThreshold=50000{{.*}}"

0 commit comments

Comments
 (0)