[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 13:24:11 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:
> jlebar wrote:
> > 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.
> I think it's problematic to use that terminology, as "relaxed constexpr" is also used to describe the C++14 `constexpr` rules (see [n3652](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html)).
Heh, I can't argue with that.

================
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:
> jlebar wrote:
> > 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?
> Yes, that sounds fine.
Okay, thank you.  After talking to Artem, we're just going to remove those two flags entirely.  So after we convert relaxed-constexpr to an fno flag, there should be no changes to this file in this patch.


http://reviews.llvm.org/D18380





More information about the cfe-commits mailing list