Skip to content

Commit 4676c35

Browse files
committed
Make flag a driver flag, not just cc1
Makes -fsycl-range-rounding= accessible to driver calls, not just cc1 invocations.
1 parent 8bb45ed commit 4676c35

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3997,6 +3997,21 @@ def fsycl_host_compiler_options_EQ : Joined<["-"], "fsycl-host-compiler-options=
39973997
Visibility<[ClangOption, CLOption, DXCOption]>, HelpText<"When performing the host compilation with "
39983998
"-fsycl-host-compiler specified, use the given options during that compile. "
39993999
"Options are expected to be a quoted list of space separated options.">;
4000+
def fsycl_range_rounding_EQ : Joined<["-"], "fsycl-range-rounding=">,
4001+
Visibility<[ClangOption, CLOption, DXCOption, CC1Option]>,
4002+
Values<"on,disable,force">,
4003+
NormalizedValuesScope<"LangOptions::SYCLRangeRoundingPreference">,
4004+
NormalizedValues<["On", "Disable", "Force"]>,
4005+
MarshallingInfoEnum<LangOpts<"SYCLRangeRounding">, "On">,
4006+
HelpText<"Options for range rounding of SYCL range kernels: "
4007+
"disable (do not generate range rounded kernels) "
4008+
"force (only generate range rounded kernels) "
4009+
"on (generate range rounded kernels as well as unrounded kernels). Default is 'on'">;
4010+
def fsycl_disable_range_rounding : Flag<["-"], "fsycl-disable-range-rounding">,
4011+
Visibility<[ClangOption, CLOption, DXCOption, CC1Option]>,
4012+
Alias<fsycl_range_rounding_EQ>, AliasArgs<["disable"]>,
4013+
HelpText<"Deprecated: please use -fsycl-range-rounding=disable instead.">,
4014+
Flags<[Deprecated]>;
40004015
def fno_sycl_use_footer : Flag<["-"], "fno-sycl-use-footer">, Visibility<[ClangOption, CLOption, DXCOption]>,
40014016
HelpText<"Disable usage of the integration footer during SYCL enabled "
40024017
"compilations.">;
@@ -8256,20 +8271,6 @@ defm sycl_allow_func_ptr: BoolFOption<"sycl-allow-func-ptr",
82568271
def fenable_sycl_dae : Flag<["-"], "fenable-sycl-dae">,
82578272
HelpText<"Enable Dead Argument Elimination in SPIR kernels">,
82588273
MarshallingInfoFlag<LangOpts<"EnableDAEInSpirKernels">>;
8259-
def fsycl_range_rounding_EQ : Joined<["-"], "fsycl-range-rounding=">,
8260-
Visibility<[ClangOption, CLOption, DXCOption]>,
8261-
Values<"on,disable,force">,
8262-
NormalizedValuesScope<"LangOptions::SYCLRangeRoundingPreference">,
8263-
NormalizedValues<["On", "Disable", "Force"]>,
8264-
MarshallingInfoEnum<LangOpts<"SYCLRangeRounding">, "On">,
8265-
HelpText<"Options for range rounding of SYCL range kernels: "
8266-
"disable (do not generate range rounded kernels) "
8267-
"force (only generate range rounded kernels) "
8268-
"on (generate range rounded kernels as well as unrounded kernels). Default is 'on'">;
8269-
def fsycl_disable_range_rounding : Flag<["-"], "fsycl-disable-range-rounding">,
8270-
Alias<fsycl_range_rounding_EQ>, AliasArgs<["disable"]>,
8271-
HelpText<"Deprecated: please use -fsycl-range-rounding=disable instead.">,
8272-
Flags<[Deprecated]>;
82738274
def fsycl_enable_int_header_diags: Flag<["-"], "fsycl-enable-int-header-diags">,
82748275
HelpText<"Enable diagnostics that require the SYCL integration header.">,
82758276
MarshallingInfoFlag<LangOpts<"SYCLEnableIntHeaderDiags">>;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5427,6 +5427,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
54275427
options::OPT_fno_sycl_esimd_force_stateless_mem, true))
54285428
CmdArgs.push_back("-fno-sycl-esimd-force-stateless-mem");
54295429

5430+
if (Arg *A = Args.getLastArg(options::OPT_fsycl_range_rounding_EQ))
5431+
A->render(Args, CmdArgs);
5432+
54305433
// Add the Unique ID prefix
54315434
StringRef UniqueID = D.getSYCLUniqueID(Input.getBaseInput());
54325435
if (!UniqueID.empty())

clang/test/Driver/sycl-offload.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,19 @@
509509
// CHK-TOOLS-OPTS2: clang-offload-wrapper{{.*}} "-link-opts=-DFOO1 -DFOO2"
510510

511511
/// -fsycl-range-rounding settings
512+
///
513+
/// // Check that driver flag is passed to cc1
514+
// RUN: %clang -### -fsycl -fsycl-range-rounding=disable %s 2>&1 \
515+
// RUN: | FileCheck -check-prefix=CHK-DRIVER-RANGE-ROUNDING-DISABLE %s
516+
// RUN: %clang -### -fsycl -fsycl-range-rounding=force %s 2>&1 \
517+
// RUN: | FileCheck -check-prefix=CHK-DRIVER-RANGE-ROUNDING-FORCE %s
518+
// RUN: %clang -### -fsycl -fsycl-range-rounding=on %s 2>&1 \
519+
// RUN: | FileCheck -check-prefix=CHK-DRIVER-RANGE-ROUNDING-ON %s
520+
// CHK-DRIVER-RANGE-ROUNDING-DISABLE: "-cc1{{.*}}-fsycl-range-rounding=disable"
521+
// CHK-DRIVER-RANGE-ROUNDING-FORCE: "-cc1{{.*}}-fsycl-range-rounding=force"
522+
// CHK-DRIVER-RANGE-ROUNDING-ON: "-cc1{{.*}}-fsycl-range-rounding=on"
523+
///
524+
///
512525
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl \
513526
// RUN: -fsycl-targets=spir64 -O0 %s 2>&1 \
514527
// RUN: | FileCheck -check-prefix=CHK-DISABLE-RANGE-ROUNDING %s

sycl/test-e2e/Basic/parallel_for_range_roundup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: gpu
2-
// RUN: %{build} -Xclang -fsycl-range-rounding=disable -o %t.out
2+
// RUN: %{build} -fsycl-range-rounding=disable -o %t.out
33
// RUN: env SYCL_PARALLEL_FOR_RANGE_ROUNDING_TRACE=1 %{run} %t.out | FileCheck %s --check-prefix=CHECK-DEFAULT
44

5-
// RUN: %{build} -Xclang -fsycl-range-rounding=force -o %t.out
5+
// RUN: %{build} -fsycl-range-rounding=force -o %t.out
66
// RUN: env SYCL_PARALLEL_FOR_RANGE_ROUNDING_TRACE=1 %{run} %t.out | FileCheck %s --check-prefix=CHECK-DEFAULT
77

88
// These tests test 3 things:

0 commit comments

Comments
 (0)