r199208 - [OpenCL] Disallow casts between address spaces.

David Tweed david.tweed at gmail.com
Tue Jan 14 08:06:45 PST 2014


On Tue, Jan 14, 2014 at 3:54 PM, Joey Gouly <joey.gouly at arm.com> wrote:
>> On 14/01/2014 13:15, David Tweed wrote:
>> > So this is an absolutely fine commit, but I guess this does highlight
>> > that, once people get seriously stuck into implementing OpenCL 2.0
>> > (and so we'll acquire the generic address space, to/from which one can
>> > cast pointers in other address spaces) we'll have subtly different
>> > rules for the two versions, at which point "getLangOpts.OpenCL" is
>> > probably not going to be fine grained enough. What's the thought on
>> > how to handle that in general in clang?
>>
>> Hi David,
>>
>> There's precedent for this in LangOptions::ObjC1 / LangOptions::ObjC2.
>>
>>    Opts.ObjC1 = Opts.ObjC2 = 1;
>>
>> I think it'd be best to tweak that approach when it comes to OpenCL
>> though, leaving the current 'OpenCL' flag as-is and introducing
>> 'OpenCL2' as needed to make adjustments for the newer standard.
>>
>> My reasoning is that "if (ObjC1) ..." has turned out in hindsight to be
>> unnatural given that it really means "any Objective-C version".
>
> We actually have LangOpts::OpenCLVersion, I could guard this on "<= 120",
> however that's
> not right because OpenCL 2.0 only allows casts to the generic address space,
> and since
> we don't have any support for the generic address space, I can't really do
> much.
>
> I'm going to leave this as-is, and when we (someone) starts work on OpenCL
> 2.0,
> they'll have to add support for the generic address space and tweak this a
> little.
>
> Make sense?

That makes sense to me: writing the only code for what's actually viable at
the moment is the most sensible course. I hadn't come across OpenCLVersion
before; know you've  highlighted its existence it's clear we can express
frontend behaviours that need to be slightly different for different
spec revisions.

-- 
cheers, dave tweed__________________________
high-performance computing and machine vision expert: david.tweed at gmail.com
"while having code so boring anyone can maintain it, use Python." --
attempted insult seen on slashdot



More information about the cfe-commits mailing list