Can't compile Libclc anylonger with current git LLVM since 16. Mai

Hello to the list,

my last and running Libclc was compiled with git LLVM taken from the same day:

/home/dieter> l /usr/local/lib/clc/
insgesamt 25188
drwxr-xr-x 2 root root 4096 16. Mai 04:00 .
drwxr-xr-x 10 root root 4096 28. Mai 19:03 ..
-rw-r--r-- 1 root root 3733300 16. Mai 04:00 amdgcn--amdhsa.bc
lrwxrwxrwx 1 root root 16 16. Mai 04:00 aruba-r600--.bc -> cayman-r600--.bc
-rw-r--r-- 1 root root 2120756 16. Mai 04:00 barts-r600--.bc
[-]

Only git change was:

commit 8243e979a42c48c6b018995d35e8a371014b59da
Author: Jan Vesely <jan.vesely@rutgers.edu>

     math: Use single precision fmax in sp path

     Fixes fdim piglit on Turks

     v2: use CL fmax instead of __builtin

     Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
     Reviewed-by: Tom Stellard <tom.stellard@amd.com>

     git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@269807 91177308-0d34-0410-b5e6-96231b3b80d8

Reverting it doesn't solve my problem.
So it must be LLVM?

I'm on x86_64 nehalem.

LLVM (http://llvm.org/):
   LLVM version 3.9.0svn
   Optimized build.
   Default target: x86_64-unknown-linux-gnu
   Host CPU: nehalem

   Registered Targets:
     amdgcn - AMD GCN GPUs
     r600 - AMD GPUs HD2XXX-HD6XXX
     x86 - 32-bit X86: Pentium-Pro and above
     x86-64 - 64-bit X86: EM64T and AMD64

Worked before like a charm.
Any pointers?

Thanks,
   Dieter

/opt/libclc> time nice +19 make
LLVM-AS generic--/lib/subnormal_disable.bc
LLVM-AS generic--/lib/subnormal_use_default.bc
LLVM-CC nvptx--nvidiacl/lib/synchronization/barrier.cl.bc
In file included from ./ptx-nvidiacl/lib/synchronization/barrier.cl:1:
./generic/include/clc/clc.h:5:26: warning: unsupported OpenCL extension
       'cl_clang_storage_class_specifiers' - ignoring [-Wignored-pragmas]
#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
                          ^
./generic/include/clc/clc.h:8:26: warning: unsupported OpenCL extension 'cl_khr_fp64' - ignoring
       [-Wignored-pragmas]
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
                          ^
In file included from ./ptx-nvidiacl/lib/synchronization/barrier.cl:1:
In file included from ./generic/include/clc/clc.h:15:
./generic/include/clc/clctypes.h:82:45: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
typedef __attribute__((ext_vector_type(2))) double double2;
                                             ^
./generic/include/clc/clctypes.h:83:45: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
typedef __attribute__((ext_vector_type(3))) double double3;
                                             ^
./generic/include/clc/clctypes.h:84:45: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
typedef __attribute__((ext_vector_type(4))) double double4;
                                             ^
./generic/include/clc/clctypes.h:85:45: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
typedef __attribute__((ext_vector_type(8))) double double8;
                                             ^
./generic/include/clc/clctypes.h:86:46: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
typedef __attribute__((ext_vector_type(16))) double double16;
                                              ^
In file included from ./ptx-nvidiacl/lib/synchronization/barrier.cl:1:
In file included from ./generic/include/clc/clc.h:18:
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
_CLC_VECTOR_CONVERT_TO_SUFFIX(_rtn)
^
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:45:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
   ^
./generic/include/clc/convert.h:33:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO1'
   _CLC_VECTOR_CONVERT_FROM(char, SUFFIX) \
   ^
./generic/include/clc/convert.h:26:39: note: expanded from macro '_CLC_VECTOR_CONVERT_FROM'
   _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
                                       ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:45:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
   ^
./generic/include/clc/convert.h:34:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO1'
   _CLC_VECTOR_CONVERT_FROM(uchar, SUFFIX) \
   ^
./generic/include/clc/convert.h:26:39: note: expanded from macro '_CLC_VECTOR_CONVERT_FROM'
   _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
                                       ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:45:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
   ^
./generic/include/clc/convert.h:35:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO1'
   _CLC_VECTOR_CONVERT_FROM(int, SUFFIX) \
   ^
./generic/include/clc/convert.h:26:39: note: expanded from macro '_CLC_VECTOR_CONVERT_FROM'
   _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
                                       ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:45:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
   ^
./generic/include/clc/convert.h:36:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO1'
   _CLC_VECTOR_CONVERT_FROM(uint, SUFFIX) \
   ^
./generic/include/clc/convert.h:26:39: note: expanded from macro '_CLC_VECTOR_CONVERT_FROM'
   _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
                                       ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:45:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
   ^
./generic/include/clc/convert.h:37:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO1'
   _CLC_VECTOR_CONVERT_FROM(short, SUFFIX) \
   ^
./generic/include/clc/convert.h:26:39: note: expanded from macro '_CLC_VECTOR_CONVERT_FROM'
   _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
                                       ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:45:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
   ^
./generic/include/clc/convert.h:38:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO1'
   _CLC_VECTOR_CONVERT_FROM(ushort, SUFFIX) \
   ^
./generic/include/clc/convert.h:26:39: note: expanded from macro '_CLC_VECTOR_CONVERT_FROM'
   _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
                                       ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:45:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
   ^
./generic/include/clc/convert.h:39:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO1'
   _CLC_VECTOR_CONVERT_FROM(long, SUFFIX) \
   ^
./generic/include/clc/convert.h:26:39: note: expanded from macro '_CLC_VECTOR_CONVERT_FROM'
   _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
                                       ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:45:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
   ^
./generic/include/clc/convert.h:40:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO1'
   _CLC_VECTOR_CONVERT_FROM(ulong, SUFFIX) \
   ^
./generic/include/clc/convert.h:26:39: note: expanded from macro '_CLC_VECTOR_CONVERT_FROM'
   _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
                                       ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:45:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
   ^
./generic/include/clc/convert.h:41:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO1'
   _CLC_VECTOR_CONVERT_FROM(float, SUFFIX)
   ^
./generic/include/clc/convert.h:26:39: note: expanded from macro '_CLC_VECTOR_CONVERT_FROM'
   _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
                                       ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:46:28: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_FROM(double, SUFFIX)
                            ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:46:28: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_FROM(double, SUFFIX)
                            ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:46:28: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_FROM(double, SUFFIX)
                            ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:46:28: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_FROM(double, SUFFIX)
                            ^
./generic/include/clc/convert.h:56:1: error: use of type 'double' requires cl_khr_fp64 extension to
       be enabled
./generic/include/clc/convert.h:53:3: note: expanded from macro '_CLC_VECTOR_CONVERT_TO_SUFFIX'
   _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
   ^
./generic/include/clc/convert.h:46:28: note: expanded from macro '_CLC_VECTOR_CONVERT_TO'
   _CLC_VECTOR_CONVERT_FROM(double, SUFFIX)
                            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
Makefile:29: recipe for target 'nvptx--nvidiacl/lib/synchronization/barrier.cl.bc' failed
make: *** [nvptx--nvidiacl/lib/synchronization/barrier.cl.bc] Error 1
0.488u 0.036s 0:00.54 94.4% 0+0k 0+40io 0pf+0w

This failure is not caused by libclc, but rather change in clang
(r269670). The revision changed the way clc extensions are handled and
did not allow any extensions for nvptx.

compilation fails because libclc configure sets -Dcl_khr_fp64, but
clang refuses to enable the extension.
Possible fixes/workarounds:
1.) Don't compile nvptx libclc target. amd targets have relied on clang
providing device information for some time, and should be fine (the bug
in current clang should not be fatal).

