From: preejackie <praveenvelliengiri@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: New LLVM JIT Features
Date: Wed, 3 Apr 2019 10:44:06 +0530
Message-ID: <859aa673-8303-2a1b-cc23-0dadfd412ec1@gmail.com> (raw)
In-Reply-To: <20190402215021.q7e7xjmobakkgan5@alap3.anarazel.de>
References: <c48c2dce-1290-5972-56be-e7dc89bda909@gmail.com>
<20190402215021.q7e7xjmobakkgan5@alap3.anarazel.de>
Hi Andres,
Thanks for the reply! Please see my comments inline.
On 03/04/19 3:20 AM, Andres Freund wrote:
> Hi,
>
> On 2019-04-02 00:51:51 +0530, preejackie wrote:
>> As LLVM ORC supports compiling in multiple backend threads, it would be
>> effective if we compile the functions speculatively before they are called
>> by the executing function. So when we request JIT to compile a function, JIT
>> will immediately returns the function address for raw executable bits. This
>> will greatly reduce the JIT latencies in modern multi-core machines.
> I personally think this should be approached somewhat differently -
> putting patchpoints into code reduces the efficiency of the generated
> code, so I don't think that's the right approach. What I think we should
What do you mean by patch points here? To my knowledge, LLVM symbols
have arbitrary stub associated which resolve to function address at
function address.
> do is to, if we decide it's worthwhile at plan time, generate the LLVM
> IR time at the beginning of execution, but continue to use interpreted
> execution initially. The generated IR would then be handed over to a
> background [process|thread|whatnot] for optimization of code
> generation. Then, when finished, I'd switch over from interpreted to JIT
> compiled execution. That approach will, in my view, yield better
> latency behaviour because we can actually evaluate quals etc for which
> we've not yet finished code generation.
>
>
>> And also I'm working on designing a ORC in-place dynamic profiling support, by
>> this JIT will automatically able to identify the hot functions, and compile
>> it in higher optimization level to achieve good performance.
> I think that's a nice concept, but at the moment the generated code is
> so bad that it's much more likely to get big benefits by improving the
> generated IR, compared to giving more hints to the optimizer.
By improving the generated IR, you mean by turning pgsql queries into
LLVM IR? If it is the case, this design doesn't handles that, it works
only when the given program representation is in LLVM IR.
>
> Greetings,
>
> Andres Freund
--
Have a great day!
PreeJackie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: praveenvelliengiri@gmail.com, andres@anarazel.de
Subject: Re: New LLVM JIT Features
In-Reply-To: <859aa673-8303-2a1b-cc23-0dadfd412ec1@gmail.com>
References: <c48c2dce-1290-5972-56be-e7dc89bda909@gmail.com> <20190402215021.q7e7xjmobakkgan5@alap3.anarazel.de> <859aa673-8303-2a1b-cc23-0dadfd412ec1@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox