Skip to content

Commit bf72790

Browse files
author
Georgi Mirazchiyski
committed
Restrict fcuda-is-device to NVPTX targets and add a comment
1 parent 34a8d9a commit bf72790

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clang/lib/Driver/ToolChains/HIPAMD.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "llvm/Support/FileSystem.h"
2424
#include "llvm/Support/Path.h"
2525
#include "llvm/TargetParser/TargetParser.h"
26+
#include "llvm/TargetParser/Triple.h"
2627

2728
using namespace clang::driver;
2829
using namespace clang::driver::toolchains;
@@ -283,7 +284,9 @@ void HIPAMDToolChain::addClangTargetOptions(
283284
DeviceOffloadingKind == Action::OFK_SYCL) &&
284285
"Only HIP and SYCL offloading kinds are supported for GPUs.");
285286

286-
if (DeviceOffloadingKind != Action::OFK_SYCL)
287+
// If we are compiling SYCL kernels for Nvidia GPUs throuh HIP, we do not
288+
// support Cuda device code compatability, hence we do not allow Cuda mode.
289+
if (getTriple().isNVPTX() && DeviceOffloadingKind != Action::OFK_SYCL)
287290
CC1Args.push_back("-fcuda-is-device");
288291

289292
if (!DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,

0 commit comments

Comments
 (0)