2.) Remove -Dcl_khr_fp64 from nvptx targets in configure. We'll
probably need to that anyway. This might lead to miscompiled libclc for
nvptx and you'll see a ton of warnings.

3.) Apply patches [0,1,2,3] to your clang and recompile. Patch [3]
should be enough, but I haven't tested them individually.

regards,
Jan

[0] http://reviews.llvm.org/D20447
[1] http://reviews.llvm.org/D20744
[2] http://reviews.llvm.org/D20388
[3] http://reviews.llvm.org/D20389

[-]

Thank you very much Jan!

I've taken route 2.) and libclc is running as before, e.g. on AMD Ni/Turks XT.
Awaiting route 3.), next.
Let me know when clang patches are landed.

Cheers,
   Dieter

> This failure is not caused by libclc, but rather change in clang
> (r269670). The revision changed the way clc extensions are handled
> and
> did not allow any extensions for nvptx.
>
> compilation fails because libclc configure sets -Dcl_khr_fp64, but
> clang refuses to enable the extension.
> Possible fixes/workarounds:
> 1.) Don't compile nvptx libclc target. amd targets have relied on
> clang
> providing device information for some time, and should be fine (the
> bug
> in current clang should not be fatal).
>
> 2.) Remove -Dcl_khr_fp64 from nvptx targets in configure. We'll
> probably need to that anyway. This might lead to miscompiled libclc
> for
> nvptx and you'll see a ton of warnings.
>
> 3.) Apply patches [0,1,2,3] to your clang and recompile. Patch [3]
> should be enough, but I haven't tested them individually.
>
> regards,
> Jan
>
> [0] http://reviews.llvm.org/D20447
> [1] http://reviews.llvm.org/D20744
> [2] http://reviews.llvm.org/D20388
> [3] http://reviews.llvm.org/D20389
>
> > Hello to the list,
> >
> > my last and running Libclc was compiled with git LLVM taken from
> > the
> > same day:

[-]

Thank you very much Jan!

I've taken route 2.) and libclc is running as before, e.g. on AMD
Ni/Turks XT.
Awaiting route 3.), next.
Let me know when clang patches are landed.

FYI: the clang and libclc patches are now in.

Jan

Thanks for the reminder, Jan!

Up and running.

Now, can't wait to see this all running on RX480 _8 GB_...:wink:

Dieter