@@ -938,8 +938,18 @@ void CudaToolChain::addClangTargetOptions(
938938 DeviceOffloadingKind == Action::OFK_Cuda) &&
939939 " Only OpenMP, SYCL or CUDA offloading kinds are supported for NVIDIA GPUs." );
940940
941- CC1Args.append (
942- {" -fcuda-is-device" , " -mllvm" , " -enable-memcpyopt-without-libcalls" });
941+ // If we are compiling SYCL kernels for Nvidia GPUs, we do not support Cuda
942+ // device code compatability, hence we do not set Cuda mode in that instance.
943+ if (DeviceOffloadingKind == Action::OFK_SYCL) {
944+ toolchains::SYCLToolChain::AddSYCLIncludeArgs (getDriver (), DriverArgs,
945+ CC1Args);
946+
947+ if (DriverArgs.hasArg (options::OPT_fsycl_fp32_prec_sqrt)) {
948+ CC1Args.push_back (" -fcuda-prec-sqrt" );
949+ }
950+ } else {
951+ CC1Args.append (
952+ {" -fcuda-is-device" , " -mllvm" , " -enable-memcpyopt-without-libcalls" });
943953
944954 // Unsized function arguments used for variadics were introduced in CUDA-9.0
945955 // We still do not support generating code that actually uses variadic
@@ -952,14 +962,6 @@ void CudaToolChain::addClangTargetOptions(
952962 // Add these flags for .cu SYCL compilation.
953963 CC1Args.append ({" -std=c++17" , " -fsycl-is-host" });
954964 }
955-
956- if (DeviceOffloadingKind == Action::OFK_SYCL) {
957- toolchains::SYCLToolChain::AddSYCLIncludeArgs (getDriver (), DriverArgs,
958- CC1Args);
959-
960- if (DriverArgs.hasArg (options::OPT_fsycl_fp32_prec_sqrt)) {
961- CC1Args.push_back (" -fcuda-prec-sqrt" );
962- }
963965 }
964966
965967 auto NoLibSpirv = DriverArgs.hasArg (options::OPT_fno_sycl_libspirv) ||
0 commit comments