Skip to content

Commit 82db1fa

Browse files
author
Sergey Kanaev
committed
[SYCL] Rearrange code
Signed-off-by: Sergey Kanaev <sergey.kanaev@intel.com>
1 parent e4e5caf commit 82db1fa

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4082,6 +4082,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
40824082
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
40834083
}
40844084

4085+
Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ);
4086+
40854087
if (UseSYCLTriple) {
40864088
// We want to compile sycl kernels.
40874089
CmdArgs.push_back("-fsycl");
@@ -4117,9 +4119,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
41174119
options::OPT_fno_sycl_allow_func_ptr, false)) {
41184120
CmdArgs.push_back("-fsycl-allow-func-ptr");
41194121
}
4120-
}
41214122

4122-
Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ);
4123+
if (!SYCLStdArg) {
4124+
// The user had not pass SYCL version, thus we'll employ no-sycl-strict
4125+
// to allow address-space unqualified pointers in function params/return
4126+
// along with marking the same function with explicit SYCL_EXTERNAL
4127+
CmdArgs.push_back("-Wno-sycl-strict");
4128+
}
4129+
}
41234130

41244131
if (IsSYCL) {
41254132
if (SYCLStdArg) {
@@ -4131,13 +4138,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
41314138
}
41324139
}
41334140

4134-
if (UseSYCLTriple && !SYCLStdArg) {
4135-
// The user had not pass SYCL version, thus we'll employ no-sycl-strict
4136-
// to allow address-space unqualified pointers in function params/return
4137-
// along with marking the same function with explicit SYCL_EXTERNAL
4138-
CmdArgs.push_back("-Wno-sycl-strict");
4139-
}
4140-
41414141
if (IsOpenMPDevice) {
41424142
// We have to pass the triple of the host if compiling for an OpenMP device.
41434143
std::string NormalizedTriple =

clang/test/Driver/sycl-offload-nvptx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// RUN: -fsycl-targets=nvptx64-nvidia-nvcl-sycldevice --cuda-path=%S/Inputs/CUDA/usr/local/cuda \
99
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc %s 2>&1 \
1010
// RUN: | FileCheck -check-prefix=CHK-ACTIONS %s
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"{{.*}}
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"{{.*}}
1212
// CHK-ACTIONS: clang-offload-wrapper"{{.*}} "-host=x86_64-unknown-linux-gnu" "-target=nvptx64" "-kind=sycl"{{.*}}
13-
// 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"{{.*}}
13+
// 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"{{.*}}
1414

1515
/// Check phases w/out specifying a compute capability.
1616
// RUN: %clangxx -ccc-print-phases -std=c++11 -target x86_64-unknown-linux-gnu -fsycl \

0 commit comments

Comments
 (0)