Re: JIT compiling with LLVM v9.0

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: JIT compiling with LLVM v9.0
Date: 2018-01-26 10:06:27
Message-ID: 3f5a73ff-5586-a2cf-c8b3-8ef366a6bcc4@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26.01.2018 11:23, Andres Freund wrote:
> Hi,
>
> Thanks for testing things out!
>
Thank you for this work.
One more question: do you have any idea how to profile JITed code?
There is no LLVMOrcRegisterPerf in LLVM 5, so jit_profiling_support
option does nothing.
And without it perf is not able to unwind stack trace for generated code.
A attached the produced profile, looks like "unknown" bar corresponds to
JIT code.

There is NoFramePointerElim option in LLVMMCJITCompilerOptions
structure, but it requires use of ExecutionEngine.
Something like this:

    mod = llvm_mutable_module(context);
    {
        struct LLVMMCJITCompilerOptions options;
        LLVMExecutionEngineRef jit;
        char* error;
        LLVMCreateExecutionEngineForModule(&jit, mod, &error);
        LLVMInitializeMCJITCompilerOptions(&options, sizeof(options));
        options.NoFramePointerElim = 1;
        LLVMCreateMCJITCompilerForModule(&jit, mod, &options,
sizeof(options),
                                         &error);
    }
    ...

But you are compiling code using LLVMOrcAddEagerlyCompiledIR
and I find no way to pass no-omit-frame pointer option here.

--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
q1.svg image/svg+xml 49.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Emre Hasegeli 2018-01-26 10:07:52 Re: Redefining inet_net_ntop
Previous Message Amit Langote 2018-01-26 10:00:43 Re: [Sender Address Forgery]Re: pg_(total_)relation_size and partitioned tables