Skip to content

Commit 5808cf3

Browse files
author
Georgi Mirazchiyski
committed
Move the check for SYCL restricting adding CUDA_ARCH macro to the preprocessor
1 parent 6220620 commit 5808cf3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

clang/lib/Driver/ToolChains/HIPAMD.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,7 @@ void HIPAMDToolChain::addClangTargetOptions(
283283
DeviceOffloadingKind == Action::OFK_SYCL) &&
284284
"Only HIP and SYCL offloading kinds are supported for GPUs.");
285285

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

291288
if (!DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
292289
false))

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,9 +1491,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
14911491
}
14921492

14931493
// CUDA device path compilaton
1494-
if (LangOpts.CUDAIsDevice && !LangOpts.HIP) {
1494+
if (LangOpts.CUDAIsDevice && !LangOpts.HIP && !LangOpts.isSYCL()) {
14951495
// The CUDA_ARCH value is set for the GPU target specified in the NVPTX
14961496
// backend's target defines.
1497+
// Note: SYCL targeting nvptx-cuda relies on __SYCL_CUDA_ARCH__ instead.
14971498
Builder.defineMacro("__CUDA_ARCH__");
14981499
}
14991500

0 commit comments

Comments
 (0)