Skip to content

Commit 740ed61

Browse files
committed
Revert "[SYCL] Driver option to select SYCL version"
This reverts commit bd97704. It broke tests on mac: http://45.33.8.238/mac/9011/step_7.txt
1 parent f64e457 commit 740ed61

File tree

9 files changed

+8
-58
lines changed

9 files changed

+8
-58
lines changed

clang/include/clang/Basic/LangOptions.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,7 @@ LANGOPT(GPURelocatableDeviceCode, 1, 0, "generate relocatable device code")
230230
LANGOPT(GPUAllowDeviceInit, 1, 0, "allowing device side global init functions for HIP")
231231
LANGOPT(GPUMaxThreadsPerBlock, 32, 256, "default max threads per block for kernel launch bounds for HIP")
232232

233-
LANGOPT(SYCL , 1, 0, "SYCL")
234233
LANGOPT(SYCLIsDevice , 1, 0, "Generate code for SYCL device")
235-
LANGOPT(SYCLVersion , 32, 0, "Version of the SYCL standard used")
236234

237235
LANGOPT(HIPUseNewLaunchAPI, 1, 0, "Use new kernel launching API for HIP")
238236

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,12 +3420,10 @@ defm underscoring : BooleanFFlag<"underscoring">, Group<gfortran_Group>;
34203420
defm whole_file : BooleanFFlag<"whole-file">, Group<gfortran_Group>;
34213421

34223422
// C++ SYCL options
3423-
def fsycl : Flag<["-"], "fsycl">, Group<sycl_Group>, Flags<[CC1Option, CoreOption]>,
3423+
def fsycl : Flag<["-"], "fsycl">, Group<sycl_Group>,
34243424
HelpText<"Enable SYCL kernels compilation for device">;
3425-
def fno_sycl : Flag<["-"], "fno-sycl">, Group<sycl_Group>, Flags<[CoreOption]>,
3425+
def fno_sycl : Flag<["-"], "fno-sycl">, Group<sycl_Group>,
34263426
HelpText<"Disable SYCL kernels compilation for device">;
3427-
def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
3428-
HelpText<"SYCL language standard to compile for.">, Values<"2017, 121, 1.2.1, sycl-1.2.1">;
34293427

34303428
include "CC1Options.td"
34313429

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4040,18 +4040,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
40404040
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
40414041
}
40424042

4043-
if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false)) {
4044-
CmdArgs.push_back("-fsycl");
4043+
if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
40454044
CmdArgs.push_back("-fsycl-is-device");
40464045

4047-
if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
4048-
A->render(Args, CmdArgs);
4049-
} else {
4050-
// Ensure the default version in SYCL mode is 1.2.1 (aka 2017)
4051-
CmdArgs.push_back("-sycl-std=2017");
4052-
}
4053-
}
4054-
40554046
if (IsOpenMPDevice) {
40564047
// We have to pass the triple of the host if compiling for an OpenMP device.
40574048
std::string NormalizedTriple =

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,24 +2535,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
25352535
LangStd = OpenCLLangStd;
25362536
}
25372537

2538-
Opts.SYCL = Args.hasArg(options::OPT_fsycl);
2539-
Opts.SYCLIsDevice = Opts.SYCL && Args.hasArg(options::OPT_fsycl_is_device);
2540-
if (Opts.SYCL) {
2541-
// -sycl-std applies to any SYCL source, not only those containing kernels,
2542-
// but also those using the SYCL API
2543-
if (const Arg *A = Args.getLastArg(OPT_sycl_std_EQ)) {
2544-
Opts.SYCLVersion = llvm::StringSwitch<unsigned>(A->getValue())
2545-
.Cases("2017", "1.2.1", "121", "sycl-1.2.1", 2017)
2546-
.Default(0U);
2547-
2548-
if (Opts.SYCLVersion == 0U) {
2549-
// User has passed an invalid value to the flag, this is an error
2550-
Diags.Report(diag::err_drv_invalid_value)
2551-
<< A->getAsString(Args) << A->getValue();
2552-
}
2553-
}
2554-
}
2555-
25562538
Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header);
25572539
Opts.DeclareOpenCLBuiltins = Args.hasArg(OPT_fdeclare_opencl_builtins);
25582540

