[cfe-dev] Odd behaviour with '-save-temps' and OpenCL files

mats petersson via cfe-dev cfe-dev at lists.llvm.org
Sun Nov 6 02:01:05 PST 2016


My guess, and it's only a guess, is that -save-temps causes the compiler to
run each step on those files, by executing independent processes, rather
than the usual "run all steps in parallel" - in my understanding, Clang
doesn't actually work in the "old style cc way" and running several
processes with files produced between each step. And as a result, with
-save-temps, when the compiler comes to process the second step (processing
the .i file), it has "lost" the fact that you are compiling CL code (and I
suspect this would happen to other types than half, just not types that are
"same as C")

--
Mats

On 5 November 2016 at 22:14, Martin J. O'Riordan via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> I’m not sure whether to direct this message to LLVM-Dev or CFE-Dev, but I
> think CFE is more appropriate.
>
>
>
> This is in respect to our out-of-tree implementation, derived from the
> v3.9.0 sources.
>
>
>
> If I am compiling a source file, and I use ‘-c -save-temps’ (or ‘-c
> -save-temps=obj’), the intermediate files ‘.i’ or ‘.ii’, ‘.bc’ and ‘.s’
> are retained as expected; but in an odd twist, I get errors when I compile
> OpenCL files with the ‘.cl’ extension.
>
>
>
> This only happens if the OpenCL source uses the keyword ‘half’.  If I do
> not use ‘-save-temps’ then everything works correctly, but when I do use ‘
> -save-temps’ it fails to parse ‘half’ as being valid.  The errors I get
> when I use ‘-save-temps’ are:
>
>
>
> warning: unknown pragma ignored
>
> for:
>
> #pragma OPENCL EXTENSION cl_khr_fp16 : enable
>
>
>
> and then subsequent uses of ‘half’ such as:
>
>
>
> typedef __attribute__((ext_vector_type(2))) half half2;
>
> result in:
>
> error: unknown type name 'half'
>
>
>
> When I omit ‘-save-temps’ the source compiles correctly with no warnings
> or errors.
>
>
>
> Any idea what might be happening here?  Are there changes in OpenCL
> support that I need to update my library sources for?  Most of these are
> from the ‘libclc’ sources, though I do have local edits that might be
> stale with respect to recent changes for OpenCL support.
>
>
>
> Thanks,
>
>
>
>             MartinO
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161106/b7d88665/attachment.html>


More information about the cfe-dev mailing list