[PATCH] D21867: [CUDA] Add utility functions for dealing with CUDA versions / architectures.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 30 13:44:05 PDT 2016


tra added inline comments.

================
Comment at: lib/Driver/Driver.cpp:1026-1028
@@ -1024,4 +1025,5 @@
   } else if (CudaDeviceAction *CDA = dyn_cast<CudaDeviceAction>(A)) {
-    os << '"'
-       << (CDA->getGpuArchName() ? CDA->getGpuArchName() : "(multiple archs)")
+    os << '"' << (CDA->getGpuArch() != CudaArch::UNKNOWN
+                      ? CudaArchToString(CDA->getGpuArch())
+                      : "(multiple archs)")
        << '"' << ", {" << PrintActions1(C, *CDA->input_begin(), Ids) << "}";
----------------
jlebar wrote:
> tra wrote:
> > jlebar wrote:
> > > tra wrote:
> > > > I think this could be collapsed to just CudaArchToString(CDA->getGpuArch()).
> > > > "(multiple archs)" is as informative as (and indistinguishable from) "unknown" here.
> > > > 
> > > > 
> > > I'm not crazy about "unknown", since it *is* actually known.  How about we just not output anything?
> > It's a debugging output so it would be good to accurately reflect our internal state.
> > In this case if we for some reason end up with CudaArch::UNKNOWN, I'd want to know that. 
> > If we really use UNKNOWN to represent multiple archs, perhaps it needs an enum for multiple-archs.
> We really do use UNKNOWN here to represent multiple architectures.  It is used for the architecture of the Action corresponding to the call to fatbin.
> 
> I think adding an enum value for multiple-archs is going to be more harmful than useful, because it means that everywhere that we switch() on arch, we're going to have to handle (and assert) MULTIPLE_ARCHs.
OK. No output is fine with me.


http://reviews.llvm.org/D21867





More information about the cfe-commits mailing list