Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Driver/Driver.cpp
Show First 20 Lines • Show All 2,457 Lines • ▼ Show 20 Lines | ActionBuilderReturnCode addDeviceDepences(Action *HostAction) override { | ||||
// the host uses the CUDA offload kind. | // the host uses the CUDA offload kind. | ||||
if (auto *IA = dyn_cast<InputAction>(HostAction)) { | if (auto *IA = dyn_cast<InputAction>(HostAction)) { | ||||
assert(!GpuArchList.empty() && | assert(!GpuArchList.empty() && | ||||
"We should have at least one GPU architecture."); | "We should have at least one GPU architecture."); | ||||
// If the host input is not CUDA or HIP, we don't need to bother about | // If the host input is not CUDA or HIP, we don't need to bother about | ||||
// this input. | // this input. | ||||
if (!(IA->getType() == types::TY_CUDA || | if (!(IA->getType() == types::TY_CUDA || | ||||
IA->getType() == types::TY_CUDAHeader || | |||||
rgreenblatt: From my understanding this basically makes the treatment of TY_CUDAHeader (-xcuda-header)… | |||||
IA->getType() == types::TY_HIP || | IA->getType() == types::TY_HIP || | ||||
IA->getType() == types::TY_PP_HIP)) { | IA->getType() == types::TY_PP_HIP)) { | ||||
// The builder will ignore this input. | // The builder will ignore this input. | ||||
IsActive = false; | IsActive = false; | ||||
return ABRT_Inactive; | return ABRT_Inactive; | ||||
} | } | ||||
// Set the flag to true, so that the builder acts on the current input. | // Set the flag to true, so that the builder acts on the current input. | ||||
IsActive = true; | IsActive = true; | ||||
if (CompileHostOnly) | if (CompileHostOnly) | ||||
return ABRT_Success; | return ABRT_Success; | ||||
// Replicate inputs for each GPU architecture. | // Replicate inputs for each GPU architecture. | ||||
auto Ty = IA->getType() == types::TY_HIP ? types::TY_HIP_DEVICE | auto Ty = IA->getType() == types::TY_HIP | ||||
: types::TY_CUDA_DEVICE; | ? types::TY_HIP_DEVICE | ||||
: (IA->getType() == types::TY_CUDAHeader | |||||
? types::TY_CUDAHeader_DEVICE | |||||
: types::TY_CUDA_DEVICE); | |||||
for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) { | for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) { | ||||
CudaDeviceActions.push_back( | CudaDeviceActions.push_back( | ||||
C.MakeAction<InputAction>(IA->getInputArg(), Ty)); | C.MakeAction<InputAction>(IA->getInputArg(), Ty)); | ||||
} | } | ||||
return ABRT_Success; | return ABRT_Success; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,900 Lines • Show Last 20 Lines |
From my understanding this basically makes the treatment of TY_CUDAHeader (-xcuda-header) identical to TY_CUDA (-xcuda).
Some changes will need to happen below this for correct handling of header files (for example not warning about using #pragma once).