Skip to content

Commit f9b664a

Browse files
committed
[SYCL][Driver] Add off value for device code split option
This will help disable device code split if some previous option enabled it. Signed-off-by: Mariya Podchishchaeva <[email protected]>
1 parent a339d4c commit f9b664a

File tree

3 files changed

+303
-3
lines changed

3 files changed

+303
-3
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,8 +1821,8 @@ def fsycl_link_targets_EQ : CommaJoined<["-"], "fsycl-link-targets=">, Flags<[Dr
18211821
HelpText<"Specify comma-separated list of triples SYCL offloading targets to produce linked device images">;
18221822
def fsycl_device_code_split_EQ : Joined<["-"], "fsycl-device-code-split=">,
18231823
Flags<[CC1Option, CoreOption]>, HelpText<"Perform SYCL device code split: per_kernel (device code module is "
1824-
"created for each SYCL kernel) | per_source (device code module is created for each source (translation unit)). "
1825-
"Default is no device code split - all kernels go into a single module`">, Values<"per_source,per_kernel">;
1824+
"created for each SYCL kernel) | per_source (device code module is created for each source (translation unit)) | off (no device code split). "
1825+
"Default is 'off' - all kernels go into a single module`">, Values<"per_source, per_kernel, off">;
18261826
def fsycl_device_code_split : Flag<["-"], "fsycl-device-code-split">, Alias<fsycl_device_code_split_EQ>,
18271827
AliasArgs<["per_source"]>, Flags<[CC1Option, CoreOption]>,
18281828
HelpText<"Perform SYCL device code split in the per_source mode i.e. create a device code module for each source (translation unit)">;

clang/lib/Driver/Driver.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3575,7 +3575,10 @@ class OffloadingActionBuilder final {
35753575
Arg *SYCLLinkTargets = Args.getLastArg(
35763576
options::OPT_fsycl_link_targets_EQ);
35773577
WrapDeviceOnlyBinary = Args.hasArg(options::OPT_fsycl_link_EQ);
3578-
DeviceCodeSplit = Args.hasArg(options::OPT_fsycl_device_code_split);
3578+
auto *DeviceCodeSplitArg =
3579+
Args.getLastArg(options::OPT_fsycl_device_code_split_EQ);
3580+
DeviceCodeSplit = DeviceCodeSplitArg &&
3581+
DeviceCodeSplitArg->getValue() != StringRef("off");
35793582
// Device only compilation for -fsycl-link (no FPGA) and
35803583
// -fsycl-link-targets
35813584
CompileDeviceOnly =

0 commit comments

Comments
 (0)