[PATCH] D18380: [CUDA] Implement -fcuda-relaxed-constexpr, and enable it by default.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 11:30:10 PDT 2016


jlebar added inline comments.

================
Comment at: include/clang/Driver/CC1Options.td:702-703
@@ -701,2 +701,4 @@
   HelpText<"Allow variadic functions in CUDA device code.">;
+def fcuda_relaxed_constexpr : Flag<["-"], "fcuda-relaxed-constexpr">,
+  HelpText<"Treat constexpr functions as __host__ __device__.">;
 
----------------
rsmith wrote:
> Is there a better name we can use for this? I don't think this is "relaxed" in any obvious sense. `-fcuda-host-device-constexpr` or `-fcuda-constexpr-on-device` might be clearer?
"relaxed constexpr" is nvidia's term -- do you think it might be helpful to use the same terminology?  I understand there's some prior art here, with respect to clang accepting gcc's flags, although the situation here is of course different.

================
Comment at: lib/Driver/Tools.cpp:3597
@@ -3596,2 +3596,3 @@
     CmdArgs.push_back("-fcuda-disable-target-call-checks");
+    CmdArgs.push_back("-fcuda-relaxed-constexpr");
   }
----------------
rsmith wrote:
> For flags that are enabled by default, we usually have the -cc1 flag be a `-fno-*` flag. This allows people to use (for instance) `clang blah.cu -Xclang -fno-cuda-relaxed-constexpr` if necessary.
Yeah, Artem and I had a discussion about this yesterday.  As you can see, there are two other flags above which are turned on by default -- these also lack -fno variants.

I think it would be good to be consistent here.  I'm tempted to add another patch below this one which makes the other two -fno, then we can make this one -fno as well.  It seems that convention is to just get rid of the existing non-fno flags, rather than leave both positive and negative versions.

Does that sound OK to you?


http://reviews.llvm.org/D18380





More information about the cfe-commits mailing list