@@ -3154,6 +3136,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
31543136
<< Opts.OMPHostIRFile;
31553137
}
31563138

3139+
Opts.SYCLIsDevice = Args.hasArg(options::OPT_fsycl_is_device);
3140+
31573141
// Set CUDA mode for OpenMP target NVPTX if specified in options
31583142
Opts.OpenMPCUDAMode = Opts.OpenMPIsDevice && T.isNVPTX() &&
31593143
Args.hasArg(options::OPT_fopenmp_cuda_mode);

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,13 +460,6 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
460460
if (LangOpts.FastRelaxedMath)
461461
Builder.defineMacro("__FAST_RELAXED_MATH__");
462462
}
463-
464-
if (LangOpts.SYCL) {
465-
// SYCL Version is set to a value when building SYCL applications
466-
if (LangOpts.SYCLVersion == 2017)
467-
Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "121");
468-
}
469-
470463
// Not "standard" per se, but available even with the -undef flag.
471464
if (LangOpts.AsmPreprocessor)
472465
Builder.defineMacro("__ASSEMBLER__");

clang/test/Driver/sycl.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
// RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=ENABLED
22
// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
3-
// RUN: %clang -### -fsycl -sycl-std=1.2.1 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
4-
// RUN: %clang -### -fsycl -sycl-std=121 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
5-
// RUN: %clang -### -fsycl -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
6-
// RUN: %clang -### -fsycl -sycl-std=sycl-1.2.1 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
73
// RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
8-
// RUN: %clang -### -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=DISABLED
94
// RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
105
// RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
116
// RUN: %clangxx -### -fsycl -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
127
// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED
13-
// RUN: %clang_cl -### -fsycl -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
14-
// RUN: %clang_cl -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
15-
// RUN: %clang_cl -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED
168

179
// ENABLED: "-cc1"{{.*}} "-fsycl-is-device"
18-
// ENABLED-SAME: "-sycl-std={{[-.sycl0-9]+}}"
1910
// DISABLED-NOT: "-fsycl-is-device"
20-
// DISABLED-NOT: "-sycl-std="
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 %s -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck %s
2-
// RUN: %clang_cc1 %s -fsycl -fsycl-is-device -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
2+
// RUN: %clang_cc1 %s -fsycl-is-device -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
33

44
// CHECK-NOT:#define __x86_64__ 1
55
// CHECK-SYCL:#define __x86_64__ 1
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// RUN: %clang_cc1 %s -E -dM | FileCheck %s
2-
// RUN: %clang_cc1 %s -fsycl -sycl-std=2017 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
3-
// RUN: %clang_cc1 %s -fsycl -fsycl-is-device -sycl-std=1.2.1 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
4-
// RUN: %clang_cc1 %s -fsycl -fsycl-is-device -E -dM | FileCheck --check-prefixes=CHECK-SYCL %s
2+
// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
53

64
// CHECK-NOT:#define __SYCL_DEVICE_ONLY__ 1
7-
// CHECK-NOT:#define CL_SYCL_LANGUAGE_VERSION 121
8-
// CHECK-SYCL-STD:#define CL_SYCL_LANGUAGE_VERSION 121
95
// CHECK-SYCL:#define __SYCL_DEVICE_ONLY__ 1

clang/test/SemaSYCL/kernel-attribute.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fsycl -fsycl-is-device -verify %s
1+
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fsycl-is-device -verify %s
22

33
// Only function templates
44
[[clang::sycl_kernel]] int gv2 = 0; // expected-warning {{'sycl_kernel' attribute only applies to function templates}}

0 commit comments

Comments
 (0)