Re: JIT compiling with LLVM v11 - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: JIT compiling with LLVM v11
Date
Msg-id CAEepm=3SJRpO63dMvKNp2u5eodFrK1hSQouANta70AxGwPe-Dg@mail.gmail.com
Whole thread Raw
In response to JIT compiling with LLVM v11  (Andres Freund <andres@anarazel.de>)
Responses Re: JIT compiling with LLVM v11  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Thu, Mar 1, 2018 at 9:02 PM, Andres Freund <andres@anarazel.de> wrote:
> Biggest changes:
> - LLVM 3.9 - master are now supported. This includes a good chunk of
>   work by Pierre Ducroquet.

I decided to try this on a CentOS 7.2 box.  It has LLVM 3.9 in the
'epel' package repo, but unfortunately it only has clang 3.4.  I
suppose it's important to make this work for RHEL7 using only
dependencies that can be met by the vendor package repos?  Maybe
someone who knows more about CentOS/RHE could tell me if I'm mistaken
and there is a way to get a more modern clang from a reputable repo
that our packages could depend on, though I release that clang is only a
build dependency, not a runtime one.  I'm unsure how that constrains
things.

clang: "clang version 3.4.2 (tags/RELEASE_34/dot2-final)"
gcc and g++: "gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)"
llvm: "3.9.1"

First problem:

clang: error: unknown argument: '-fexcess-precision=standard'
clang: error: unknown argument: '-flto=thin'

Ok, so I hacked src/Makefile.global.in to remove -flto=thin.  It looks
like -fexcess-precision-standard is coming from a configure test that
was run against ${CC}, not against ${CLANG}, so I hacked the generated
src/Makefile.global to remove that too, just to see if I could get
past that.

I don't know if there was another way to control floating point
precision in ancient clang before they adopted the GCC-compatible
flag, but it would seem slightly fishy to have .o files and .bc files
compiled with different floating point settings because then you could
get different answers depending on whether your expression is JITted.

Then I could build successfully and make check passed.  I did see one warning:

In file included from execExpr.c:39:
../../../src/include/jit/jit.h:36:3: warning: redefinition of typedef
'JitProviderCallbacks' is a C11 feature [-Wtypedef-redefinition]
} JitProviderCallbacks;
  ^
../../../src/include/jit/jit.h:22:37: note: previous definition is here
typedef struct JitProviderCallbacks JitProviderCallbacks;
                                    ^

That's a legit complaint.

-- 
Thomas Munro
http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: parallel append vs. simple UNION ALL
Next
From: Andres Freund
Date:
Subject: Re: JIT compiling with LLVM v11