From 53f22f3f2392a63f4e87f34323f1402824122d87 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Thu, 19 Mar 2020 17:14:09 +0300 Subject: [PATCH 01/14] [SYCL] Fix '-fsycl-device-only -fsycl' compiler invocation scenario Signed-off-by: Sergey Kanaev --- clang/lib/Driver/ToolChains/Clang.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 32557c38684ab..3a81d034c5cd2 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4115,17 +4115,23 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } + Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ); + + if ((Args.hasArg(options::OPT_fsycl_device_only) || + Args.hasArg(options::OPT_fsycl) || IsSYCL) && !SYCLStdArg) { + // The user had not pass SYCL version, thus we'll employ no-sycl-strict + // to allow address-space unqualified pointers in function params/return + // along with marking the same function with explicit SYCL_EXTERNAL + CmdArgs.push_back("-Wno-sycl-strict"); + } + if (IsSYCL) { - if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) { - A->render(Args, CmdArgs); + if (SYCLStdArg) { + SYCLStdArg->render(Args, CmdArgs); CmdArgs.push_back("-fsycl-std-layout-kernel-params"); } else { // Ensure the default version in SYCL mode is 1.2.1 (aka 2017) CmdArgs.push_back("-sycl-std=2017"); - // The user had not pass SYCL version, thus we'll employ no-sycl-strict - // to allow address-space unqualified pointers in function params/return - // along with marking the same function with explicit SYCL_EXTERNAL - CmdArgs.push_back("-Wno-sycl-strict"); } } From fa661cc956bae36db840eaf85a673ed6f8b05a59 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Fri, 20 Mar 2020 12:23:06 +0300 Subject: [PATCH 02/14] [SYCL] Preserve original order of cmdline parameters Signed-off-by: Sergey Kanaev --- clang/lib/Driver/ToolChains/Clang.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 3a81d034c5cd2..2f07b0e51cbfc 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4117,14 +4117,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ); - if ((Args.hasArg(options::OPT_fsycl_device_only) || - Args.hasArg(options::OPT_fsycl) || IsSYCL) && !SYCLStdArg) { - // The user had not pass SYCL version, thus we'll employ no-sycl-strict - // to allow address-space unqualified pointers in function params/return - // along with marking the same function with explicit SYCL_EXTERNAL - CmdArgs.push_back("-Wno-sycl-strict"); - } - if (IsSYCL) { if (SYCLStdArg) { SYCLStdArg->render(Args, CmdArgs); @@ -4135,6 +4127,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } + if ((Args.hasArg(options::OPT_fsycl_device_only) || + Args.hasArg(options::OPT_fsycl) || IsSYCL) && !SYCLStdArg) { + // The user had not pass SYCL version, thus we'll employ no-sycl-strict + // to allow address-space unqualified pointers in function params/return + // along with marking the same function with explicit SYCL_EXTERNAL + CmdArgs.push_back("-Wno-sycl-strict"); + } + if (IsOpenMPDevice) { // We have to pass the triple of the host if compiling for an OpenMP device. std::string NormalizedTriple = From 55112843688e7aeca611b60c260f09eafe3fab6f Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Fri, 20 Mar 2020 12:24:33 +0300 Subject: [PATCH 03/14] [SYCL] Add test Signed-off-by: Sergey Kanaev --- clang/test/Driver/sycl-device.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/clang/test/Driver/sycl-device.cpp b/clang/test/Driver/sycl-device.cpp index d6bdc7f4f8939..adad812c1026b 100644 --- a/clang/test/Driver/sycl-device.cpp +++ b/clang/test/Driver/sycl-device.cpp @@ -7,3 +7,17 @@ // RUN: %clang -### -fsycl-device-only %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-SYCL-DEV %s // CHECK-SYCL-DEV: "-fsycl-is-device" + +/// Check that "-Wno-sycl-strict" is set on compiler invocation with "-fsycl" +/// or "-fsycl-device-only" or both: +// RUN: %clang -### -fsycl %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT1 %s +// CHECK-SYCL-NO_STRICT1: "-Wno-sycl-strict" + +// RUN: %clang -### -fsycl-device-only %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT2 %s +// CHECK-SYCL-NO_STRICT2: "-Wno-sycl-strict" + +// RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT3 %s +// CHECK-SYCL-NO_STRICT3: "-Wno-sycl-strict" From 04da2a02ab1a1c5665f0e6a6ffede2ef1c793691 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Tue, 24 Mar 2020 09:53:05 +0300 Subject: [PATCH 04/14] [SYCL] Fix indentation Signed-off-by: Sergey Kanaev --- clang/lib/Driver/ToolChains/Clang.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index cce78378d82ea..63d2b7bb96720 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4121,7 +4121,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ); - if (IsSYCL) { + if (IsSYCL) { if (SYCLStdArg) { SYCLStdArg->render(Args, CmdArgs); CmdArgs.push_back("-fsycl-std-layout-kernel-params"); @@ -4129,7 +4129,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // Ensure the default version in SYCL mode is 1.2.1 (aka 2017) CmdArgs.push_back("-sycl-std=2017"); } - } + } if ((Args.hasArg(options::OPT_fsycl_device_only) || Args.hasArg(options::OPT_fsycl) || IsSYCL) && !SYCLStdArg) { From 8704aeb84c924b62560aea9d216b5e929b862183 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Tue, 24 Mar 2020 09:53:44 +0300 Subject: [PATCH 05/14] [SYCL] Add check for -Wno-sycl-strict to nvptx test Signed-off-by: Sergey Kanaev --- clang/test/Driver/sycl-offload-nvptx.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/test/Driver/sycl-offload-nvptx.cpp b/clang/test/Driver/sycl-offload-nvptx.cpp index 5ee9e9be6304c..3f8e4b8db3974 100644 --- a/clang/test/Driver/sycl-offload-nvptx.cpp +++ b/clang/test/Driver/sycl-offload-nvptx.cpp @@ -8,9 +8,9 @@ // RUN: -fsycl-targets=nvptx64-nvidia-nvcl-sycldevice --cuda-path=%S/Inputs/CUDA/usr/local/cuda \ // RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHK-ACTIONS %s -// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-sycl-std=2017"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION:[0-9.]+]]"{{.*}} "-target-cpu" "sm_30"{{.*}} "-std=c++11"{{.*}} +// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-sycl-std=2017" "-Wno-sycl-strict"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION:[0-9.]+]]"{{.*}} "-target-cpu" "sm_30"{{.*}} "-std=c++11"{{.*}} // CHK-ACTIONS: clang-offload-wrapper"{{.*}} "-host=x86_64-unknown-linux-gnu" "-target=nvptx64" "-kind=sycl"{{.*}} -// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-sycl-std=2017"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION]]"{{.*}} "-target-cpu" "sm_30"{{.*}} "-std=c++11"{{.*}} +// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-sycl-std=2017" "-Wno-sycl-strict"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION]]"{{.*}} "-target-cpu" "sm_30"{{.*}} "-std=c++11"{{.*}} /// Check phases w/out specifying a compute capability. // RUN: %clangxx -ccc-print-phases -std=c++11 -target x86_64-unknown-linux-gnu -fsycl \ From 5de6d2c3ac58a2d13815cd7773995cd844b4e992 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Tue, 24 Mar 2020 10:22:41 +0300 Subject: [PATCH 06/14] [SYCL] Fix indentation Signed-off-by: Sergey Kanaev --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 63d2b7bb96720..c538f1835e53b 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4132,7 +4132,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } if ((Args.hasArg(options::OPT_fsycl_device_only) || - Args.hasArg(options::OPT_fsycl) || IsSYCL) && !SYCLStdArg) { + Args.hasArg(options::OPT_fsycl) || IsSYCL) && + !SYCLStdArg) { // The user had not pass SYCL version, thus we'll employ no-sycl-strict // to allow address-space unqualified pointers in function params/return // along with marking the same function with explicit SYCL_EXTERNAL From 57ad691527f864529a6aa1e8e0dfa6deb7f07334 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Tue, 24 Mar 2020 10:38:21 +0300 Subject: [PATCH 07/14] [SYCL] Fix indentation Signed-off-by: Sergey Kanaev --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index c538f1835e53b..d0e94fd14c442 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4132,7 +4132,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } if ((Args.hasArg(options::OPT_fsycl_device_only) || - Args.hasArg(options::OPT_fsycl) || IsSYCL) && + Args.hasArg(options::OPT_fsycl) || IsSYCL) && !SYCLStdArg) { // The user had not pass SYCL version, thus we'll employ no-sycl-strict // to allow address-space unqualified pointers in function params/return From e4e5caf3abb19ed12d799d5c824e26f114d9212d Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Wed, 25 Mar 2020 10:28:23 +0300 Subject: [PATCH 08/14] [SYCL] Change condition Signed-off-by: Sergey Kanaev --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index d0e94fd14c442..15bbfe76c171a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4131,9 +4131,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } - if ((Args.hasArg(options::OPT_fsycl_device_only) || - Args.hasArg(options::OPT_fsycl) || IsSYCL) && - !SYCLStdArg) { + if (UseSYCLTriple && !SYCLStdArg) { // The user had not pass SYCL version, thus we'll employ no-sycl-strict // to allow address-space unqualified pointers in function params/return // along with marking the same function with explicit SYCL_EXTERNAL From 82db1fa5864b97814e9be17d6d56981ae0c78ad9 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Wed, 25 Mar 2020 11:06:40 +0300 Subject: [PATCH 09/14] [SYCL] Rearrange code Signed-off-by: Sergey Kanaev --- clang/lib/Driver/ToolChains/Clang.cpp | 18 +++++++++--------- clang/test/Driver/sycl-offload-nvptx.cpp | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 15bbfe76c171a..6d207aae2aec6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4082,6 +4082,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back(Args.MakeArgString(NormalizedTriple)); } + Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ); + if (UseSYCLTriple) { // We want to compile sycl kernels. CmdArgs.push_back("-fsycl"); @@ -4117,9 +4119,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fno_sycl_allow_func_ptr, false)) { CmdArgs.push_back("-fsycl-allow-func-ptr"); } - } - Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ); + if (!SYCLStdArg) { + // The user had not pass SYCL version, thus we'll employ no-sycl-strict + // to allow address-space unqualified pointers in function params/return + // along with marking the same function with explicit SYCL_EXTERNAL + CmdArgs.push_back("-Wno-sycl-strict"); + } + } if (IsSYCL) { if (SYCLStdArg) { @@ -4131,13 +4138,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } - if (UseSYCLTriple && !SYCLStdArg) { - // The user had not pass SYCL version, thus we'll employ no-sycl-strict - // to allow address-space unqualified pointers in function params/return - // along with marking the same function with explicit SYCL_EXTERNAL - CmdArgs.push_back("-Wno-sycl-strict"); - } - if (IsOpenMPDevice) { // We have to pass the triple of the host if compiling for an OpenMP device. std::string NormalizedTriple = diff --git a/clang/test/Driver/sycl-offload-nvptx.cpp b/clang/test/Driver/sycl-offload-nvptx.cpp index 3f8e4b8db3974..13ddf33258d05 100644 --- a/clang/test/Driver/sycl-offload-nvptx.cpp +++ b/clang/test/Driver/sycl-offload-nvptx.cpp @@ -8,9 +8,9 @@ // RUN: -fsycl-targets=nvptx64-nvidia-nvcl-sycldevice --cuda-path=%S/Inputs/CUDA/usr/local/cuda \ // RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHK-ACTIONS %s -// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-sycl-std=2017" "-Wno-sycl-strict"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION:[0-9.]+]]"{{.*}} "-target-cpu" "sm_30"{{.*}} "-std=c++11"{{.*}} +// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-Wno-sycl-strict" "-sycl-std=2017" {{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION:[0-9.]+]]"{{.*}} "-target-cpu" "sm_30"{{.*}} "-std=c++11"{{.*}} // CHK-ACTIONS: clang-offload-wrapper"{{.*}} "-host=x86_64-unknown-linux-gnu" "-target=nvptx64" "-kind=sycl"{{.*}} -// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-sycl-std=2017" "-Wno-sycl-strict"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION]]"{{.*}} "-target-cpu" "sm_30"{{.*}} "-std=c++11"{{.*}} +// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-Wno-sycl-strict" "-sycl-std=2017" {{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION]]"{{.*}} "-target-cpu" "sm_30"{{.*}} "-std=c++11"{{.*}} /// Check phases w/out specifying a compute capability. // RUN: %clangxx -ccc-print-phases -std=c++11 -target x86_64-unknown-linux-gnu -fsycl \ From 91e72138e04a436d78e8b0352fc72a44572bcaad Mon Sep 17 00:00:00 2001 From: s-kanaev <57672082+s-kanaev@users.noreply.github.com> Date: Mon, 6 Apr 2020 10:33:26 +0300 Subject: [PATCH 10/14] [SYCL] Update clang/test/Driver/sycl-device.cpp Signed-off-by: Sergey Kanaev sergey.kanaev@intel.com Co-Authored-By: Artem Gindinson --- clang/test/Driver/sycl-device.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/clang/test/Driver/sycl-device.cpp b/clang/test/Driver/sycl-device.cpp index fd33ce51df84d..308653fe5bd57 100644 --- a/clang/test/Driver/sycl-device.cpp +++ b/clang/test/Driver/sycl-device.cpp @@ -11,13 +11,9 @@ /// Check that "-Wno-sycl-strict" is set on compiler invocation with "-fsycl" /// or "-fsycl-device-only" or both: // RUN: %clang -### -fsycl %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT1 %s -// CHECK-SYCL-NO_STRICT1: "-Wno-sycl-strict" - +// RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT %s // RUN: %clang -### -fsycl-device-only %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT2 %s -// CHECK-SYCL-NO_STRICT2: "-Wno-sycl-strict" - +// RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT %s // RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT3 %s -// CHECK-SYCL-NO_STRICT3: "-Wno-sycl-strict" +// RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT %s +// CHECK-SYCL-NO_STRICT: clang{{.*}} "-Wno-sycl-strict" From 88e2325f26d17e11cdd1b3f28c18b9cc0056af63 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Mon, 6 Apr 2020 11:55:52 +0300 Subject: [PATCH 11/14] [SYCL] Add tests Signed-off-by: Sergey Kanaev --- clang/test/Driver/sycl-device.cpp | 5 +++++ clang/test/Driver/sycl.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/clang/test/Driver/sycl-device.cpp b/clang/test/Driver/sycl-device.cpp index 308653fe5bd57..ce3ecd87eb868 100644 --- a/clang/test/Driver/sycl-device.cpp +++ b/clang/test/Driver/sycl-device.cpp @@ -17,3 +17,8 @@ // RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT %s // CHECK-SYCL-NO_STRICT: clang{{.*}} "-Wno-sycl-strict" + +/// Check that -fsycl-std=2017 is set if no std version is provided by user +// RUN: %clang -### -fsycl %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-SYCL-STD_VERSION %s +// CHECK-SYCL-STD_VERSION: clang{{.*}} "-sycl-std=2017" diff --git a/clang/test/Driver/sycl.c b/clang/test/Driver/sycl.c index dba5429514b64..931d948bb8ed3 100644 --- a/clang/test/Driver/sycl.c +++ b/clang/test/Driver/sycl.c @@ -10,9 +10,11 @@ // RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED // RUN: %clangxx -### -fsycl -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED // RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED +// RUN: %clangxx -### -sycl-std=some-std %s 2>&1 | FileCheck %s --check-prefix=DISABLED // RUN: %clang_cl -### -fsycl -sycl-std=2017 -- %s 2>&1 | FileCheck %s --check-prefix=ENABLED // RUN: %clang_cl -### -fsycl -- %s 2>&1 | FileCheck %s --check-prefix=ENABLED // RUN: %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=DISABLED +// RUN: %clang_cl -### -sycl-std=some-std -- %s 2>&1 | FileCheck %s --check-prefix=DISABLED // ENABLED: "-cc1"{{.*}} "-fsycl-is-device" // ENABLED-SAME: "-sycl-std={{[-.sycl0-9]+}}" @@ -20,6 +22,7 @@ // DISABLED-NOT: "-fsycl-is-device" // DISABLED-NOT: "-sycl-std=" +// DISABLED-NOT: "-fsycl-std-layout-kernel-params" // RUN: %clang -### -fsycl-device-only -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT // RUN: %clang -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT From 52688378bdde9874958d565415501fbf35294978 Mon Sep 17 00:00:00 2001 From: s-kanaev <57672082+s-kanaev@users.noreply.github.com> Date: Mon, 6 Apr 2020 12:07:51 +0300 Subject: [PATCH 12/14] [SYCL] Update clang/test/Driver/sycl.c Signed-off-by: Sergey Kanaev Co-Authored-By: Artem Gindinson --- clang/test/Driver/sycl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/Driver/sycl.c b/clang/test/Driver/sycl.c index 931d948bb8ed3..26dd07a71225b 100644 --- a/clang/test/Driver/sycl.c +++ b/clang/test/Driver/sycl.c @@ -21,7 +21,7 @@ // ENABLED-SAME: "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl" // DISABLED-NOT: "-fsycl-is-device" -// DISABLED-NOT: "-sycl-std=" +// DISABLED-NOT: "-sycl-std={{.*}}" // DISABLED-NOT: "-fsycl-std-layout-kernel-params" // RUN: %clang -### -fsycl-device-only -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT From a6720fa68955071b5fee00c646a0d5364917b215 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Tue, 7 Apr 2020 15:27:48 +0300 Subject: [PATCH 13/14] [SYCL] Fix test Signed-off-by: Sergey Kanaev --- clang/test/Driver/sycl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/clang/test/Driver/sycl.c b/clang/test/Driver/sycl.c index 26dd07a71225b..611ba5bb7e8a6 100644 --- a/clang/test/Driver/sycl.c +++ b/clang/test/Driver/sycl.c @@ -5,21 +5,24 @@ // RUN: %clang -### -fsycl -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=ENABLED // RUN: %clang -### -fsycl -sycl-std=sycl-1.2.1 %s 2>&1 | FileCheck %s --check-prefix=ENABLED // RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED -// RUN: %clang -### -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=DISABLED +// RUN: %clang -### -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED // RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED // RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED // RUN: %clangxx -### -fsycl -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED -// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED -// RUN: %clangxx -### -sycl-std=some-std %s 2>&1 | FileCheck %s --check-prefix=DISABLED +// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED +// RUN: %clangxx -### -sycl-std=some-std %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED // RUN: %clang_cl -### -fsycl -sycl-std=2017 -- %s 2>&1 | FileCheck %s --check-prefix=ENABLED // RUN: %clang_cl -### -fsycl -- %s 2>&1 | FileCheck %s --check-prefix=ENABLED -// RUN: %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=DISABLED -// RUN: %clang_cl -### -sycl-std=some-std -- %s 2>&1 | FileCheck %s --check-prefix=DISABLED +// RUN: %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED +// RUN: %clang_cl -### -sycl-std=some-std -- %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED // ENABLED: "-cc1"{{.*}} "-fsycl-is-device" // ENABLED-SAME: "-sycl-std={{[-.sycl0-9]+}}" // ENABLED-SAME: "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl" +// NOT_ENABLED-NOT: "-fsycl-is-device" +// NOT_ENABLED-NOT: "-fsycl-std-layout-kernel-params" + // DISABLED-NOT: "-fsycl-is-device" // DISABLED-NOT: "-sycl-std={{.*}}" // DISABLED-NOT: "-fsycl-std-layout-kernel-params" From aa40aa58ce468a178be7e034bac3f8b84a1e5ceb Mon Sep 17 00:00:00 2001 From: s-kanaev <57672082+s-kanaev@users.noreply.github.com> Date: Wed, 8 Apr 2020 12:50:35 +0300 Subject: [PATCH 14/14] Update clang/test/Driver/sycl-device.cpp Signed-off-by: Sergey Kanaev Co-Authored-By: Artem Gindinson --- clang/test/Driver/sycl-device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/Driver/sycl-device.cpp b/clang/test/Driver/sycl-device.cpp index ce3ecd87eb868..0cb2c327ba8ca 100644 --- a/clang/test/Driver/sycl-device.cpp +++ b/clang/test/Driver/sycl-device.cpp @@ -18,7 +18,7 @@ // RUN: | FileCheck -check-prefix=CHECK-SYCL-NO_STRICT %s // CHECK-SYCL-NO_STRICT: clang{{.*}} "-Wno-sycl-strict" -/// Check that -fsycl-std=2017 is set if no std version is provided by user +/// Check that -sycl-std=2017 is set if no std version is provided by user // RUN: %clang -### -fsycl %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-SYCL-STD_VERSION %s // CHECK-SYCL-STD_VERSION: clang{{.*}} "-sycl-std=2017"