Skip to content

Commit e09bb27

Browse files
committed
Corrections based on review feedback + fixes.
Adds back -fno-sycl as a noop. Removes the diagnostic about passing -sycl-std= but not -fsycl-is-device or -fsycl-is-host. Fixes several tests, but not all of them yet.
1 parent 2004883 commit e09bb27

File tree

9 files changed

+19
-35
lines changed

9 files changed

+19
-35
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ def err_drv_bad_fpga_device_count : Error<
137137
def err_drv_unsupported_opt_dpcpp : Error<"option '%0' unsupported with DPC++">;
138138
def err_drv_argument_only_allowed_with : Error<
139139
"invalid argument '%0' only allowed with '%1'">;
140-
// This diagnostic is useful when the argument is valid in combination with
141-
// more than one other option.
142-
def err_drv_argument_only_allowed_with_str : Error<
143-
"invalid argument '%0' only allowed with %1">;
144140
def err_drv_argument_not_allowed_with : Error<
145141
"invalid argument '%0' not allowed with '%1'">;
146142
def err_drv_invalid_version_number : Error<

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4267,8 +4267,10 @@ defm whole_file : BooleanFFlag<"whole-file">, Group<gfortran_Group>;
42674267
def reuse_exe_EQ : Joined<["-"], "reuse-exe=">, Flags<[CoreOption]>,
42684268
HelpText<"Speed up FPGA aoc compile if the device code in <exe> is unchanged.">,
42694269
MetaVarName<"<exe>">;
4270-
def fsycl : Flag<["-"], "fsycl">, Flags<[NoXarchOption]>, Group<sycl_Group>,
4271-
HelpText<"SYCL kernels compilation for device">;
4270+
def fsycl : Flag<["-"], "fsycl">, Flags<[NoXarchOption, CoreOption]>, Group<sycl_Group>,
4271+
HelpText<"Enables SYCL kernels compilation for device">;
4272+
def fno_sycl : Flag<["-"], "fno-sycl">, Flags<[NoXarchOption, CoreOption]>, Group<sycl_Group>,
4273+
HelpText<"Disables SYCL kernels compilation for device">;
42724274
def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
42734275
HelpText<"SYCL language standard to compile for.">, Values<"2020,2017,121,1.2.1,sycl-1.2.1">,
42744276
NormalizedValues<["SYCL_2020", "SYCL_2017", "SYCL_2017", "SYCL_2017", "SYCL_2017"]>, NormalizedValuesScope<"LangOptions">,

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,6 @@ static void FixupInvocation(CompilerInvocation &Invocation,
465465
Diags.Report(diag::err_drv_argument_not_allowed_with) << "-fsycl-is-device"
466466
<< "-fsycl-is-host";
467467

468-
// Prevent the user from passing -sycl-std= without enabling SYCLIsDevice or
469-
// SYCLIsHost.
470-
if (Args.hasArg(OPT_sycl_std_EQ) && !LangOpts.SYCLIsDevice &&
471-
!LangOpts.SYCLIsHost) {
472-
Diags.Report(diag::err_drv_argument_only_allowed_with_str)
473-
<< "-sycl-std="
474-
<< "'-fsycl-is-device' or '-fscyl-is-host'";
475-
}
476-
477468
if (Args.hasArg(OPT_fgnu89_inline) && LangOpts.CPlusPlus)
478469
Diags.Report(diag::err_drv_argument_not_allowed_with)
479470
<< "-fgnu89-inline" << GetInputKindName(IK);

clang/test/CodeGenSYCL/loop_unroll.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -disable-llvm-passes -fsycl-is-device -emit-llvm %s -o - | FileCheck %s
1+
// RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -disable-llvm-passes -fsycl-is-device -sycl-std=2020 -emit-llvm %s -o - | FileCheck %s
22

33

44
void enable() {
@@ -30,7 +30,7 @@ void disable() {
3030
}
3131

3232
template <typename name, typename Func>
33-
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
33+
__attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) {
3434
kernelFunc();
3535
}
3636

clang/test/Driver/sycl-offload.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
// RUN: %clang -### -fsycl -E %s 2>&1 | FileCheck -check-prefix=CHECK-OPTS %s
2323
// RUN: %clang -### -fsycl -S %s 2>&1 | FileCheck -check-prefix=CHECK-OPTS %s
2424
// RUN: %clang -### -fsycl %s 2>&1 | FileCheck -check-prefix=CHECK-OPTS %s
25-
// CHECK-OPTS: clang{{.*}} "-cc1" {{.*}} "-fsycl" "-fsycl-is-device"
26-
// CHECK-OPTS: clang{{.*}} "-cc1" {{.*}} "-fsycl" "-fsycl-is-host"
25+
// CHECK-OPTS: clang{{.*}} "-cc1" {{.*}} "-fsycl-is-device"
26+
// CHECK-OPTS: clang{{.*}} "-cc1" {{.*}} "-fsycl-is-host"

clang/test/Frontend/sycl.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,8 @@
66

77
// ERROR: error: unknown argument: '-fsycl'
88

9-
// Test that you cannot pass -sycl-std= without specifying host or device mode.
10-
// RUN: not %clang_cc1 -sycl-std=2020 %s 2>&1 | FileCheck --check-prefix=ERROR-STD %s
11-
// RUN: %clang_cc1 -sycl-std=2020 -fsycl-is-device %s 2>&1 | FileCheck --allow-empty %s
12-
// RUN: %clang_cc1 -sycl-std=2020 -fsycl-is-host %s 2>&1 | FileCheck --allow-empty %s
13-
14-
// CHECK-NOT: error: invalid argument '-sycl-std=' only allowed with '-fsycl-is-device' or '-fscyl-is-host'
15-
// ERROR-STD: error: invalid argument '-sycl-std=' only allowed with '-fsycl-is-device' or '-fscyl-is-host'
16-
179
// Test that you cannot specify -fscyl-is-device and -fsycl-is-host at the same time.
1810
// RUN: not %clang_cc1 -fsycl-is-device -fsycl-is-host %s 2>&1 | FileCheck --check-prefix=ERROR-BOTH %s
11+
// RUN: not %clang_cc1 -fsycl-is-host -fsycl-is-device %s 2>&1 | FileCheck --check-prefix=ERROR-BOTH %s
1912

2013
// ERROR-BOTH: error: invalid argument '-fsycl-is-device' not allowed with '-fsycl-is-host'

clang/test/SemaSYCL/intel-fpga-mem-builtin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsycl-is-device -verify -pedantic -fsyntax-only -x c++ %s
1+
// RUN: %clang_cc1 -fsycl-is-device -sycl-std=2020 -verify -pedantic -fsyntax-only -x c++ %s
22
// RUN: %clang_cc1 -verify -pedantic -fsyntax-only -x c++ %s
33

44
#define PARAM_1 1U << 7
@@ -56,7 +56,7 @@ void foo(float *A, int *B, State *C) {
5656
}
5757

5858
template <typename name, typename Func>
59-
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
59+
__attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) {
6060
kernelFunc();
6161
}
6262
int main() {

clang/test/SemaSYCL/intel-fpga-reg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsycl-is-device -verify -pedantic -fsyntax-only %s
1+
// RUN: %clang_cc1 -fsycl-is-device -sycl-std=2020 -verify -pedantic -fsyntax-only %s
22
// RUN: %clang_cc1 -verify -pedantic -fsyntax-only %s
33

44
class A {
@@ -57,7 +57,7 @@ void foo() {
5757
}
5858

5959
template <typename name, typename Func>
60-
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
60+
__attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) {
6161
kernelFunc();
6262
}
6363
int main() {

clang/unittests/Frontend/CompilerInvocationTest.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,8 @@ TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagNotPresent) {
513513
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
514514

515515
ASSERT_FALSE(Diags->hasErrorOccurred());
516-
ASSERT_FALSE(Invocation.getLangOpts()->SYCL);
516+
ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsDevice);
517+
ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost);
517518
ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None);
518519

519520
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -528,7 +529,8 @@ TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagPresent) {
528529
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
529530

530531
ASSERT_FALSE(Diags->hasErrorOccurred());
531-
ASSERT_FALSE(Invocation.getLangOpts()->SYCL);
532+
ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsDevice);
533+
ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost);
532534
ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None);
533535

534536
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -542,7 +544,7 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresent) {
542544

543545
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
544546

545-
ASSERT_FALSE(Diags->hasErrorOccurred());
547+
ASSERT_TRUE(Diags->hasErrorOccurred());
546548
ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None);
547549

548550
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -556,7 +558,7 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagPresent) {
556558

557559
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
558560

559-
ASSERT_FALSE(Diags->hasErrorOccurred());
561+
ASSERT_TRUE(Diags->hasErrorOccurred());
560562
ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017);
561563

562564
Invocation.generateCC1CommandLine(GeneratedArgs, *this);

0 commit comments

Comments
 (0)