[OpenCL patch] Half type as native when OpenCL's cl_khr_fp16 extension is enabled

We are working on adding cl_khr_fp16 extension support to pocl
(pocl in Launchpad) based on this patch. FWIW it would be very
helpful to us to have this patch committed to trunk. It has worked without
problems so far.

Hi Timo,

Thanks for your interest and encouragement - I'm happy for the patch to go
in.

I'm reattaching it in case anyone has further comments. We haven't found a
solution to the FIXMEs yet, but will continue working on this once the patch
gets committed.

Many thanks,
Anton.

Anton Lokhmotov wrote
> Hi Doug,
>
>> > While the conformance tests are not sacred, it can be argued that the
>> > composition of '&' and '' should result in half*, so should not be
>> > rejected. Unfortunately, we found no obvious way to implement this
>> > in Clang, so leave this case as TODO.
>>
>> One way to handle the "storage-only" version is for buffer[index] to
>> produce a non-modifiable lvalue (so you can't write it) and to ban the
>> lvalue-to-rvalue conversion for such a value (for the latter, see
>> Sema::DefaultLValueConversion).
>
> We've tried to implement your proposal, but ended up with putting
> OpenCLOptions into ASTContext, which is not the cleanest of solutions.

If

> it's the only problem with this patch, would it be possible to commit it
> as-is? Meanwhile, we'll try to come up with a better solution (fixing

the

arm-half.patch (18.1 KB)