[PATCH] [cuda] Driver changes to build and stitch together host and device-side CUDA code.
Artem Belevich
tra at google.com
Wed May 6 13:38:03 PDT 2015
Added more comments.
================
Comment at: include/clang/Driver/Action.h:142
@@ +141,3 @@
+ const char *GpuArchName;
+ bool AtTopLevel;
+
----------------
echristo wrote:
> AtTopLevel needs to be documented more. It's not clear. Also the usage below.
Commented.
================
Comment at: lib/Driver/Driver.cpp:1171
@@ -1152,1 +1170,3 @@
+// For eash unique --cuda-gpu-arch= argument creates a TY_CUDA_DEVICE input
+// action and then wraps each in CudaDeviceAction paired with appropriate GPU
----------------
echristo wrote:
> "For each"
Fixed.
================
Comment at: lib/Driver/Driver.cpp:1199-1240
@@ +1198,44 @@
+
+ Driver::InputList CudaDeviceInputs;
+ for (unsigned i = 0, e = GpuArchList.size(); i != e; ++i)
+ CudaDeviceInputs.push_back(std::make_pair(types::TY_CUDA_DEVICE, InputArg));
+
+ ActionList CudaDeviceActions;
+ D.BuildActions(TC, Args, CudaDeviceInputs, CudaDeviceActions);
+ assert(GpuArchList.size() == CudaDeviceActions.size() &&
+ "Failed to create actions for all devices");
+
+ bool PartialCompilation = false;
+ bool DeviceOnlyCompilation = Args.hasArg(options::OPT_cuda_device_only);
+ for (unsigned i = 0, e = GpuArchList.size(); i != e; ++i) {
+ if (CudaDeviceActions[i]->getKind() != Action::BackendJobClass) {
+ PartialCompilation = true;
+ break;
+ }
+ }
+
+ if (PartialCompilation || DeviceOnlyCompilation) {
+ // If -o specified we can only work if it's device-only compilation for a
+ // single device.
+ if (Args.hasArg(options::OPT_o) &&
+ (!DeviceOnlyCompilation || GpuArchList.size() > 1)) {
+ D.Diag(clang::diag::err_drv_output_argument_with_multiple_files);
+ return nullptr;
+ }
+ for (unsigned i = 0, e = GpuArchList.size(); i != e; ++i)
+ Actions.push_back(new CudaDeviceAction(
+ std::unique_ptr<Action>(CudaDeviceActions[i]), GpuArchList[i], true));
+ if (DeviceOnlyCompilation)
+ Current.reset(nullptr);
+ return Current;
+ } else {
+ ActionList CudaDeviceJobActions;
+ for (unsigned i = 0, e = GpuArchList.size(); i != e; ++i)
+ CudaDeviceJobActions.push_back(
+ new CudaDeviceAction(std::unique_ptr<Action>(CudaDeviceActions[i]),
+ GpuArchList[i], false));
+ return std::unique_ptr<Action>(
+ new CudaHostAction(std::move(Current), CudaDeviceJobActions));
+ }
+}
+
----------------
echristo wrote:
> Needs some overarching documentation.
Added more comments describing what's happening in this function.
================
Comment at: tools/libclang/CIndex.cpp:3031
@@ -3030,1 +3030,3 @@
+ if (!Unit && !ErrUnit) {
+ PTUI->result = CXError_ASTReadError;
----------------
echristo wrote:
> Comment.
Done.
http://reviews.llvm.org/D9509
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list