@@ -1246,13 +1246,18 @@ static std::unique_ptr<Action>
1246
1246
buildCudaActions (const Driver &D, const ToolChain &TC, DerivedArgList &Args,
1247
1247
const Arg *InputArg, std::unique_ptr<Action> HostAction,
1248
1248
ActionList &Actions) {
1249
+ // Figure out which NVPTX triple to use for device-side compilation based on
1250
+ // whether host is 64-bit.
1251
+ const char *DeviceTriple = TC.getTriple ().isArch64Bit ()
1252
+ ? " nvptx64-nvidia-cuda"
1253
+ : " nvptx-nvidia-cuda" ;
1249
1254
Arg *PartialCompilationArg = Args.getLastArg (options::OPT_cuda_host_only,
1250
1255
options::OPT_cuda_device_only);
1251
1256
// Host-only compilation case.
1252
1257
if (PartialCompilationArg &&
1253
1258
PartialCompilationArg->getOption ().matches (options::OPT_cuda_host_only))
1254
1259
return std::unique_ptr<Action>(
1255
- new CudaHostAction (std::move (HostAction), {}));
1260
+ new CudaHostAction (std::move (HostAction), {}, DeviceTriple ));
1256
1261
1257
1262
// Collect all cuda_gpu_arch parameters, removing duplicates.
1258
1263
SmallVector<const char *, 4 > GpuArchList;
@@ -1290,12 +1295,6 @@ buildCudaActions(const Driver &D, const ToolChain &TC, DerivedArgList &Args,
1290
1295
}
1291
1296
}
1292
1297
1293
- // Figure out which NVPTX triple to use for device-side compilation based on
1294
- // whether host is 64-bit.
1295
- const char *DeviceTriple = TC.getTriple ().isArch64Bit ()
1296
- ? " nvptx64-nvidia-cuda"
1297
- : " nvptx-nvidia-cuda" ;
1298
-
1299
1298
// Figure out what to do with device actions -- pass them as inputs to the
1300
1299
// host action or run each of them independently.
1301
1300
bool DeviceOnlyCompilation = PartialCompilationArg != nullptr ;
@@ -1331,7 +1330,7 @@ buildCudaActions(const Driver &D, const ToolChain &TC, DerivedArgList &Args,
1331
1330
// Return a new host action that incorporates original host action and all
1332
1331
// device actions.
1333
1332
return std::unique_ptr<Action>(
1334
- new CudaHostAction (std::move (HostAction), DeviceActions));
1333
+ new CudaHostAction (std::move (HostAction), DeviceActions, DeviceTriple ));
1335
1334
}
1336
1335
1337
1336
void Driver::BuildActions (const ToolChain &TC, DerivedArgList &Args,
0 commit comments