<div dir="ltr">I think your memory is correct (at least thats what I thought too). And yes, the macro would be defined externally when targeting the device. At that point we can remove this check for macro definition as we'd then be able to check the flags directly. So I do see this as a temporary solution which disrupts as little as possible.<div><br></div><div>Is the concern here with how the test is written? (i.e., the test explicitly sets this macro which will in future be set by the compiler itself). In which case it could be changed to</div><div><pre style="color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px">__host__ __device__ void hd1(void) {
#ifdef __CUDA_ARCH__
  hd1d();
  hd1h(); // expected-error {{no matching function}}
#else
  hd1d(); // expected-error {{no matching function}}
  hd1h();
#endif
  hd1hd();
  hd1g<<<1, 1>>>(); // expected-error {{reference to __global__ function 'hd1g' in __host__ __device__ function}}
}</pre></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 1, 2014 at 10:00 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can you remind me what the CUDA compilation model is currently? My memory was that the clang driver was eventually going to launch two -cc1 actions, one for device and one for host, presumably with different flags. I would expect that lib/Frontend/InitPreprocessor.cpp would define this macro when targeting the device.<br>
<br>
If we're doing a single compilation with a fat object approach, we may need to do something weird to get this right. =/<br>
<br>
<a href="http://reviews.llvm.org/D6457" target="_blank">http://reviews.llvm.org/D6457</a><br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div style="line-height:1.5em;padding-top:10px;margin-top:10px;color:rgb(85,85,85);font-family:sans-serif"><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Jacques Pienaar |</span><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Platforms |</span><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(0,153,57);padding-top:2px;margin-top:2px"> <a href="mailto:jpienaar@google.com" target="_blank">jpienaar@google.com</a> |</span><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(238,178,17);padding-top:2px;margin-top:2px"> 765-430-6883</span></div></div></div>
</div>