[cfe-dev] [OpenCL] atomic_double requires cl_khr_fp64 enabled

Liu, Yaxun (Sam) via cfe-dev cfe-dev at lists.llvm.org
Wed Apr 20 08:03:10 PDT 2016


Then we can let Clang define macro cl_khr_fp64 when cl-fp64-enable is on. Then the header file will use #ifdef cl_khr_fp64 to enable double type builtin functions.

Sam

From: Liu, Yaxun (Sam)
Sent: Wednesday, April 20, 2016 11:00 AM
To: 'Bader, Alexey' <alexey.bader at intel.com>; cfe-dev (cfe-dev at lists.llvm.org) <cfe-dev at lists.llvm.org>
Cc: 'anastasia.stulova at arm.com' <anastasia.stulova at arm.com>; Sumner, Brian <Brian.Sumner at amd.com>; Pan, Xiuli <xiuli.pan at intel.com>
Subject: RE: [OpenCL] atomic_double requires cl_khr_fp64 enabled

We can use that.

Currently double is automatically enabled in Clang for -cl-std=CL2.0. We could enable double only under cl-fp64-enable.

Sam

From: Bader, Alexey [mailto:alexey.bader at intel.com]
Sent: Wednesday, April 20, 2016 10:56 AM
To: Liu, Yaxun (Sam) <Yaxun.Liu at amd.com<mailto:Yaxun.Liu at amd.com>>; cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>) <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>
Cc: 'anastasia.stulova at arm.com' <anastasia.stulova at arm.com<mailto:anastasia.stulova at arm.com>>; Sumner, Brian <Brian.Sumner at amd.com<mailto:Brian.Sumner at amd.com>>; Pan, Xiuli <xiuli.pan at intel.com<mailto:xiuli.pan at intel.com>>
Subject: RE: [OpenCL] atomic_double requires cl_khr_fp64 enabled

One correction: doubles became optional core feature in OpenCL 1.2.

I'm agree that it's a bug, but I'd like to discuss the ideas on how to fix it.
There should be some way to let clang know that doubles are not supported by OpenCL platform and it's expected to get diagnostics in this case.

OpenCL C++ compiler introduces compiler knob for that. "cl-fp64-enable"
https://github.com/KhronosGroup/SPIR/blob/spirv-1.1/include/clang/Driver/CC1Options.td#L606

Thanks,
Alexey

From: Liu, Yaxun (Sam) [mailto:Yaxun.Liu at amd.com]
Sent: Wednesday, April 20, 2016 5:45 PM
To: cfe-dev (cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>)
Cc: 'anastasia.stulova at arm.com'; Sumner, Brian; Pan, Xiuli; Bader, Alexey
Subject: [OpenCL] atomic_double requires cl_khr_fp64 enabled

Currently Clang requires cl_khr_fp64 enabled to use atomic_double. This seems to be a bug.

In OpenCL 2.0 fp64 is an optional feature. If platform supports it, there is no need to enable cl_khr_fp64 to use it. Actually in OpenCL 2.0 spec cl_khr_fp64 is not defined.

I plan to fix that if all agree it is a bug.

What's your opinion? Thanks.

Sam

--------------------------------------------------------------------
Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160420/0dcf9b0f/attachment.html>


More information about the cfe-dev mailing list