[cfe-dev] Enabling "cl_khr_fp64" in order to visit OpenCL code with doubles

Benyei, Guy guy.benyei at intel.com
Tue Mar 13 05:43:21 PDT 2012


Hi Jorge,
As it defined by the OpenCL spec, one should use:

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

in order to enable this OpenCL extension. This pragma works fine in Clang.

Thanks

[email_signature_guy_new2]

From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Jorge Fern?ndez Fabeiro
Sent: Tuesday, March 13, 2012 14:32
To: Lista de Correo Clang Developers
Subject: Re: [cfe-dev] Enabling "cl_khr_fp64" in order to visit OpenCL code with doubles

Sorry, I forgot to tell you the Clang and LLVM revisions I'm using:

Clang: r130668
LLVM: r130661

I'm using them because they were the latest ones when I started with my project in July 2011.

Thanks so much again!
El 13 de marzo de 2012 13:28, Jorge Fernández Fabeiro <fabeirojorge at gmail.com<mailto:fabeirojorge at gmail.com>> escribió:
Hi!

I'm working in a project about source-to-source code transformations and I've just programmed a tool using Clang libraries (it's a program I've written in C++, it doesn't use Clang command-line tools at all) that visits the code of some given "for" loops and apply some optimization transformations (now, only loop unrolling).

Till today I've been testing the tool with OpenCL kernels that operate with integers or floats, but now I'm trying to process a kernel that operates with doubles, and, unfortunately the tool crashed. First, I tried to dump the CompoundStmt that represents the body of a visited "for" loop, and I discovered that it's empty when the visited code contains any reference to double variables. After this shocking problem, I replaced the "double" variables with "float" ones and all went smooth. Considering that workaround, I also tried to emit the LLVM representation of my OpenCL kernel with doubles, and clang gave me this error: "error: use of type 'double' requires cl_khr_fp64 extension to be enabled".

So, is there any method or flag in the classes of the libraries in order to enable this extension?

Thanks so much in advance,

Jorge.











---------------------------------------------------------------------
Intel Israel (74) Limited

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/20120313/62d45763/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 24800 bytes
Desc: image001.png
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120313/62d45763/attachment.png>


More information about the cfe-dev mailing list